You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Tuomas Kiviaho <tu...@iki.fi> on 2009/09/11 05:43:28 UTC

Why does attribute localName exist when namespace awareness is turned off?

When XMLDocumentFragmentScannerImpl scans elements it doesn't pass on any
localName or namespaceURI values, but for attributes it contains following
lines...

    protected void scanAttribute(XMLAttributes attributes) throws
IOException, XNIException {
        ...
        if (fNamespaces) {
            fEntityScanner.scanQName(fAttributeQName);
        }
        else {
            String name = fEntityScanner.scanName();
            fAttributeQName.setValues(null, name, name, null);
        }

The latter one kicks in and name is applied to both qName and localName.
According to <http://www.saxproject.org/namespaces.html> in my opinion the
localName should be empty. 

I've trusted so far localName being empty to imply that namespace awareness
is turned off. Luckily I can work around this problem in SAX relying on
element localName being empty instead.

--
Tuomas
-- 
View this message in context: http://www.nabble.com/Why-does-attribute-localName-exist-when-namespace-awareness-is-turned-off--tp25394586p25394586.html
Sent from the Xerces - J - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Why does attribute localName exist when namespace awareness is turned off?

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Might be a bug though there are certainly more direct ways of determining
namespace awareness. Specifically, checking the state of the SAX namespace
feature [1].

Thanks.

[1] http://xerces.apache.org/xerces2-j/features.html#namespaces

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Tuomas Kiviaho <tu...@iki.fi> wrote on 09/10/2009 11:43:28 PM:

>
> When XMLDocumentFragmentScannerImpl scans elements it doesn't pass on any
> localName or namespaceURI values, but for attributes it contains
following
> lines...
>
>     protected void scanAttribute(XMLAttributes attributes) throws
> IOException, XNIException {
>         ...
>         if (fNamespaces) {
>             fEntityScanner.scanQName(fAttributeQName);
>         }
>         else {
>             String name = fEntityScanner.scanName();
>             fAttributeQName.setValues(null, name, name, null);
>         }
>
> The latter one kicks in and name is applied to both qName and localName.
> According to <http://www.saxproject.org/namespaces.html> in my opinion
the
> localName should be empty.
>
> I've trusted so far localName being empty to imply that namespace
awareness
> is turned off. Luckily I can work around this problem in SAX relying on
> element localName being empty instead.
>
> --
> Tuomas
> --
> View this message in context: http://www.nabble.com/Why-does-
> attribute-localName-exist-when-namespace-awareness-is-turned-off--
> tp25394586p25394586.html
> Sent from the Xerces - J - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org