On 29/01/2011 00:56, Derek Read wrote:
> I have a client using the DITA Open Toolkit which they have configured
> to use Saxon for XSLT. I believe the Saxon version is likely 9B. I do
> not know if this issue affects the current Saxon release but I suspect
> it will as I see nothing in the bug tracker that sounds like anyone has
> raised this issue.
> For documents containing either a processing instruction or comment (or
> both) after the closing root tag Saxon gives the following incorrect
> "XML document structures must start and end within the same entity."
This error is coming from the XML parser, not from Saxon. The first
thing I suggest with XML parser problems is to make sure you are using
the Xerces parser from Apache, not the one built in to the Sun JDK,
which is very buggy. I haven't seen this particular problem before, but
that would certainly be my first port of call.
You can select the XML parser that Saxon invokes using the -x option on
the command line, or by supplying a SAXSource with the XMLReader
preconfigured if you are using the Java API.
> Following is an example the type of structure that is triggering this
> incorrect error in Saxon:
> <?xml version="1.0"?>
> <!DOCTYPE root PUBLIC "-//ORG//MY PUBLIC ID//EN" "myschema.dtd">
> <!--pre-root comments are OK-->
> <?target pre-root processing instructions OK?>
> <!--post-root comments are a problem-->
> <?post-root processing instructions are a problem?>
> Saxon does not complain about the "pre-root" items, but it does care
> about those after the closing root tag.
> It should be possible to reproduce this issue with any DTD or Schema by
> simply creating a document that contains either a comment or PI after
> the root element.
> I have read that the same error will be raised when real validation
> problems are present. The error is not really clear to me with its usage
> of the term "entity" in this context, so that had me pretty confused at
> first. Examples that I have found while searching for this exact error
> (Google) are apparently reported for truly invalid documents, including
> those with a missing closing root tag or an element after the root.
> Parsers such as Xalan, MSXML, and our own product XMetaL Author allow
> PIs and Comments to appear after the root element as outlined in the XML
> We will likely be working around this issue with the client by
> restricting their authors from creating such documents by adding some
> business-rule customizations to their installation of our product. We
> have also suggested they might try a different parser with the DITA OT
> (such as Xalan). However, I wanted to bring this issue to the attention
> of the Saxon community in case it was unknown.
> Derek Read
> JustSystems Canada
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> saxon-help mailing list archived at http://saxon.markmail.org/