@Beta @NotThreadSafe public final class XmlParserStream extends Object implements Closeable, Flushable
Modifier and Type | Method and Description |
---|---|
void |
close() |
static XmlParserStream |
create(NormalizedNodeStreamWriter writer,
SchemaContext schemaContext,
SchemaNode parentNode)
Utility method for use when caching
XmlCodecFactory is not feasible. |
static XmlParserStream |
create(NormalizedNodeStreamWriter writer,
SchemaContext schemaContext,
SchemaNode parentNode,
boolean strictParsing)
Utility method for use when caching
XmlCodecFactory is not feasible. |
static XmlParserStream |
create(NormalizedNodeStreamWriter writer,
XmlCodecFactory codecs,
SchemaNode parentNode)
Construct a new
XmlParserStream with strict parsing mode switched on. |
static XmlParserStream |
create(NormalizedNodeStreamWriter writer,
XmlCodecFactory codecs,
SchemaNode parentNode,
boolean strictParsing)
Construct a new
XmlParserStream . |
void |
flush() |
XmlParserStream |
parse(XMLStreamReader reader)
This method parses the XML source and emits node events into a NormalizedNodeStreamWriter based on the
YANG-modeled data contained in the XML source.
|
XmlParserStream |
traverse(DOMSource src)
This method traverses a
DOMSource and emits node events into a NormalizedNodeStreamWriter based on the
YANG-modeled data contained in the source. |
public static XmlParserStream create(NormalizedNodeStreamWriter writer, XmlCodecFactory codecs, SchemaNode parentNode)
XmlParserStream
with strict parsing mode switched on.writer
- Output writercodecs
- Shared codecsparentNode
- Parent root nodepublic static XmlParserStream create(NormalizedNodeStreamWriter writer, XmlCodecFactory codecs, SchemaNode parentNode, boolean strictParsing)
XmlParserStream
.writer
- Output writercodecs
- Shared codecsparentNode
- Parent root nodestrictParsing
- parsing mode
if set to true, the parser will throw an exception if it encounters unknown child nodes
(nodes, that are not defined in the provided SchemaContext) in containers and lists
if set to false, the parser will skip unknown child nodespublic static XmlParserStream create(NormalizedNodeStreamWriter writer, SchemaContext schemaContext, SchemaNode parentNode)
XmlCodecFactory
is not feasible. Users with high performance
requirements should use create(NormalizedNodeStreamWriter, XmlCodecFactory, SchemaNode)
instead and
maintain a XmlCodecFactory
to match the current SchemaContext
.public static XmlParserStream create(NormalizedNodeStreamWriter writer, SchemaContext schemaContext, SchemaNode parentNode, boolean strictParsing)
XmlCodecFactory
is not feasible. Users with high performance
requirements should use create(NormalizedNodeStreamWriter, XmlCodecFactory, SchemaNode)
instead and
maintain a XmlCodecFactory
to match the current SchemaContext
.public XmlParserStream parse(XMLStreamReader reader) throws XMLStreamException, URISyntaxException, IOException, SAXException
reader
- StAX reader which is to used to walk through the XML sourceXMLStreamException
- if a well-formedness error or an unexpected processing condition occurs while parsing the XMLURISyntaxException
- if the namespace URI of an XML element contains a syntax errorIOException
- if an error occurs while parsing the value of an anyxml nodeSAXException
- if an error occurs while parsing the value of an anyxml node@Beta public XmlParserStream traverse(DOMSource src) throws XMLStreamException, URISyntaxException, IOException, SAXException
DOMSource
and emits node events into a NormalizedNodeStreamWriter based on the
YANG-modeled data contained in the source.src
- DOMSource
to be traversedXMLStreamException
- if a well-formedness error or an unexpected processing condition occurs while parsing the XMLURISyntaxException
- if the namespace URI of an XML element contains a syntax errorIOException
- if an error occurs while parsing the value of an anyxml nodeSAXException
- if an error occurs while parsing the value of an anyxml nodepublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void flush() throws IOException
flush
in interface Flushable
IOException
Copyright © 2019 OpenDaylight. All rights reserved.