[cxml-devel] Possible bug in cxml-stp

rm at tuxteam.de rm at tuxteam.de
Tue May 22 14:46:58 UTC 2012


On Tue, May 22, 2012 at 03:35:30PM +0200, David Lichteblau wrote:
> Quoting Raymond Wiker (rwiker at gmail.com):
> > I was confused about empty namespace uris vs empty namespace tags - I
> > wanted to create nodes that would be in the same namespace as their parent,
> > but I now see why that would be problematic.
> >
> > Thank you for your patience.
> 
> So STP doesn't have a built-in feature for this, but I suppose a helper
> function could be nice for this purpose.  Maybe something like this:
> 
> CL-USER> (defun make-element-in-context (qname context)
>            (stp:make-element
>             qname
>             (stp:find-namespace (cxml::split-qname qname) context)))
> MAKE-ELEMENT-IN-CONTEXT
> 
> CL-USER> (stp:make-element "test" "http://bar")
> #.(CXML-STP:ELEMENT :LOCAL-NAME "test" :NAMESPACE-URI "http://bar")
> 
> CL-USER> (make-element-in-context "child" *)
> #.(CXML-STP:ELEMENT :LOCAL-NAME "child" :NAMESPACE-URI "http://bar")
> 

Well, since the OP already uses a wrapper function to add elements this
isn't neccessary. And I think the underlying confusion came from the
(wrong) assumption that an empty namespace (i.e. ns-uri = "") would mean
"same ns as parent". That's a rather common misconception stemming from
the difference between the xml data model and it's  serialisaton.
Namespace prefixes belong to the later.
BTW: why are you using split-qname in your wrapper? Would you expect to
feed "foo:bar" to make-element-in-context? 

Cheers, RalfD


> d.




More information about the cxml-devel mailing list