OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] qName/localName confusion

[ Lists Home | Date Index | Thread Index ]

+1. I never remember my parsers attitude and keep checking for nulls in 
both local and qname... both should always be reported. If with a null 
namespace, qname and local name should be equal.

Karl Waclawek wrote:

> Since we are still not done with all the SAX issues:
> 
> here is another thing that has never been clear to me:
> 
> Docs for startElement say this:
> 
> <quote>
> This event allows up to three name components for each element:
> 
>   1.. the Namespace URI;
>   2.. the local name; and
>   3.. the qualified (prefixed) name.
> Any or all of these may be provided, depending on the values of the
> http://xml.org/sax/features/namespaces and the
> http://xml.org/sax/features/namespace-prefixes properties:
> 
>   a.. the Namespace URI and local name are required when the namespaces
>       property is true (the default), and are optional when the namespaces
>       property is false (if one is specified, both must be);
>   b.. the qualified name is required when the namespace-prefixes property
>       is true, and is optional when the namespace-prefixes property is false
>       (the default).
> </quote>
> 
> Strictly speaking that means that, when both features above are false,
> all three components - uri, localName, qName - are optional?
> And if I have a localName then an URI must be specified, based on a).
> 
> So, if there is no namespace defined, then  there is no URI and therefore
> localName must be empty, which leaves the qName. Now, if namespace processing
> is turned off, then qNames don't exist, but we also can't use the localName.
> So, one could say that in the absence of namespace processing qName = Name.
> But it is still optional.
> 
> This leaves me with this scenario - assuming namespace processing is turned on,
> but namespace-prefixes is turned off:
> - If the name is in a namespace, I will receive an URI and a localName,
>   but not necessarily a qName.
> - If the name is not in a namespace, I will not receive an URI and a localName,
>   but I should receive a qName (although strictly speaking it is optional).
> This forces me to have some checking logic even when I know how
> the features are set.
> 
> So far I have used this approach in the SAX2 adapter for Expat:
> Always provide a localName and qName, even if they are the same.
> I know, this contradicts a), but I am confused anyway.
> 
> The API would be easier to use if the three components provided
> were URI, localName and prefix. No confusion there.
> But considering the current API can't be changed, why not make
> the qName parameter required at all times, even if it is not
> required to contain the prefix?
> 
> Karl
> 
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://www.oasis-open.org/mlmanage/index.php>
> 
> 

-- 
Manos Batsis

     _  __    __                    __
    / |/ /__ / /____ __ _ ___ _____/ /_
   /    / -_) __(_-</  ' Y _ `/ __/ __/
  /_/|_/\__/\__/___/_/_/_|_,_/_/  \__/


http://www.netsmart.gr
mailto:mbatsisSPAM_TRAP@netsmart.gr
tel:+302103240940
http://forte.netsmart.gr/foaf/manos_foaf.rdf






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS