org.tinyjee.maven.dim.utils
Class AbstractPositioningDocumentBuilder

java.lang.Object
  extended by org.tinyjee.maven.dim.utils.AbstractPositioningDocumentBuilder
Direct Known Subclasses:
PositioningDocumentBuilder, PositioningJsonDocumentBuilder

public abstract class AbstractPositioningDocumentBuilder
extends Object

Base class to Document builders that add element location information into the generated element nodes.

Author:
Juergen_Kellerer, 2011-10-13

Field Summary
static String KEY_COLUMN_NUMBER
          Is a user-data key (for Node.getUserData(String)) that may be used to return the column number of an element node.
static String KEY_LINE_NUMBER
          Is a user-data key (for Node.getUserData(String)) that may be used to return the line number of an element node.
 
Constructor Summary
AbstractPositioningDocumentBuilder()
           
 
Method Summary
static int getColumnNumber(Node node)
          Returns the column number of the specified node if known, -1 otherwise.
static int getLineNumber(Node node)
          Returns the line number of the specified node if known, -1 otherwise.
abstract  Document parse(URL systemId)
          Parses the given URL to a Document.
abstract  Document parse(URL systemId, Reader reader)
          Parses the given URL to a Document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_LINE_NUMBER

public static final String KEY_LINE_NUMBER
Is a user-data key (for Node.getUserData(String)) that may be used to return the line number of an element node.

See Also:
Constant Field Values

KEY_COLUMN_NUMBER

public static final String KEY_COLUMN_NUMBER
Is a user-data key (for Node.getUserData(String)) that may be used to return the column number of an element node.

See Also:
Constant Field Values
Constructor Detail

AbstractPositioningDocumentBuilder

public AbstractPositioningDocumentBuilder()
Method Detail

getLineNumber

public static int getLineNumber(Node node)
Returns the line number of the specified node if known, -1 otherwise.

Parameters:
node - a node that was created using this builder.
Returns:
the line number of the specified node if known, -1 otherwise.

getColumnNumber

public static int getColumnNumber(Node node)
Returns the column number of the specified node if known, -1 otherwise.

Parameters:
node - a node that was created using this builder.
Returns:
the column number of the specified node if known, -1 otherwise.

parse

public abstract Document parse(URL systemId)
                        throws Exception
Parses the given URL to a Document.

Parameters:
systemId - the URL of the document to parse.
Returns:
the parsed document.
Throws:
Exception - In case of parsing failed.

parse

public abstract Document parse(URL systemId,
                               Reader reader)
                        throws Exception
Parses the given URL to a Document.

Parameters:
systemId - the URL of the document to parse.
reader - a reader containing the content to parse.
Returns:
the parsed document.
Throws:
Exception - In case of parsing failed.