General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion XMetaL Author 8.0 Error with XML declaration in external entity

  • MarcB

    XMetaL Author 8.0 Error with XML declaration in external entity

    Participants 3
    Replies 4
    Last Activity 8 years, 10 months ago

    We have XML documents that declare and reference external entity files and have worked this way successfully with XMetaL 6.0. After upgrading to XMetaL 8.0, we now get the error message on open: “The target names “XML”, “xml”, and so on are reserved for standardization. Processing instruction cannot use it as target name.  Error occurred in the content of entity “simple”.” The document opened:


    ]>

    &simple;

    The file simple.ent has in the first line:
    Without the declaration in the external entity file, everything is fine. With the declaration, we get the error. But only in XMetaL 8.0.
    We literally have hundreds of these files, never a problem before. Is this a bug in XMetaL 8.0?

    Reply

    Derek Read

    Reply to: XMetaL Author 8.0 Error with XML declaration in external entity

    Yes, this is a bug that affects XMetaL Author Essential 8.0 and XMetaL Author Enterprise 8.0, which share the same validation engine.

    It was introduced when we tightened the XML validation engine to flag processing instructions containing the string “xml” as being invalid (which is correct behaviour). Unfortunately, that code does not differentiate between a regular PI (where it is invalid) and the PI contained in the XML file's Prolog (the “XML Declaration”). When you reference an external parsed entity (aka: file entity) it is expanded in place inside the referencing file. The XML Declaration PI is included in that expansion and then incorrectly indicated as being an illegal PI because it now appears inside the referencing document outside that document's own Prolog.

    The solution in your case is to revert to the old behaviour by setting the following INI variable:
    enable_pi_validation = false

    Setting that INI variable will also stop the validation engine from catching “regular” PIs that contain the string “xml” which is the new behaviour implemented that causes your particular issue.

    Reply

    Derek Read

    Reply to: XMetaL Author 8.0 Error with XML declaration in external entity

    The following is a representation of what the resulting expansion looks like and the portion (marked in red) that XMetaL Author is flagging incorrectly as invalid:

    External Parsed Entity File:
    (made up by me and representing the contents of “simple.ent”)

    foo bar

    Your Referencing File:


    ]>
    &simple;

    Resulting Expansion:


    ]>

    xml version="1.0" encoding="utf-8"?>
    foo bar

    The XML Recommendation does not seem to explicitly state anything about this exception, but a validating XML processor should not flag it as invalid (most do not). And we agree, otherwise external parsed entities would not be allowed to contain an XML declaration (the PI) but the recommendation clearly states that they “SHOULD” in http://www.w3.org/TR/REC-xml/#sec-TextDecl.

    Hopefully we'll fix it at some point so that invalid PIs containing “xml” are caught but external parsed entities are not incorrectly flagged.

    Reply

    MarcB

    Reply to: XMetaL Author 8.0 Error with XML declaration in external entity

    Thanks, Derek, that works for us.

    Reply

    duboisy

    Reply to: XMetaL Author 8.0 Error with XML declaration in external entity

    Thanks Derek, That also works for us as we also have hundreds of files with

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support