XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Transforming documents with undefined entities

Hi everyone,

I’m experiencing something unexpected when transforming documents with undefined entities using Saxon. I asked on the Saxon mailing list, and Michael Kay suggested I tried asking here too. 

I have two XML files, one with an internal DTD (badent-internal.xml), one with an external DTD (badent-external.xml). Both of them reference an undefined entity (&badent;). When I parse either of them with xmllint, the undefined entity is reported.

$ xmllint badent-internal.xml
badent-internal.xml:4: parser error : Entity 'badent' not defined
<chapter>&badent;</chapter>
                 ^

When I try to transform them on the command line using Saxon, badent-internal.xml throws an error, but badent-external.xml is transformed as if the entity reference were not present. 

$ java -cp ~/Documents/XML/SaxonHE9-6-0-7J/saxon9he.jar net.sf.saxon.Transform -xsl:simple.xsl -s:badent-internal.xml
Error on line 4 column 18 of badent-internal.xml:
  SXXP0003: Error reported by XML parser: The entity "badent" was referenced, but not declared.
org.xml.sax.SAXParseException; systemId: file:/Users/acam0006/Desktop/saxon.entity.test/missing.entity/badent-internal.xml; lineNumber: 4; columnNumber: 18; The entity "badent" was referenced, but not declared.

$ java -cp ~/Documents/XML/SaxonHE9-6-0-7J/saxon9he.jar net.sf.saxon.Transform -xsl:simple.xsl -s:badent-external.xml
<?xml version="1.0" encoding="UTF-8"?><success/>

I expected both files to throw the same error. What is going on?

I have attached the relevant files to this email.

Andrew

Attachment: badent-external.xml
Description: badent-external.xml

Attachment: badent-internal.xml
Description: badent-internal.xml

Attachment: external.dtd
Description: external.dtd

Attachment: simple.xsl
Description: simple.xsl



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS