xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: "Michael Kay" <mike AT saxonica.com>
- To: "'Elliotte Harold'" <elharo AT metalab.unc.edu>
- Cc: 'xom-interest' <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] Scope of namespaces
- Date: Mon, 6 Feb 2006 11:45:57 -0000
> If XOM were religious about implementing the model I think it would
> become unusable. For instance consider this:
>
> Element root = new Element("foo:name", "http://www.example.org/");
> root.addNamespaceDeclaration("bar", "http://www.example.com/");
> Element child = new Element("child");
> root.appendChild(child);
>
> If were to follow the XPath model directly then what we'd
> have would be:
>
> <foo:name xmlns:foo="http://www.example.org/"
> xmlns:bar="http://www.example.com/">
> <child xmlns:foo="" xmlns:bar=""/>
> </root>
>
If you look at XSLT 2.0 and XQuery 1.0, when you copy an element (which you
need to do if you want to attach it to a new parent) then there are two
options: copy-namespaces and inherit-namespaces. The first option indicates
whether all the existing in-scope namespaces of the element are copied (if
not, only the namespaces actually used in element and attribute names are
copied). The second option indicates whether the element inherits the
in-scope namespaces of the new parent. The default in XSLT 2.0 (and the only
option in 1.0) is copy="yes", inherit="yes". This default avoids the need
for the namespace undeclarations in your example (which are in any case
permitted only in XML 1.1).
Michael Kay
-
Re: [XOM-interest] uuid generation (was Re: Scope of namespaces)
, (continued)
- Re: [XOM-interest] uuid generation (was Re: Scope of namespaces), Tatu Saloranta, 02/07/2006
- Re: [XOM-interest] uuid generation (was Re: Scope of namespaces), Wolfgang Hoschek, 02/07/2006
- Re: [XOM-interest] uuid generation (was Re: Scope of namespaces), Wolfgang Hoschek, 02/07/2006
- Re: [XOM-interest] Scope of namespaces, Wolfgang Hoschek, 02/06/2006
- Re: [XOM-interest] Scope of namespaces, Elliotte Harold, 02/07/2006
- Re: [XOM-interest] Scope of namespaces, Michael Kay, 02/06/2006
Archive powered by MHonArc 2.6.24.