[XML-SIG] Namespace support for DOM

Gabe Wachob gwachob@aimnet.com
Sun, 27 Dec 1998 19:11:51 -0800 (PST)


On Sun, 27 Dec 1998, A.M. Kuchling wrote:

> After reading over the current namespace working draft, I thought a
> little bit about how PyDOM should support it.  I'd like to hear
> opinions on this...
> 
>        Thought 1: the idea of walking over the whole tree and
> annotating it is bad, because if you modify the tree, the annotations
> become outdated and you have to recompute them.  

What about annotation where when you modify a node, you simply recompute
the namespace annotations for all the nodes in the subtree of that changed
node.

I *think* you can do this efficiently (in other words, the newly changed
node can be scanned to see if it could possibly have an effect on its
children's namespaces). If it doesn't not contain any namespace-related
declarations, for example, there shouldn't be any need to update subtree
namespace annotations...

>        Thought 2: similar reasoning applies to modifying element or
> attribute names by removing the namespace prefix.

I think similar reasoning would also apply to my previous comment (though
not sure).

>        Thought 3: therefore, the better course of action is to have
> functions or methods that dynamically compute what namespaces apply by
> looking at a node's ancestors.

I'm not sure if you are suggesting what I mention in the my first
response, or whether (as I think) you are suggesting a "get_namespace" (I
assume thats what get_namespace_mapping() is below). 

Is there a concise statement of the algorithm for determining the
namespace of an element or attribute somewhere? I have not been able to
find one.. 

> Proposed interfaces need to be tried out by actually implementing
> something on top of them, in order to find areas that have been
> missed.  Can anyone suggest some namespace-using application that
> would be useful as a test case?  It would also provide another demo
> application.  The transformation portion of XSL is one candidate, but
> I haven't read enough of the XSL draft to get an idea of how big the
> job would be.  Anyone know of something small?

Well, to be a nontrivial test, wouldn't we want some app built on
documents using multiple namespaces?? I mean, if everything is
xsl:<something>, whats the point -- you'll always get either xml or
"another" namespace (whatever your output namespaces is I guess). 

How about something simple with RDF? How about a RDF equality tool? Takes
two RDF XML documents and determines if the two are semantically
equivalent forms? 

<?xml version="1.0"?>
  <RDF
    xmlns="http://www.w3.org/TR/WD-rdf-syntax#"
    xmlns:s="http://description.org/schema/">
    <Description about="http://www.w3.org/Home/Lassila">
      <s:Creator>Ora Lassila</s:Creator>
    </Description>
  </RDF>

 <?xml version="1.0"?>
  <RDF xmlns="http://www.w3.org/TR/WD-rdf-syntax#">
    <Description about="http://www.w3.org/Home/Lassila">
      <s:Creator xmlns:s="http://description.org/schema/">Ora
Lassila</s:Creator>
    </Description>
  </RDF>


  <?xml version="1.0"?>
  <RDF xmlns="http://www.w3.org/TR/WD-rdf-syntax#">
    <Description about="http://www.w3.org/Home/Lassila">
      <Creator xmlns="http://description.org/schema/">Ora
Lassila</Creator>
    </Description>
  </RDF>

All three of these are "semantically equivalent" (or are they -- I notice
a lack of namespace declarations in the latter two examples?), but not
syntactically equivalent. This would be a more interesting tool if more
than two namespaces (RDF and then multiple schemas) were involved. I don't
know complicated this would be (I'm not extremely familiar with RDF). I,
as I gather, RDF documents can be treated as directed graphs, it would
seem to me that equivalence shouldn't be too hard a task to take on...

	-Gabe

-------------------------------------------------------------------
http://www.aimnet.com/~gwachob               http://www.findlaw.com
"A popular Government, without popular information, or the means of 
acquiring it, is but a Prologue to a Farce or a Tragedy; or perhaps 
both." -- James Madison 
                       import std.disclaimer