You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Simon St.Laurent" <si...@simonstl.com> on 2002/06/02 16:16:35 UTC

Re: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

At 08:12 AM 6/1/2002 -0700, David Brownell wrote:
>Hmm, in that case it might also be worth just stipulating that the URI
>and localName must always be reported as empty strings when namespace
>processing is disabled ... as it stands today, processors are allowed
>to report them in that case (but not required).  That is, if that
>processing is turned off ("out of that context"), it's really off.

I disagree completely.  I write all of my filter code to rely on localName 
and URI - with no ill-effects when there is no URI - see below for more on why.


>On the other hand, I don't think I've heard anything but agreement to
>the notion that qName should always be reported ... at least when
>processing "real XML" instead of something that already discarded
>the prefixes being used.

If "namespace processing is off and we've never heard of namespaces", then 
we've never heard of QNames either.  If you insist on going this route, 
you'd better change the API to remove the notion of QName when namespace 
processing is off.  "Local name" might at least mean "the name local to the 
element" in cases without any understanding of namespaces.

>Those are both categories of implementation variance that the current
>SAX spec allows, though which (thankfully) not many implementors have
>taken advantage of.  In the interest of application portability, I'd
>be glad to see them removed in a SAX 2.1 release.

In the interest of application portability, I'd recommend requiring 
reporting the name of the element as localName when namespace processing is 
turned off.

Simon St.Laurent
"Every day in every way I'm getting better and better." - Emile Coue


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


Re: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by "Simon St.Laurent" <si...@simonstl.com>.
At 10:53 AM 6/2/2002 -0400, Karl Waclawek wrote:
>Simon St.Laurent wrote:
>
> > If "namespace processing is off and we've never heard of namespaces", then
> > we've never heard of QNames either.  If you insist on going this route,
> > you'd better change the API to remove the notion of QName when namespace
> > processing is off.  "Local name" might at least mean "the name local to 
> the
> > element" in cases without any understanding of namespaces.
>
>I understand it the same way. The confusion in this thread really is:
>if NS processing is off, then which should really represent the
>element name - qName or localName? I agree with you that localName is
>the more natural candidate.

I'm also not certain that we want to encourage developers to look to qName 
for anything other than prefix-retrieval in any event.  I keep hearing of 
developers who rely solely on qName whatever the status of 
namespace-processing, and I guess it works for now...

Simon St.Laurent
"Every day in every way I'm getting better and better." - Emile Coue


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


Re: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by Rob Lugt <ro...@elcel.com>.
Simon St.Laurent wrote
>
> In the interest of application portability, I'd recommend requiring
> reporting the name of the element as localName when namespace processing
is
> turned off.
>

FWIW, I Agree.  I think of the local name as being the name of the element,
minus the namespace prefix (if any).  When namespace processing is disabled,
there is no prefix - so localName should be equal to the literal name of the
element.

~Rob


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


Re: [xml-dev] RE: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by Ronald Bourret <rp...@rpbourret.com>.
"Simon St.Laurent" wrote:
> 
> At 12:42 PM 6/2/2002 -0700, Yuval Oren wrote:
> ><my:doc/>
> >
> >With namespace processing off, SAX2 compliant parsers can provide a
> >localName value of either "" or "doc", while qName must be "my:doc". If this
> >were changed in a SAX 2.1 release, 2.1-compliant parsers would always
> >provide a localName value of "my:doc". That would bring us back to square
> >one: you can't rely on localName when namespace processing is off.
> 
> And my point is that the localName is "my:doc" and the QName is meaningless
> in this case.

Agreed.

-- Ron

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


RE: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by "Simon St.Laurent" <si...@simonstl.com>.
At 12:42 PM 6/2/2002 -0700, Yuval Oren wrote:
>Regardless of what's more natural, at this point doing anything other than
>sticking with the current specification would be pointless. Take this
>document:
>
><my:doc/>
>
>With namespace processing off, SAX2 compliant parsers can provide a
>localName value of either "" or "doc", while qName must be "my:doc". If this
>were changed in a SAX 2.1 release, 2.1-compliant parsers would always
>provide a localName value of "my:doc". That would bring us back to square
>one: you can't rely on localName when namespace processing is off.

And my point is that the localName is "my:doc" and the QName is meaningless 
in this case.

It's nice to realize how inflexible a parameter-based API can be, I suppose.

Simon St.Laurent
"Every day in every way I'm getting better and better." - Emile Coue


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


Re: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by Karl Waclawek <ka...@waclawek.net>.
David Brownell wrote:

> Karl Waclawek wrote:
> > 
> > I understand it the same way. The confusion in this thread really is:
> > if NS processing is off, then which should really represent the
> > element name - qName or localName? I agree with you that localName is 
> > the more natural candidate.
> 
> Actually that'd be a new confusion.  The original question dealt with
> the namespacing-on-but-no-namespace case, where the SAX spec says both
> URI and localName must be provided (or neither) ... even though some
> implementations are providing a localName with empty URI.

Well, in that case the question is: What does it mean if "no URI is provided".
If you allow URIs to be empty strings, then you will always have an URI,
if you say that an empty URI string means that there is no URI, 
(which seems correct to me) then localName must be empty too, but if
namespace-prefixes is false, qName is optional, and you have no place
"obligated" to report the name.

Even if you would have to use qName then, I find it still
not elegant that you have to switch between localName and qName
depending on whether the element name is in a namespace or not.

How much less confusing the Expat approach is:
You pass:
-URI
-Name
-Prefix
It's always clear what goes where.

