Package org.eigenbase.xom.wrappers
Class Annotator
java.lang.Object
org.eigenbase.xom.wrappers.Annotator
Quick and dirty XML parser that finds the precise start and end
position of all nodes in a document. Also finds all line endings, so
that character offsets can be converted to line/column positions.
- Since:
- 13 October, 2008
- Version:
- $Id: //open/util/resgen/src/org/eigenbase/xom/wrappers/Annotator.java#4 $
- Author:
- jhyde
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) int
getCol
(int pos) Returns the column that a character position falls on.(package private) int
getLine
(int pos) Returns the line that a character position falls on.getLocation
(DOMWrapper wrapper) (package private) List
Returns the list of LocInfo.(package private) void
list
(PrintWriter pw) (package private) void
-
Constructor Details
-
Annotator
Annotator(String xml, DOMWrapper def) Creates an Annotator.For testing purposes,
wrapper
may be null. Parses the XML but does not build the mapping from location information to DOM nodes.- Parameters:
xml
- XML source stringdef
- Wrapper around root DOM node
-
-
Method Details
-
getLocation
-
getLocInfoList
List getLocInfoList()Returns the list of LocInfo. For testing.- Returns:
- list of LocInfo.
-
parse
-
getLine
int getLine(int pos) Returns the line that a character position falls on. The first line in a document is numbered 0.- Parameters:
pos
- Character position- Returns:
- Line (starting from 0)
-
getCol
int getCol(int pos) Returns the column that a character position falls on. The first column in a line is numbered 0.- Parameters:
pos
- Character position- Returns:
- column (starting from 0)
-
list
-