[jdom-interest] Namespace issues, et al.
Malachi de AElfweald
malachi at tremerechantry.com
Sun Feb 23 10:43:36 PST 2003
I am having some problems with my email client, and these emails getting
sent from the wrong email account, so I apologize if you got multiple
copies
of this email.
On Sun, 23 Feb 2003 07:59:21 -0500, Elliotte Rusty Harold
<elharo at metalab.unc.edu> wrote:
> At 1:35 AM -0800 2/22/03, Malachi de AElfweald wrote:
>
>
>> Ok, I have just started using Schemas and Namespaces.... As such, I am
>> running into some problems. Looking at the list, it appears that
>> Namespace problems are very common with JDOM, so I thought someone
>> (Elliotte?) might be able to shed some light on these issues.
>
> No, namespace problems are very common with XML. One a developer
> straightens out their problems with namespaces in XML, they typically
> have no problems with namespaces in JDOM.
My comment was due to all the comments, questions, and complaints on the
list regarding the issue.
>> Section 6.2 (please read that section before insisting that I am
>> misreading it) states that namespaces get retained within scope.
>> Specifically, it explains (and SHOWS) that child elements keep the same
>> namespace of the parent element unless otherwise specified. Also, it
>> states that attributes use the same namespace as the enclosing element,
>> unless stated otherwise.
>
> No, no, no. Both claims are wrong, though the attribute claim is more
> wrong than the element claim. I don't know what you're looking at, but
> there is no section 6.2. Section 5.2 states, and I quote, "the default
> namespace does not apply to attribute names"
Um, perhaps you didn't read the link. I just reclicked on it, and I quote:
"6.2 Namespace Defaulting"
"The scope of a default namespace declaration extends from the beginning of
the start-tag in which it appears to the end of the corresponding end-tag,
excluding the scope of any inner default namespace declarations. In the
case of an empty tag, the scope is the tag itself. A default namespace
declaration applies to to all unprefixed element names within its scope.
Default namespace declarations do not apply directly to attribute names;
the interpretation of unprefixed attributes is determined by the element on
which they appear. If there is a default namespace declaration in scope,
the expanded name corresponding to an unprefixed element name has the IRI
of the default namespace as its namespace name. If there is no default
namespace declaration in scope, the namespace name is null. The namespace
name for an unprefixed attribute name is always null. In all cases, the
local name is local part (which is of course the same as the unprefixed
name itself). "
"The default namespace can be set to the empty string. This has the same
effect, within the scope of the declaration, of there being no default
namespace. "
And their two examples:
"
<?xml version="1.1"?>
<!-- elements are in the HTML namespace, in this case by default -->
<html xmlns='http://www.w3.org/1999/xhtml'>
<head><title>Frobnostication</title></head>
<body><p>Moved to <a href='http://frob.com'>here</a>.</p></body>
</html>
<?xml version="1.1"?>
<!-- unprefixed element types are from "books" -->
<book xmlns='urn:loc.gov:books'
xmlns:isbn='urn:ISBN:0-395-36341-6'>
<title>Cheaper by the Dozen</title>
<isbn:number>1568491379</isbn:number>
</book>
"
Oh, and at the bottom:
"This version incorporates the errata to version 1.0 as of 6 December 2002
[1.0 Errata]. There are two further substantive changes: A mechanism is
provided for undeclaring prefixes;"
As I said, please actually read the document before insisting I am wrong.
I have been seeing you
claim that people are making this mistake all the time, but your comments
do NOT match the spec.
>> Now, before we go further, those two items seem to be the root cause of
>> most of the namespace problems I read on the list and experienced
>> myself. If you glanced over the last paragraph, reread it.
>>
>>> From that, I understand the following:
>> <tagA xmlns="http://www.eoti.org">
>> <tagB attrC="hello"/>
>> </tagA>
>>
>> In that section of XML, according to section 6.2 of that spec, it states
>> that tagA, tagB, and attrC are all in the http://www.eoti.org default
>> namespace.
>
> tagA and tagB are. attrC isn't.
According to my quotes above, which your version of the W3 document doesn't
seem to contain, it does.
Example, the "href" tag in the example is in the same namespace as the "a"
element which is in the "html"
element's namespace.
>> Am I misreading the spec? I did notice that XMLOutputter is
>> automatically defaulting
>> to version="1.0" on the XMLDecl. Perhaps I am trying to use XML 1.1 and
>> JDOM is only XML 1.0?
>
> JDOM is only XML 1.0. There is as yet no XML 1.1. Maybe one day there
> will be, but that day is not today.
That would appear to be the problem then. Myself, and many others on this
list,
keep trying to use XML 1.1 standards (like the Namespace stuff quoted
above).
Via the page above "This specification applies to XML 1.1 documents.
To conform to this specification, a document must be well-formed
according to the XML 1.1 specification. " So, it appears that the reason
everyone
is complaining that Namespaces are broke, and you keep telling them they
are
completely wrong and don't understand anything -- is simply because
everyone
is writing XML 1.1 documents, and JDOM is only XML 1.0
>> I would prefer some constructive comments on this issue, because for all
>> of my encouragement for the use of JDOM in the workplace, without
>> meeting the specification I will not be able to convince the employeer
>> to use it. Currently, they are using Apache's stuff on the C-side, and
>> are more likely to enforce I use Apache's API directly instead of JDOM
>> if JDOM can't deliver.
>
> Your confusion derives from a deep misunderstanding of namespaces in XML.
> Yes, namespaces are poorly designed and confusing. No, we didn't invent
> them. Once you understand namespaces in XML, then maybe you'll understand
> how and why JDOM works the way it does; but as long as you persist in
> believing things about namespaces that simply aren't true, you're going
> to be confused.
You keep stating that everyone is wrong -- and not once has someone taken
the
time to figure out why you always contradict everyone. I think it is very
simple.
It is not that I (and everyone else) has the specification wrong -- it is
that
we are trying to use the current specification, and you (and JDOM) are
still on the
old one. The problem really seems to be based around the fact that
everyone is trying
to code to XML 1.1 (which W3 shows as current), and JDOM only supports 1.0
(which I just
now found out). Since XML 1.0 doesn't support full Unicode, and we write
software for
banks, it looks like I will not be able to use JDOM in the workplace after
all.
Malachi --
More information about the jdom-interest
mailing list