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 Da...@lotus.com on 2001/04/02 03:53:58 UTC

Namespace problem in latest code

I just pulled down the latest Xerces code and rebuilt it.  Now, all
elements without a prefix are being assigned the URI
"http://www.w3.org/XML/1998/namespace"

I just can't believe this is correct.  I traced the problem to line 2726 of
XMLScanner.cpp, where the URI is assumed to be the XML namespace URI unless
found.

    unsigned int uriId = fXMLNamespaceId;

Can anyone comment on why this was done, and whether or not they think it's
a bug?

Thanks,

Dave


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


RE: A different namespace issue, bug?

Posted by "David E. Cleary" <da...@progress.com>.
> When I run this through the SAX2 parser interface for Xerces,
> with default feature settings (which means namespace processing
> is on), I get the following fatal error:
>
> Fatal Error: The prefix 'xlink' has not been mapped to any URI#114 (3:29)
>
> I believe this is an overzealous interpretation of the XML and
> Namespace specs.  Just because an XML name has ":" in it does not
> mean it is a qualified name in some namespace.

I disagree. From the current Infoset WD:

<Quote>
XML 1.0 documents that do not conform to [Namespaces], though technically
well-formed, are not considered to have meaningful information sets. That
is, this specification does not define an information set for documents that
have element or attribute names containing colons that are used in other
ways than as prescribed by [Namespaces].

Furthermore, this specification does not define an information set for
documents which use relative URI references in namespace declarations. This
is in accordance with the decision of the W3C XML Plenary Interest Group
described in [Relative Namespace URI References]. Thus the value of a
[namespace name] property is always an absolute URI with an optional
fragment identifier.
</Quote>


And if you follow that directly to Namespaces, you get:

<Quote>
Namespace Constraint: Prefix Declared
The namespace prefix, unless it is xml or xmlns, must have been declared in
a namespace declaration attribute in either the start-tag of the element
where the prefix is used or in an an ancestor element (i.e. an element in
whose content the prefixed markup occurs). The prefix xml is by definition
bound to the namespace name http://www.w3.org/XML/1998/namespace. The prefix
xmlns is used only for namespace bindings and is not itself bound to any
namespace name.

</Quote>

So this certainly isn't overzealous interpretation.

> I believe a more correct intrepretation would be that if no
> matching xmlns declaration can be found in the scope of the XML
> name, the name should be treated as an unqualified ordinary name,
> just like "a" and "b" in the rest of the sample.
>
> Compromise: make it a Warning rather than a Fatal Error.

The right thing to do is to turn off namespace processing if you don't want
namespace processing.

David Cleary
Progress Software


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


A different namespace issue, bug?

Posted by "Perry A. Caro" <ca...@Adobe.COM>.
Here's a different namespace issue in Xerces-C.  Consider the following simple input file:

<?xml version="1.0"?>
<doc>
    <first xlink:href="." />
    <second>some text</second>
    <third a="1">
        <fourth>Text</fourth>
        <fifth>
            <sixth a="1" b="2">
                <seventh a="1"/>
            </sixth>
        </fifth>
        <!-- comment -->
        <?pi ip?>
    </third>
</doc>

When I run this through the SAX2 parser interface for Xerces, with default feature settings (which means namespace processing is on), I get the following fatal error:

Fatal Error: The prefix 'xlink' has not been mapped to any URI#114 (3:29)

I believe this is an overzealous interpretation of the XML and Namespace specs.  Just because an XML name has ":" in it does not mean it is a qualified name in some namespace.

I believe a more correct intrepretation would be that if no matching xmlns declaration can be found in the scope of the XML name, the name should be treated as an unqualified ordinary name, just like "a" and "b" in the rest of the sample.

Compromise: make it a Warning rather than a Fatal Error.

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: Namespace problem in latest code

Posted by Dean Roddey <dr...@charmedquark.com>.
That's the URL for the xml prefix. Not sure how it started getting used for
the default namespace. The parser did, perhaps a little unconventionally,
assign a proprietary URL to the global namespace, if I remember correctly.
There wasn't one defined for it, and it didn't make any sense for it not to
map to something (since otherwise all code would have to special case for
it), so we mapped it to some internally used URL. Perhaps that was what this
was doing originally and somehow it got changed to another URL?

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"I'm not sure how I feel about ambivalence"


----- Original Message -----
From: <Da...@lotus.com>
To: <xe...@xml.apache.org>
Sent: Sunday, April 01, 2001 6:53 PM
Subject: Namespace problem in latest code


> I just pulled down the latest Xerces code and rebuilt it.  Now, all
> elements without a prefix are being assigned the URI
> "http://www.w3.org/XML/1998/namespace"
>
> I just can't believe this is correct.  I traced the problem to line 2726
of
> XMLScanner.cpp, where the URI is assumed to be the XML namespace URI
unless
> found.
>
>     unsigned int uriId = fXMLNamespaceId;
>
> Can anyone comment on why this was done, and whether or not they think
it's
> a bug?
>
> Thanks,
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


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