[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] ANN: SAX Filters for Namespace Processing
Last week at XTech (part of the O'Reilly Open Source Conference), Aaron Skonnard gave an excellent presentation on Namespaces. He brought up a couple of issues which continue to bother me, but which have pretty much no single (imposable) solution. The first problem was the case of unqualified elements inside of namespace-qualified elements: <p:person xmlns:p="http://simonstl.com/person"> <givenName>Chip</givenName> <familyName>Skillet</familyName> </p:person> I'd really prefer to see things like this written as: <p:person xmlns:p="http://simonstl.com/person"> <p:givenName>Chip</p:givenName> <p:familyName>Skillet</p:familyName> </p:person> So, I wondered, why not write a filter that would convert from the first form to the second form? The other case involves unqualified attributes. It's clear that the default namespace does not apply to attributes, but unqualified attributes remain somewhat anomalous themselves, not part of the element containing them but not necessarily a participant in the namespace. Things like: <p:person givenName="Chip" familyName="Skillet" /> While I'm not as troubled by this as by the element issue, there are times (notably in RDF) where it's clearer to say: <p:person p:givenName="Chip" p:familyName="Skillet" /> So again, why not write a filter? (Thanks to Leigh Dodds for a push on this.) The two problems are very similar, and the code for the two filters is only slightly different. They share a simple pair of classes for storing rules, and the code for the two is only slightly different. More details, and version 0.01 of the filters, is available at: http://simonstl.com/projects/namespace/docs This is a version 0.01, but the code is simple enough that the odds are good it's a solid foundation. (Yes, I need to work on more unit testing.) Version 0.02 will include RDDL documents at all the namespaces used. Also, I'm developing these filters and the Regular Fragmentations filters as rule-based tools running from XML vocabularies. I'm hoping to modify the rule-loaders to be SAX filters, which would permit the combination of multiple rule sets into single documents read at a single parse. Simon St.Laurent Associate Editor O'Reilly & Associates
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|