Package org.apache.struts2.util.location
Class LocationAttributes.Pipe
java.lang.Object
org.apache.struts2.util.location.LocationAttributes.Pipe
- All Implemented Interfaces:
ContentHandler
- Enclosing class:
- LocationAttributes
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://opensymphony.com/xwork/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.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPipe()Create a filter.Pipe(ContentHandler next) Create a filter that is chained to another handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] arg0, int arg1, int arg2) voidvoidendElement(String arg0, String arg1, String arg2) voidendPrefixMapping(String arg0) voidignorableWhitespace(char[] arg0, int arg1, int arg2) voidprocessingInstruction(String arg0, String arg1) voidsetDocumentLocator(Locator locator) voidskippedEntity(String arg0) voidvoidstartElement(String uri, String loc, String raw, Attributes attrs) voidstartPrefixMapping(String arg0, String arg1) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
Pipe
public Pipe()Create a filter. It has to be chained to another handler to be really useful. -
Pipe
Create a filter that is chained to another handler.- Parameters:
next- the next handler in the chain.
-
-
Method Details
-
setDocumentLocator
- Specified by:
setDocumentLocatorin interfaceContentHandler
-
startDocument
- Specified by:
startDocumentin interfaceContentHandler- Throws:
SAXException
-
endDocument
- Specified by:
endDocumentin interfaceContentHandler- Throws:
SAXException
-
startElement
- Specified by:
startElementin interfaceContentHandler- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Throws:
SAXException
-
startPrefixMapping
- Specified by:
startPrefixMappingin interfaceContentHandler- Throws:
SAXException
-
endPrefixMapping
- Specified by:
endPrefixMappingin interfaceContentHandler- Throws:
SAXException
-
characters
- Specified by:
charactersin interfaceContentHandler- Throws:
SAXException
-
ignorableWhitespace
- Specified by:
ignorableWhitespacein interfaceContentHandler- Throws:
SAXException
-
processingInstruction
- Specified by:
processingInstructionin interfaceContentHandler- Throws:
SAXException
-
skippedEntity
- Specified by:
skippedEntityin interfaceContentHandler- Throws:
SAXException
-