Class LocationAttributes.Pipe

java.lang.Object
org.apache.struts2.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://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: