Package org.apache.struts2.util.location
Class LocationAttributes
java.lang.Object
org.apache.struts2.util.location.LocationAttributes
 A class to handle location information stored in attributes.
 These attributes are typically setup using LocationAttributes.Pipe
 which augments the SAX stream with additional attributes, e.g.:
 
 <root xmlns:loc="http://struts.apache.org/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>
 - Since:
- 2.1.8
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classA SAX filter that adds the information available from theLocatoras attributes.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringAttribute name for the column numberstatic final StringAttribute name for the line numberstatic final StringPrefix for the location namespacestatic final StringAttribute qualified name for the column numberstatic final StringAttribute qualified name for the line numberstatic final StringAttribute qualified name for the location URIstatic final StringAttribute name for the location URIstatic final StringNamespace URI for location attributes
- 
Method SummaryModifier and TypeMethodDescriptionstatic AttributesaddLocationAttributes(Locator locator, Attributes attrs) Add location attributes to a set of SAX attributes.static intReturns the column number of an element (DOM flavor)static intgetColumn(Attributes attrs) Returns the column number of an element (SAX flavor)static intReturns the line number of an element (DOM flavor)static intgetLine(Attributes attrs) Returns the line number of an element (SAX flavor)static LocationgetLocation(Element elem) Same asgetLocation(elem, null).static LocationgetLocation(Element elem, String description) Returns theLocationof an element (DOM flavor).static LocationgetLocation(Attributes attrs, String description) Returns theLocationof an element (SAX flavor).static StringgetLocationString(Element elem) Returns the location of an element that has been processed by this pipe (DOM flavor).static StringgetLocationString(Attributes attrs) Returns the location of an element (SAX flavor).static StringReturns the URI of an element (DOM flavor)static StringgetURI(Attributes attrs) Returns the URI of an element (SAX flavor)static voidRemove the location attributes from a DOM element.
- 
Field Details- 
PREFIXPrefix for the location namespace- See Also:
 
- 
URINamespace URI for location attributes- See Also:
 
- 
SRC_ATTRAttribute name for the location URI- See Also:
 
- 
LINE_ATTRAttribute name for the line number- See Also:
 
- 
COL_ATTRAttribute name for the column number- See Also:
 
- 
Q_SRC_ATTRAttribute qualified name for the location URI- See Also:
 
- 
Q_LINE_ATTRAttribute qualified name for the line number- See Also:
 
- 
Q_COL_ATTRAttribute qualified name for the column number- See Also:
 
 
- 
- 
Method Details- 
addLocationAttributesAdd location attributes to a set of SAX attributes.- Parameters:
- locator- the- Locator(can be null)
- attrs- the- Attributeswhere locator information should be added
- Returns:
- Location enabled Attributes.
 
- 
getLocationReturns theLocationof an element (SAX flavor).- Parameters:
- attrs- the element's attributes that hold the location information
- description- a description for the location (can be null)
- Returns:
- a Locationobject
 
- 
getLocationStringReturns the location of an element (SAX flavor). If the location is to be kept into an object built from this element, consider usinggetLocation(Attributes, String)and theLocatableinterface.- Parameters:
- attrs- the element's attributes that hold the location information
- Returns:
- a location string as defined by Location.
 
- 
getURIReturns the URI of an element (SAX flavor)- Parameters:
- attrs- the element's attributes that hold the location information
- Returns:
- the element's URI or "[unknown location]" ifattrshas no location information.
 
- 
getLineReturns the line number of an element (SAX flavor)- Parameters:
- attrs- the element's attributes that hold the location information
- Returns:
- the element's line number or -1ifattrshas no location information.
 
- 
getColumnReturns the column number of an element (SAX flavor)- Parameters:
- attrs- the element's attributes that hold the location information
- Returns:
- the element's column number or -1ifattrshas no location information.
 
- 
getLocationReturns theLocationof an element (DOM flavor).- Parameters:
- elem- the element that holds the location information
- description- a description for the location (if- null, the element's name is used)
- Returns:
- a Locationobject
 
- 
getLocationSame asgetLocation(elem, null).- Parameters:
- elem- the element that holds the location information
- Returns:
- a Locationobject
 
- 
getLocationStringReturns the location of an element that has been processed by this pipe (DOM flavor). If the location is to be kept into an object built from this element, consider usinggetLocation(Element)and theLocatableinterface.- Parameters:
- elem- the element that holds the location information
- Returns:
- a location string as defined by Location.
 
- 
getURIReturns the URI of an element (DOM flavor)- Parameters:
- elem- the element that holds the location information
- Returns:
- the element's URI or "[unknown location]" ifelemhas no location information.
 
- 
getLineReturns the line number of an element (DOM flavor)- Parameters:
- elem- the element that holds the location information
- Returns:
- the element's line number or -1ifelemhas no location information.
 
- 
getColumnReturns the column number of an element (DOM flavor)- Parameters:
- elem- the element that holds the location information
- Returns:
- the element's column number or -1ifelemhas no location information.
 
- 
removeRemove the location attributes from a DOM element.- Parameters:
- elem- the element to remove the location attributes from.
- recurse- if- true, also remove location attributes on descendant elements.
 
 
-