|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.jmatchparser.util.LocationAwareDOMParser
public class LocationAwareDOMParser
A DOM
parser that annotates each
Node
with an approximate line/column number where it was
parsed.
Technically, this is done by parsing the document twice; therefore, this
class also provides a utility method to create clones of an
InputSource
.
Constructor Summary | |
---|---|
LocationAwareDOMParser()
|
Method Summary | |
---|---|
static InputSource[] |
createClones(InputSource input,
int count)
Create an arbitrary number of clones of an InputSource . |
static int |
getColumnNumber(Node node)
Get the column number embedded in a node. |
static int |
getLineNumber(Node node)
Get the line number embedded in a node. |
static Document |
parse(DocumentBuilder documentBuilder,
InputSource source)
Parse the given InputSource to a DOM document that contains line
number information, using a custom DocumentBuilder . |
static Document |
parse(InputSource source)
Parse the given InputSource to a DOM document that contains line
number information, using the default DocumentBuilder . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocationAwareDOMParser()
Method Detail |
---|
public static InputSource[] createClones(InputSource input, int count) throws IOException
InputSource
. The
original InputSource will be invalid after that, but each of the clone
can be used individually to parse the same document in multiple ways.
input
- The InputSource to clonecount
- The desired number of clones
IOException
public static Document parse(InputSource source) throws Exception
InputSource
to a DOM document that contains line
number information, using the default DocumentBuilder
.
Exception
public static Document parse(DocumentBuilder documentBuilder, InputSource source) throws Exception
InputSource
to a DOM document that contains line
number information, using a custom DocumentBuilder
.
Exception
public static int getLineNumber(Node node)
node
- the node
public static int getColumnNumber(Node node)
node
- the node
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |