DOCTYPE handling in XML

Peter T Cash <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <OFE9CFB036.6426A7E6-ON862574E9.0051112C-862574E9.00567178@abbott.com>
For what it's worth, this appears to be a general limitation of XML tools. 
I've been writing XSLs and running them with the Saxon parser; I ran into 
the same problem. There's apparently no way to get an XSL transform to 
process an XML document and preserve ENTITY declarations. This appears to 
be a side effect of the fact that the parser won't copy the DOCTYPE 
declaration to the output, and the ENTITY declarations are part of the 
DOCTYPE. 

You can get the transform to output a doctype declaration with the 
doctype-public or doctype-system attributes of the xsl:output statement, 
but that's not the same as copying what's there--you won't get the ENTITY 
declarations. 

The workaround, of course, is to use a Perl program to just pfutz around 
with your output files (get the declarations from the original document, 
and stick them to the front of the XSL output). If you're writing the 
whole thing in Perl to begin with, that's easy, of course. (My manager had 
a thing about Perl, and insisted I just use straight XSLs and DOS batch 
files...until we ran into stuff like this. Heh heh...)

Petr, We've been using NDATA etc. also to declare image files as entities; 
I'll have to look into XLink...but I'm not sure that the whole mess of 
tools we've got cobbled together will support any given protocol (e.g. 
Xlink). That's the Xtrouble with the whole Xworld...the Xtools never seem 
to quite do what's Xneeded. 

Peter
Petitioning the W3C to deprecate the letter "X" since 1998.


> From: Petr Pajas <[email protected]>
 
> No, XML::LibXML does not provide methods for manipulating document type 
> declarations. You have to manipulate the raw XML text and parse it.
> 
> P.S. <!ENTITY...> is not an element!
> P.P.S. Are you sure you want to use NDATA entities for that and not e.g. 
an 
> XLink?
> 
> -- Petr
> 
> Dne Friday 17 October 2008 19:28:54 Todd Holmberg napsal(a):
> > Is it possible to create an external entity using the methods provided
> > in the XML::LibXML modules? I am trying to create this element:
> >
> > <!ENTITY F001 SYSTEM "images/fig1.jpg" NDATA JPEG>
> >
> > I am using the w3c standard (http://www.w3.org/TR/xml/#sec-external-
> > ent)  as my guideline for defining external entities. Any help with
> > this issue would be greatly appreciated.
> >
> >
> > Thank you,
> >
> > Todd Holmberg
> >
> > The Johns Hopkins University Press
> > 2715 N. Charles St.
> > Baltimore, MD 21218
> > [email protected]
> > --------------------------
> > Phone: 410-516-3832
> > Fax: 410-516-6968
> > --------------------------
> > http://press.jhu.edu
> >
> >
> >
> >
> >
> >
> >
> > _______________________________________________
> > Perl-XML mailing list
> > [email protected]
> > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> Perl-XML mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 
> 
> End of Perl-XML Digest, Vol 57, Issue 2
> ***************************************

_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.