Attribute indicating context namespaces in unqualified elements

This Version: August 6, 2001

Latest Version: http://simonstl.com/ns/namespaces/elements/lastContext/

Previous Version: None

Editors:

Table of contents

  1. Introduction
  2. Attribute
  3. Resources
  4. Normative References
  5. Informative References

1. Introduction

This vocabulary contains a single attribute, an:lastNSContext, generated by a filter, com.simonstl.namespace.elements.ElementAnnotNamespaceFilter, which annotates unqualified descendant elements of qualified elements with information about their ancestor's namespace. It is a less intrusive approach than the forced-qualification approach. It is also more easily reversed or ignored if necessary.

2. Attribute

Given a document:

<p:person xmlns:p="http://simonstl.com/person">
<givenName>Chip</givenName>
<familyName>Skillet</familyName>
<address>
<z:street xmlns:z="http://simonstl.com/address">1259 Zingzang Road</z:street>
<city>Ithaca</city>
</address>
</p:person>

and a rules file which specifies annotation for only the http://simonstl.com/person namespace:

<namespaces xmlns="http://simonstl.com/ns/namespaces/elements/annotate/">
<include nsURI="http://simonstl.com/person" />
</namespaces>

the com.simonstl.namespace.elements.ElementAnnotNamespaceFilter will produce:

C:\opensrc\namespace>java com.simonstl.namespace.elements.ElementAnnotFilterTester annotEl1.xml test2.xml
<?xml version="1.0" standalone="yes"?>
<p:person xmlns:p="http://simonstl.com/person">
<givenName an:lastNSContext="http://simonstl.com/person" xmlns:an="http://simonstl.com/ns/namespaces/elements/lastContext/">Chip</givenName>
<familyName an:lastNSContext="http://simonstl.com/person" xmlns:an="http://simonstl.com/ns/namespaces/elements/lastContext/">Skillet</familyName>
<address an:lastNSContext="http://simonstl.com/person" xmlns:an="http://simonstl.com/ns/namespaces/elements/lastContext/">
<z:street xmlns:z="http://simonstl.com/address">1259 Zingzang Road</z:street>
<city an:lastNSContext="http://simonstl.com/person">Ithaca</city>
</address>
</p:person>

The an:lastNSContextattribute identifies the namespace of the first qualified ancestor element.

3. Related Resources

3.1 SAX Filter

A SAX Filter implementing these rules. JavaDoc describing its class structure and usage is available here.

This code is as an example and is not normative.

3.2 JAR

The above code packaged as a java archive.

4. Normative References

  1. Extensible Markup Language (XML) 1.0
  2. W3C XML Names
  3. W3C XML Schema Part 1 - Structures

5. Informative References