How do XML NameSpace aware processors react to NS definations?

Ronald Bourret rbourret at ito.tu-darmstadt.de
Tue Nov 17 10:32:43 GMT 1998


Amit Rekhi wrote:

> >So for now, namespace-aware processors should do nothing more than
> >acknowledge the existence of the unique namespace.
> 
> This would mean that the NS processor would simply check for ":" in the
> element name, and on finding it, it would try finding the
> namespace declaration (of the kind xmlns="....") which matches prefix
> found. That's it.
> Am I right?

The NS processor (parser) would then return the namespace URL and element name to the application.  As yet, there is no standard way to do this, but one suggestion for SAX-based applications is to use a parser filter to concatenate the namespace URL and the element name, separated by a caret (^).  (See http://www.ccil.org/~cowan/XML/ )

> And the application on behalf of whom the XML NS processor is operating
> can take care of validating the namespaces if that's what it intends to do.
> Am I right?

If by "validating the namespaces" you mean checking that the prefix used in the element or attribute name has been declared, it seems more appropriate that if the parser claims to be namespace-aware, it would perform this task.  Similarly, if the parser was a validating parser, it would also do any validation.

In general, though, the application's responsibility to know what to do with the element.  This is no different from the non-namespace case: if I define an element <foo>, your parser will have no idea what to do with it -- that is my application's job.  The only difference when namespaces are introduced is that elements and attributes now have two-part names instead of one-part names.

-- Ron Bourret

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list