[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: DTD's in external Entities?
External entities may not have DTDs. They also may not have standalone='...'" attributes in their text declarations. In both cases, the XML spec requires fatal errors to be reported; unless, that is, you've got a non-validating processor which isn't reading the external entity! If you find an "XML" processor which supports the nesting that you're trying, return it to the vendor for a full refund ... ;-) - Dave Binesh Bannerjee wrote: > > Woo hoo, I'm finally off the edge and have dove into the world > of XML/DOM etc... I have a question tho... > > Here's what I want to do: > I want to have a document "container.xml" > > <?xml version="1.0" standalone="no" ?> > <!DOCTYPE container [ > <!ELEMENT container ANY> > <!ENTITY blah SYSTEM "blah.xml"> > ]> > > <container> > &blah; > </container> > > then, > blah would contain: > <?xml version="1.0" standalone="yes" ?> > <!DOCTYPE data [ > <!ELEMENT data (firstname,lastname)> > <!ELEMENT firstname (#PCDATA)> > <!ELEMENT lastname (#PCDATA)> > ]> > <data> > <firstname>Binesh</firstname> > <lastname>Bannerjee</lastname> > </data> > > I'm using Sun's DOM implementation... If I'm not misinterpreting, Listing > 6-17 in "XML: Extensible Markup Language" by Elliotte Rusty Harold on page > 202 does exactly that... > > If I run Sun's > XmlDocument.createXmlDocument("file:///path/blah.xml",true); > > works fine... > However > running XmlDocument.createXmlDocument("file:///path/container.xml",true); > > yields: > org.xml.sax.SAXParseException: Expected "encoding=...". > at com.sun.xml.parser.Parser.fatal(Parser.java:2797) > > Removing the xml PI from blah.xml (which makes it an invalid doc, if I've > read the spec correctly) yields: > org.xml.sax.SAXParseException: The content beginning "<!" is not legal markup. Perhaps the "!" () character should be a letter. > at com.sun.xml.parser.Parser.fatal(Parser.java:2797) > > What's going on? > Shouldn't I be able to do this? If I remove the &blah; in > container.xml it parses fine... If not, what is the best way of doing > what I want? Even this fails: > blah.dtd: > <!ELEMENT data (firstname,lastname)> > <!ELEMENT firstname (#PCDATA)> > <!ELEMENT lastname (#PCDATA)> > > blah.xml: > <?xml version="1.0" standalone="no"?> > <!DOCTYPE data SYSTEM "blah.dtd"> > <data> > <firstname>Binesh</firstname> > <lastname>Bannerjee</lastname> > </data> > container.xml: > <?xml version="1.0" standalone="no"?> > <!DOCTYPE container [ > <!ELEMENT container ANY> > <!ENTITY blah SYSTEM "blah.xml"> > ]> > <container> > &blah; > </container> > > How does one include _valid_ xml docs in other _valid_ xml docs?? > Am I doing something wrong, or is it time to switch DOM implementations? > > Thanks... > Binesh Bannerjee > > xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... > Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1 > To (un)subscribe, mailto:majordomo@i... the following message; > (un)subscribe xml-dev > To subscribe to the digests, mailto:majordomo@i... the following message; > subscribe xml-dev-digest > List coordinator, Henry Rzepa (mailto:rzepa@i...) xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1 To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|