xerces-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gareth Reakes <gar...@parthenoncomputing.com>
Subject Re: Writing documents with schemas and namespaces...
Date Thu, 22 Apr 2004 15:23:25 GMT
Hi,

> How does it possibly know what prefix to use?

There is an algorithm in the DOM specs it uses. It looks to see if there
is an appropriate one else makes one up (simplification). Take a look if
you want more info.


> Besides, the
> documentation seems to indicate that a prefix should be supplied as
> part of the qualifiedName (since, technically, that would include the
> namespace, that seems logical to me).  The documentation says: The
> 'NAMESPACE_ERR' exception is thrown "...if the qualifiedName has a
> prefix and the namespaceURI is null", which seems to indicate that
> prefixes are expected in the qualifiedName field.

The important part is "if the qualifiedName has a prefix and the
namespaceURI is null". In the XML world you cannot bind a prefix to the
null namespace so you cannot give a prefix to an element/attr if it has no
namespace. You can give a namespace to an ele/attr and not give it a
prefix. Try out a few examples and serialize them if this is not clear.
The main thing to understand is that the namespace attributes have no
effect on the actual namespace of ele/attr after parse. The only time you
have to worry about them is when you serialize. If you do not "namespace
normalize" at this stage then you may well end up with an XML document
that does not represent what you had in memory.

Gareth


-- 
Gareth Reakes, Managing Director      Parthenon Computing
+44-1865-811184                  http://www.parthcomp.com

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


Mime
View raw message