The Artima Developer Community
Sponsored Link

Weblogs Forum
XML Processors can't Ignore Namespaces

2 replies on 1 page. Most recent reply: Jun 20, 2006 5:15 PM by Bruce Eckel

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Andy Dent

Posts: 165
Nickname: andydent
Registered: Nov, 2005

XML Processors can't Ignore Namespaces (View in Weblogs)
Posted: Jun 14, 2006 10:09 PM
Reply to this message Reply
Summary
Namespace processing seems to be the 'will do later' entry on every XML toolkit author's list. Following from discussion in the recent thread "Simplifying XML Manipulation" I wanted to emphasise that namespaces are the key to reuse in schemas and hence any chance of rich data interchange. Don't ignore them!
Advertisement

Here's the first element showing how many (standardised) namespaces are being used in a typical example of the kind of XML we process.

This is used to represent complex data like assay results of samples taken from boreholes, complete with spatial coordinates and attribution to various parties in the processing chain.

<Report 
 xmlns="http://xml.arrc.csiro.au/adx" 
 xmlns:al="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" 
 xmlns:cil="urn:oasis:names:tc:ciq:xsdschema:xCIL:2.0" 
 xmlns:gml="http://www.opengis.net/gml" 
 xmlns:nal="urn:oasis:names:tc:ciq:xsdschema:xNAL:2.0" 
 xmlns:nl="urn:oasis:names:tc:ciq:xsdschema:xNL:2.0" 
 xmlns:xmml="http://www.opengis.net/xmml" 
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://xml.arrc.csiro.au/adx
 ..\..\XMML\adx.xsd" id="XX-R923364-12" version="2.0.1">

There is a huge amount of work being done to establish relatively small, reusable XML schemas. The common pattern is:

  1. Identify community needs for shared data
  2. Create instance documents and schemas.
  3. Refactoring - identify portions which are reusable in other domains and pull them out into their own namespaces.

A good example is the Observations and Measurements schema, directly downloadable from http://www.seegrid.csiro.au/xsd/om/ and described in detail at https://www.seegrid.csiro.au/twiki/bin/view/Xmml/ObservationsAndMeasurements


James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: XML Processors can't Ignore Namespaces Posted: Jun 15, 2006 10:29 AM
Reply to this message Reply
I don't disagree that XML processing must be namespace aware, but my experience is that I have never had to deal with a document that had element name collisions i.e. I needed to se the namespace to differentiate between two types.

I think a parsing tool should allow users to forego specifying namespaces to retrieve an element.

Bruce Eckel

Posts: 868
Nickname: beckel
Registered: Jun, 2003

Re: XML Processors can't Ignore Namespaces Posted: Jun 20, 2006 5:15 PM
Reply to this message Reply
After someone pointed out that the Python minidom doesn't support namespaces, I started noticing that xmlnode is really a kind of facade that utilizes an underlying XML implementation, and has a relatively clean interface to the underlying library. Thus, when elementree becomes available in Python 2.5, I can if I need to retarget to that and utilize the namespace mechanism in that library.

The key phrase being "if I need to," because in my own experience (automatically generating Ant build files and creating and reading XML to interact with services on the web), I haven't had to, so I've kept xmlnode down to "the simplest thing that could possibly work." If I run into a case where I need namespaces, I'll either evolve xmlnode or just use elementree for that problem, depending on which one involves the least pain.

Flat View: This topic has 2 replies on 1 page
Topic: XML Processors can't Ignore Namespaces Previous Topic   Next Topic Topic: Heron and Cat: Next Steps


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us