public final class XmlLineNumberParser extends Object
The line number and column number can be obtained from a Node/Element using
String lineNumber = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER); String lineNumberEnd = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER_END); String columnNumber = (String) node.getUserData(XmlLineNumberParser.COLUMN_NUMBER); String columnNumberEnd = (String) node.getUserData(XmlLineNumberParser.COLUMN_NUMBER_END);
Modifier and Type | Class and Description |
---|---|
static interface |
XmlLineNumberParser.XmlTextTransformer
Allows to plugin a custom text transformer in the parser, that can transform all the text content
|
Modifier and Type | Field and Description |
---|---|
static String |
COLUMN_NUMBER |
static String |
COLUMN_NUMBER_END |
static String |
LINE_NUMBER |
static String |
LINE_NUMBER_END |
Modifier and Type | Method and Description |
---|---|
static Document |
parseXml(InputStream is)
Parses the XML.
|
static Document |
parseXml(InputStream is,
XmlLineNumberParser.XmlTextTransformer xmlTransformer)
Parses the XML.
|
static Document |
parseXml(InputStream is,
XmlLineNumberParser.XmlTextTransformer xmlTransformer,
String rootNames,
String forceNamespace)
Parses the XML.
|
public static final String LINE_NUMBER
public static final String COLUMN_NUMBER
public static final String LINE_NUMBER_END
public static final String COLUMN_NUMBER_END
public static Document parseXml(InputStream is) throws Exception
is
- the XML content as an input streamException
- is thrown if error parsingpublic static Document parseXml(InputStream is, XmlLineNumberParser.XmlTextTransformer xmlTransformer) throws Exception
is
- the XML content as an input streamxmlTransformer
- the XML transformerException
- is thrown if error parsingpublic static Document parseXml(InputStream is, XmlLineNumberParser.XmlTextTransformer xmlTransformer, String rootNames, String forceNamespace) throws Exception
is
- the XML content as an input streamxmlTransformer
- the XML transformerrootNames
- one or more root names that is used as baseline for beginning the parsing, for example camelContext to start parsing
when Camel is discovered. Multiple names can be defined separated by commaforceNamespace
- an optional namespaces to force assign to each node. This may be needed for JAXB unmarshalling from XML -> POJO.Exception
- is thrown if error parsingApache Camel