HaXml, namespace processing

Graham Klyne gk at ninebynine.org
Tue Jun 22 12:39:57 EDT 2004


Since my last HaXml missive [1], I've managed to get some XML namespace 
handling code working with HaXml.

The namespace processing itself is implemented as a transformation/filter 
that is applied to XML content after general entity substitution has been 
performed.  The XML content model has been extended to use QNames for 
element and attribute names (this change was made some time ago), and also 
to carry XML-Infoset-like information with each element (including a list 
of in-scope namespaces).

When namespace processing is performed, the xmlns attributes are scanned 
and removed from the XML content.  Element and attribute names containing 
':' are reprocessed to be in a namespace+local name form.  Also, is a 
default namnespace is in scope, element names not containing a ':' are 
similarly processed (but not attribute names, because the meaning of 
unprefixed attributes is determined by the containing XML element).

I've created a small suite of test cases for namespace processing, which 
work by extracting the list of element and attribute QNames from a 
processed document, and comparing the result with a given list.

Also since my last message [1], I've created a test suite for the XML 
validator, based on the W3C XML conformance data.  HaXml passed all but two 
of these tests without further modification.

I've created another snapshot [2] of my work.

This represents all of the major functional changes I plan to make at this 
time, though there is a good deal of code tidying, and a few small features 
I'd like to add, which I may get round to at some time.  My changes are 
also rather devoid of external documentation.  The test harness [3] is one 
place to look.  The namespace handling functions are in module Namespace.hs 
[4].

#g
--

[1] http://www.haskell.org//pipermail/libraries/2004-June/002266.html

[2] http://www.ninebynine.org/Software/HaskellUtils/20040622-Haxml-1.12.zip

[3] http://www.ninebynine.org/Software/HaskellUtils/HaXml-1.12/test/TestXml.hs

[4] 
http://www.ninebynine.org/Software/HaskellUtils/HaXml-1.12/src/Text/XML/HaXml/Namespace.hs


------------
Graham Klyne
For email:
http://www.ninebynine.org/#Contact



More information about the Libraries mailing list