Package ca.uhn.fhir.util
Class XmlUtil
java.lang.Object
ca.uhn.fhir.util.XmlUtil
Utility methods for working with the StAX API.
This class contains code adapted from the Apache Axiom project.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic XMLEventReader
createXmlReader
(Reader reader) static XMLStreamWriter
createXmlStreamWriter
(Writer theWriter) static XMLEventWriter
createXmlWriter
(Writer theWriter) static String
Encode a set of StAX events into a Stringstatic String
encodeDocument
(Node theElement) static String
encodeDocument
(Node theElement, boolean theIndent) getChildrenByTagName
(Element theParent, String theName) Parses an XML string into a set of StAX eventsstatic Document
parseDocument
(Reader reader) static Document
parseDocument
(Reader theReader, boolean theNamespaceAware, boolean allowDoctypeDeclaration) static Document
parseDocument
(String theInput) static void
FOR UNIT TESTS ONLY - Used to reset OutputFactory for test cases that customize OutputFactory
-
Method Details
-
createXmlReader
public static XMLEventReader createXmlReader(Reader reader) throws FactoryConfigurationError, XMLStreamException -
createXmlStreamWriter
public static XMLStreamWriter createXmlStreamWriter(Writer theWriter) throws FactoryConfigurationError, XMLStreamException -
createXmlWriter
public static XMLEventWriter createXmlWriter(Writer theWriter) throws FactoryConfigurationError, XMLStreamException -
encode
Encode a set of StAX events into a String -
parse
Parses an XML string into a set of StAX events -
parseDocument
- Throws:
IOException
SAXException
-
parseDocument
- Throws:
SAXException
IOException
-
parseDocument
public static Document parseDocument(Reader theReader, boolean theNamespaceAware, boolean allowDoctypeDeclaration) throws SAXException, IOException - Throws:
SAXException
IOException
-
getChildrenByTagName
-
encodeDocument
- Throws:
TransformerException
-
encodeDocument
- Throws:
TransformerException
-
resetOutputFactoryForTest
FOR UNIT TESTS ONLY - Used to reset OutputFactory for test cases that customize OutputFactory
-