Working with XML namespaces
Furnace framework ยป XML parser

Prev:Event-based XML parsing


The Factor XML parser implements XML namespaces, and provides convenient utilities for working with them. Anywhere in the public API that a name is accepted as an argument, either a string or an XML name is accepted. If a string is used, it is coerced into a name by giving it a null namespace. Names are stored as name tuples, which have slots for the namespace prefix and namespace URL as well as the main part of the tag name.

To make it easier to create XML names, the parsing word XML-NS: is provided in the xml.syntax vocabulary.

When parsing XML, names are automatically augmented with the appropriate namespace URL when the information is available. This does not take into account any XML schema which might allow for such prefixes to be omitted. When generating XML to be written, keep in mind that the XML writer knows only about the literal prefixes and ignores the URLs. It is your job to make sure that they match up correctly, and that there is the appropriate xmlns declaration.