Transforming documents with undefined entities

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Transforming documents with undefined entities

Andrew Campbell
Hi everyone,

I’m experiencing something unexpected when transforming documents with undefined entities using Saxon.

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


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 

badent-external.xml (96 bytes) Download Attachment
badent-internal.xml (116 bytes) Download Attachment
external.dtd (42 bytes) Download Attachment
simple.xsl (334 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Transforming documents with undefined entities

Michael Kay
I don't know, I'm afraid. Both Apache Xerces and the built-in JDK parser seem to show the same behaviour, but I can't explain it. Oxygen reports an error for both XML files.

We obviously invoke the parser in exactly the same way for both inputs, and for one of them it throws and error and for the other it doesn't. Might be worth a question on xml-dev.

Michael Kay
Saxonica

On 11 Apr 2016, at 12:15, Andrew Campbell <[hidden email]> wrote:

Hi everyone,

I’m experiencing something unexpected when transforming documents with undefined entities using Saxon.

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



<badent-external.xml><badent-internal.xml><external.dtd><simple.xsl>------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Transforming documents with undefined entities

Andrew Campbell
Thanks – I’ll ask on xml-dev.

From: Michael Kay <[hidden email]>
Reply-To: Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>
Date: Friday 15 April 2016 at 00:33
To: Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>
Subject: Re: [saxon] Transforming documents with undefined entities

I don't know, I'm afraid. Both Apache Xerces and the built-in JDK parser seem to show the same behaviour, but I can't explain it. Oxygen reports an error for both XML files.

We obviously invoke the parser in exactly the same way for both inputs, and for one of them it throws and error and for the other it doesn't. Might be worth a question on xml-dev.

Michael Kay
Saxonica

On 11 Apr 2016, at 12:15, Andrew Campbell <[hidden email]> wrote:

Hi everyone,

I’m experiencing something unexpected when transforming documents with undefined entities using Saxon.

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



<badent-external.xml><badent-internal.xml><external.dtd><simple.xsl>------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Transforming documents with undefined entities

Andrew Campbell


From: Andrew Campbell <[hidden email]>
Reply-To: Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>
Date: Tuesday 19 April 2016 at 09:24
To: Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>
Subject: Re: [saxon] Transforming documents with undefined entities

Thanks – I’ll ask on xml-dev.

From: Michael Kay <[hidden email]>
Reply-To: Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>
Date: Friday 15 April 2016 at 00:33
To: Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>
Subject: Re: [saxon] Transforming documents with undefined entities

I don't know, I'm afraid. Both Apache Xerces and the built-in JDK parser seem to show the same behaviour, but I can't explain it. Oxygen reports an error for both XML files.

We obviously invoke the parser in exactly the same way for both inputs, and for one of them it throws and error and for the other it doesn't. Might be worth a question on xml-dev.

Michael Kay
Saxonica

On 11 Apr 2016, at 12:15, Andrew Campbell <[hidden email]> wrote:

Hi everyone,

I’m experiencing something unexpected when transforming documents with undefined entities using Saxon.

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



<badent-external.xml><badent-internal.xml><external.dtd><simple.xsl>------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial! http://pubads.g.doubleclick.net/
gampad/clk?id=1444514301&iu=/ca-pub-7940484522588532_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Loading...