Class UntrustedXML
java.lang.Object
org.opendaylight.yangtools.util.xml.UntrustedXML
Set of utility methods for instantiating parser that deal with untrusted XML sources.
- Author:
- Robert Varga
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull XMLStreamReader
createXMLStreamReader
(InputStream stream) Create a newXMLStreamReader
for dealing with untrusted XML data.static @NonNull XMLStreamReader
createXMLStreamReader
(InputStream stream, Charset charset) Create a newXMLStreamReader
for dealing with untrusted XML data.static @NonNull XMLStreamReader
createXMLStreamReader
(Reader reader) Create a newXMLStreamReader
for dealing with untrusted XML data.static @NonNull DocumentBuilder
Create a newDocumentBuilder
for dealing with untrusted XML data.static @NonNull SAXParser
Create a newSAXParser
for dealing with untrusted XML data.
-
Method Details
-
newDocumentBuilder
Create a newDocumentBuilder
for dealing with untrusted XML data. This method is equivalent toDocumentBuilderFactory.newDocumentBuilder()
, except it does not throw a checked exception.- Returns:
- A new DocumentBuilder
- Throws:
UnsupportedOperationException
- if the runtime fails to instantiate a good enough builder
-
newSAXParser
Create a newSAXParser
for dealing with untrusted XML data. This method is equivalent toSAXParserFactory.newSAXParser()
, except it does not throw a checked exception.- Returns:
- A new SAXParser
- Throws:
UnsupportedOperationException
- if the runtime fails to instantiate a good enough builder
-
createXMLStreamReader
public static @NonNull XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException Create a newXMLStreamReader
for dealing with untrusted XML data. This method is equivalent toXMLInputFactory.createXMLStreamReader(InputStream)
.- Returns:
- A new XMLStreamReader
- Throws:
XMLStreamException
- when the underlying factory throws it
-
createXMLStreamReader
public static @NonNull XMLStreamReader createXMLStreamReader(InputStream stream, Charset charset) throws XMLStreamException Create a newXMLStreamReader
for dealing with untrusted XML data. This method is equivalent toXMLInputFactory.createXMLStreamReader(InputStream, String)
, except it takes an explict charset argument.- Returns:
- A new XMLStreamReader
- Throws:
XMLStreamException
- when the underlying factory throws it
-
createXMLStreamReader
public static @NonNull XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException Create a newXMLStreamReader
for dealing with untrusted XML data. This method is equivalent toXMLInputFactory.createXMLStreamReader(Reader)
.- Returns:
- A new XMLStreamReader
- Throws:
XMLStreamException
- when the underlying factory throws it
-