org.apache.cocoon.util.location
Class LocationAttributes.Pipe
java.lang.Object
org.apache.cocoon.util.location.LocationAttributes.Pipe
- All Implemented Interfaces:
- ContentHandler
- Enclosing class:
- LocationAttributes
public static class LocationAttributes.Pipe
- extends Object
- implements ContentHandler
A SAX filter that adds the information available from the Locator
as attributes.
The purpose of having location as attributes is to allow this information to survive transformations
of the document (an XSL could copy these attributes over) or conversion of SAX events to a DOM.
The location is added as 3 attributes in a specific namespace to each element.
<root xmlns:loc="http://apache.org/cocoon/location"
loc:src="file://path/to/file.xml"
loc:line="1" loc:column="1">
<foo loc:src="file://path/to/file.xml" loc:line="2" loc:column="3"/>
</root>
Note: Although this adds a lot of information to the serialized form of the document,
the overhead in SAX events is not that big, as attribute names are interned, and all src
attributes point to the same string.
- Since:
- 2.1.8
- See Also:
LocationAttributes
Method Summary |
void |
characters(char[] arg0,
int arg1,
int arg2)
|
void |
endDocument()
|
void |
endElement(String arg0,
String arg1,
String arg2)
|
void |
endPrefixMapping(String arg0)
|
void |
ignorableWhitespace(char[] arg0,
int arg1,
int arg2)
|
void |
processingInstruction(String arg0,
String arg1)
|
void |
setDocumentLocator(Locator locator)
|
void |
skippedEntity(String arg0)
|
void |
startDocument()
|
void |
startElement(String uri,
String loc,
String raw,
Attributes attrs)
|
void |
startPrefixMapping(String arg0,
String arg1)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LocationAttributes.Pipe
public LocationAttributes.Pipe()
- Create a filter. It has to be chained to another handler to be really useful.
LocationAttributes.Pipe
public LocationAttributes.Pipe(ContentHandler next)
- Create a filter that is chained to another handler.
- Parameters:
next
- the next handler in the chain.
setDocumentLocator
public void setDocumentLocator(Locator locator)
- Specified by:
setDocumentLocator
in interface ContentHandler
startDocument
public void startDocument()
throws SAXException
- Specified by:
startDocument
in interface ContentHandler
- Throws:
SAXException
endDocument
public void endDocument()
throws SAXException
- Specified by:
endDocument
in interface ContentHandler
- Throws:
SAXException
startElement
public void startElement(String uri,
String loc,
String raw,
Attributes attrs)
throws SAXException
- Specified by:
startElement
in interface ContentHandler
- Throws:
SAXException
endElement
public void endElement(String arg0,
String arg1,
String arg2)
throws SAXException
- Specified by:
endElement
in interface ContentHandler
- Throws:
SAXException
startPrefixMapping
public void startPrefixMapping(String arg0,
String arg1)
throws SAXException
- Specified by:
startPrefixMapping
in interface ContentHandler
- Throws:
SAXException
endPrefixMapping
public void endPrefixMapping(String arg0)
throws SAXException
- Specified by:
endPrefixMapping
in interface ContentHandler
- Throws:
SAXException
characters
public void characters(char[] arg0,
int arg1,
int arg2)
throws SAXException
- Specified by:
characters
in interface ContentHandler
- Throws:
SAXException
ignorableWhitespace
public void ignorableWhitespace(char[] arg0,
int arg1,
int arg2)
throws SAXException
- Specified by:
ignorableWhitespace
in interface ContentHandler
- Throws:
SAXException
processingInstruction
public void processingInstruction(String arg0,
String arg1)
throws SAXException
- Specified by:
processingInstruction
in interface ContentHandler
- Throws:
SAXException
skippedEntity
public void skippedEntity(String arg0)
throws SAXException
- Specified by:
skippedEntity
in interface ContentHandler
- Throws:
SAXException
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.