- The domains of prefixes can be traced with the methods
- startPrefixMapping(String prefix, String uri)
- endPrefixMapping(String prefix)
of the ContentHandler interface.
- The local names can be inspected by the methods
- startElement(String namespaceURI, String localName,
String qName, Attributes atts)
- endElement(String namespaceURI, String localName, String
qName)
of the the ContentHandler interface.
- The local names of the attributes can be extracted by the method
of the Attributes interface.
- The QName attributes provide the fully quantified names.
public void startElement(String namespace, String localName,
String QName, Attributes atts) {
System.out.println( "\nQName='" + QName +
"' localName='" + localName +
"' uri='" + namespace + '\'');
for( int i=0; i<atts.getLength(); i++){
System.out.println( "QName='" + atts.getQName(i)
+ "' localName='" + atts.getLocalName(i)
+ "' uri='" + atts.getURI(i) + '\'' );
} }
-_-_-
<?xml version="1.0" encoding="UTF-8"?>
<or:oranges xmlns:or="fruit://osu/or"
xmlns:ap="fruit://osu/ap"
xmlns ="fruit://osu/ot"
at="1">
<ap:apples at="2" >...</ap:apples>
<other or:at="3" >...</other>
</or:oranges>
QName='or:oranges' localName='oranges' uri='fruit://osu/or'
QName='at' localName='at' uri=''
QName='ap:apples' localName='apples' uri='fruit://osu/ap'
QName='at' localName='at' uri=''
QName='other' localName='other' uri='fruit://osu/ot'
QName='or:at' localName='at' uri='fruit://osu/or'