> 
> Arnaud's point (that localName is not defined except in the context
> of namespacing) is IMO good.  Conformant code was _never_ allowed to
> rely on localName in such cases.

Well, qName is also not defined outside of namespacing.
What does "qualified" mean when NS processing is off?

I still say that localName sounds less bound to namespaces then qName.
What's the problem if we make localName and qName always available,
and they are the same if there is no namespace.

Karl


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


Re: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by Rob Lugt <ro...@elcel.com>.
Yuval Oren wrote
> > >
> > > With namespace processing off, SAX2 compliant parsers can provide a
> > > localName value of either "" or "doc"
> >
> > This is nonsense.  If namespace processing is off, what specification
are
> > you invoking to come up with a localName of "doc"?
> >
> > ~Rob
>
> By "namespace processing off" I meant that the
> "http://xml.org/sax/features/namespaces" feature was set to false. I was
> thus referring to the Javadoc for ContentHandler.startElement():
>
> *  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);
>
> I read this to mean that if a SAX2 parser so chooses, it can process the
> element for namespaces even though the feature is off. And that's how we
get
> a localName of "doc".

I see.  I have always understood the http://xml.org/sax/features/namespaces
feature to mean "behave as a vanilla XML 1.0 processor without reference to
the Namespaces in XML recommendation".

I think there are good reasons for treating the option in this way, rather
than just using it as a flag to control the parameters to startElement().
For one thing, the Namespaces recommendation introduces "namespace
constraints", (e.g. no ':' in entity name), which I would expect to be
flagged [1] by an XML processor in namespace mode but ignored when in plain
XML 1.0 mode.

~Rob

[1] xmlvalid treats namespace constraint violations as fatal errors when
namespaces are enabled



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


RE: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by Yuval Oren <yu...@bluecast.com>.
> > <my:doc/>
> >
> > With namespace processing off, SAX2 compliant parsers can provide a
> > localName value of either "" or "doc"
>
> This is nonsense.  If namespace processing is off, what specification are
> you invoking to come up with a localName of "doc"?
>
> ~Rob

By "namespace processing off" I meant that the
"http://xml.org/sax/features/namespaces" feature was set to false. I was
thus referring to the Javadoc for ContentHandler.startElement():

*  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);

I read this to mean that if a SAX2 parser so chooses, it can process the
element for namespaces even though the feature is off. And that's how we get
a localName of "doc".



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


Re: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by Rob Lugt <ro...@elcel.com>.
Yuval Oren wrote

> Take this document:
>
> <my:doc/>
>
> With namespace processing off, SAX2 compliant parsers can provide a
> localName value of either "" or "doc"

This is nonsense.  If namespace processing is off, what specification are
you invoking to come up with a localName of "doc"?

~Rob


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


RE: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by Yuval Oren <yu...@bluecast.com>.
> Karl Waclawek wrote:
> >
> > I understand it the same way. The confusion in this thread really is:
> > if NS processing is off, then which should really represent the
> > element name - qName or localName? I agree with you that localName is
> > the more natural candidate.
>
> Actually that'd be a new confusion.  The original question dealt with
> the namespacing-on-but-no-namespace case, where the SAX spec says both
> URI and localName must be provided (or neither) ... even though some
> implementations are providing a localName with empty URI.
>
> Arnaud's point (that localName is not defined except in the context
> of namespacing) is IMO good.  Conformant code was _never_ allowed to
> rely on localName in such cases.
>
> - Dave

Regardless of what's more natural, at this point doing anything other than
sticking with the current specification would be pointless. Take this
document:

<my:doc/>

With namespace processing off, SAX2 compliant parsers can provide a
localName value of either "" or "doc", while qName must be "my:doc". If this
were changed in a SAX 2.1 release, 2.1-compliant parsers would always
provide a localName value of "my:doc". That would bring us back to square
one: you can't rely on localName when namespace processing is off.

Yuval


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


Re: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by David Brownell <da...@pacbell.net>.
Karl Waclawek wrote:
> 
> I understand it the same way. The confusion in this thread really is:
> if NS processing is off, then which should really represent the
> element name - qName or localName? I agree with you that localName is 
> the more natural candidate.

Actually that'd be a new confusion.  The original question dealt with
the namespacing-on-but-no-namespace case, where the SAX spec says both
URI and localName must be provided (or neither) ... even though some
implementations are providing a localName with empty URI.

Arnaud's point (that localName is not defined except in the context
of namespacing) is IMO good.  Conformant code was _never_ allowed to
rely on localName in such cases.

- Dave




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


Re: [Sax-devel] Re: SAX survey: expected local name for non-namespace qualified elements

Posted by Karl Waclawek <ka...@waclawek.net>.
Simon St.Laurent wrote:

> If "namespace processing is off and we've never heard of namespaces", then 
> we've never heard of QNames either.  If you insist on going this route, 
> you'd better change the API to remove the notion of QName when namespace 
> processing is off.  "Local name" might at least mean "the name local to the 
> element" in cases without any understanding of namespaces.

I understand it the same way. The confusion in this thread really is:
if NS processing is off, then which should really represent the
element name - qName or localName? I agree with you that localName is 
the more natural candidate.
 
> >Those are both categories of implementation variance that the current
> >SAX spec allows, though which (thankfully) not many implementors have
> >taken advantage of.  In the interest of application portability, I'd
> >be glad to see them removed in a SAX 2.1 release.
> 
> In the interest of application portability, I'd recommend requiring 
> reporting the name of the element as localName when namespace processing is 
> turned off.

In order to satisfy everybody, I would say, qName = localName when
NS processing is off.

Karl


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