| |
|
| java.lang.Object org.apache.cocoon.util.location.LocationAttributes
LocationAttributes | public class LocationAttributes (Code) | | A class to handle location information stored in attributes.
These attributes are typically setup using
org.apache.cocoon.util.location.LocationAttributes.Pipe which augments the SAX stream with additional attributes, e.g.:
<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>
See Also: org.apache.cocoon.util.location.LocationAttributes.Pipe since: 2.1.8 version: $Id: LocationAttributes.java 446919 2006-09-16 19:19:25Z vgritsenko $ |
COL_ATTR | final public static String COL_ATTR(Code) | | Attribute name for the column number
|
LINE_ATTR | final public static String LINE_ATTR(Code) | | Attribute name for the line number
|
PREFIX | final public static String PREFIX(Code) | | Prefix for the location namespace
|
Q_COL_ATTR | final public static String Q_COL_ATTR(Code) | | Attribute qualified name for the column number
|
Q_LINE_ATTR | final public static String Q_LINE_ATTR(Code) | | Attribute qualified name for the line number
|
Q_SRC_ATTR | final public static String Q_SRC_ATTR(Code) | | Attribute qualified name for the location URI
|
SRC_ATTR | final public static String SRC_ATTR(Code) | | Attribute name for the location URI
|
URI | final public static String URI(Code) | | Namespace URI for location attributes
|
addLocationAttributes | public static Attributes addLocationAttributes(Locator locator, Attributes attrs)(Code) | | Add location attributes to a set of SAX attributes.
Parameters: locator - the Locator (can be null) Parameters: attrs - the Attributes where locator information should be added |
getColumn | public static int getColumn(Attributes attrs)(Code) | | Returns the column number of an element (SAX flavor)
Parameters: attrs - the element's attributes that hold the location information the element's column number or -1 if attrs has no location information. |
getColumn | public static int getColumn(Element elem)(Code) | | Returns the column number of an element (DOM flavor)
Parameters: elem - the element that holds the location information the element's column number or -1 if elem has no location information. |
getLine | public static int getLine(Attributes attrs)(Code) | | Returns the line number of an element (SAX flavor)
Parameters: attrs - the element's attributes that hold the location information the element's line number or -1 if attrs has no location information. |
getLine | public static int getLine(Element elem)(Code) | | Returns the line number of an element (DOM flavor)
Parameters: elem - the element that holds the location information the element's line number or -1 if elem has no location information. |
getLocation | public static Location getLocation(Attributes attrs, String description)(Code) | | Returns the
Location of an element (SAX flavor).
Parameters: attrs - the element's attributes that hold the location information Parameters: description - a description for the location (can be null) a Location object |
getLocation | public static Location getLocation(Element elem, String description)(Code) | | Returns the
Location of an element (DOM flavor).
Parameters: elem - the element that holds the location information Parameters: description - a description for the location (if null , the element's name is used) a Location object |
getLocationString | public static String getLocationString(Element elem)(Code) | | Returns 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 using
LocationAttributes.getLocation(Element) and the
Locatable interface.
Parameters: elem - the element that holds the location information a location string as defined by Location.toString. |
getURI | public static String getURI(Attributes attrs)(Code) | | Returns the URI of an element (SAX flavor)
Parameters: attrs - the element's attributes that hold the location information the element's URI or "[unknown location] " if attrs has no location information. |
getURI | public static String getURI(Element elem)(Code) | | Returns the URI of an element (DOM flavor)
Parameters: elem - the element that holds the location information the element's URI or "[unknown location] " if elem has no location information. |
remove | public static void remove(Element elem, boolean recurse)(Code) | | Remove the location attributes from a DOM element.
Parameters: elem - the element to remove the location attributes from. Parameters: recurse - if true , also remove location attributes on descendant elements. |
|
|
|