You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Perry A. Caro" <ca...@Adobe.COM> on 2001/05/09 00:22:29 UTC

Colons in PI target names?

Consider the following simplified XML example:

================
<?xml version="1.0" encoding="UTF-8"?>

<?xml:stylesheet href="Subject.css" type="text/css"?>
<Subject>
</Subject>
================

When I run this through Xerces-C 1.4 stable SAX2XMLReader, with namespace
handling enabled, I get the following error:

 Colons are not allowed in this name when namespaces are enabled#126

It's complaining about the Processing Instruction target, xml:stylesheet.

The relevant code is in XMLScanner.cpp, in scanPI:

    // If namespaces are enabled, then no colons allowed
    if (fDoNamespaces)
    {
        if (XMLString::indexOf(namePtr, chColon) != -1)
            emitError(XMLErrs::ColonNotLegalWithNS);
    }

Can someone cite the XML or Namespace spec section which indicates that
colons are not allowed in Processing Instruction target names?  I'm really
surprised by this.

I noticed that the latest xml-stylesheet spec
<http://www.w3.org/1999/06/REC-xml-stylesheet-19990629/>, uses
<?xml-stylesheet ... ?>, so the customer producing this XML is not
conforming to that spec.  I'm guessing that xml:stylesheet might have been
in an older spec, but was changed to conform to the XML or Namespace section
I'm seeking above.  But that's all just my speculation.

Thanks,

Perry

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Colons in PI target names?

Posted by Arnaud Le Hors <le...@us.ibm.com>.
My take on this is that it's simply a bug in our parser. My guess is
that, because PI target names are defined to be XML Names, we use the
same piece of code to check on it as we use everywhere else. When
namespace support was added this special case was overlooked.
I don't see on what ground the parser would barf like it does. In the
second revision of the XML 1.0 spec we actually added the following note
[1]:

Note:

The Namespaces in XML Recommendation [XML Names] assigns a meaning to
names containing colon characters. Therefore, authors should not use the
colon in XML names except for namespace purposes, but XML processors
must accept the colon as a name character.

[1] http://www.w3.org/TR/REC-xml#dt-name
-- 
Arnaud  Le Hors - IBM Cupertino, XML Strategy Group

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org