[Home] [By Thread] [By Date] [Recent Entries]
David Carlisle wrote:
> According to your definition of "unused" almost every XSLT stylesheet,
> and a large proportion of XSD schema and RelaxNG schema use unused
> namespaces. Are they all evil?
You are correct David. My definition of both "used" and "unused" namespace needs updating.
Here goes.
[Definition] Used Namespace: a namespace in an XML instance document which is
(1) used in an element name, or
(2) used in an attribute name, or
(3) used in a QName of an attribute value, or
(4) used in a QName of an element value.
Example: This XML document illustrates the 4 locations where namespaces may be used:
<Root xmlns:NS1="http://www.namespaces.org/1"
xmlns:NS2="http://www.namespaces.org/2"
xmlns:NS3="http://www.namespaces.org/3"
xmlns:NS4="http://www.namespaces.org/4">
<NS1:child NS2:attr="NS3:att-value">
NS4:elem-value
</NS1:child>
</Root>
[Definition] Unused Namespace: a namespace in an XML instance document which is
(1) not used in an element name, and
(2) not used in an attribute name, and
(3) not used in a QName of an attribute value, and
(4) not used in a QName of an element value.
Example: In the following XML document this namespace is not used: http://www.namespaces.org/5
<Root xmlns:NS1="http://www.namespaces.org/1"
xmlns:NS2="http://www.namespaces.org/2"
xmlns:NS3="http://www.namespaces.org/3"
xmlns:NS4="http://www.namespaces.org/4"
xmlns:NS5="http://www.namespaces.org/5">
<NS1:child NS2:attr="NS3:att-value>
NS4:elem-value
</NS1:child>
</Root>
Do you agree?
Have I identified all the locations where namespaces may be used?
/Roger
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |

Cart



