Package com.stimulsoft.base.utils
Class StiXmlHelper
java.lang.Object
com.stimulsoft.base.utils.StiXmlHelper
XML helper
Copyright Stimulsoft
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentParse xml file toDocumentIf file not foutn it tries to load from resuorcesstatic DocumentloadXML(InputStream is) static Documentstatic StringSerializeDocumentto stringstatic Stringstatic Stringserialize(Document doc, boolean omitXMLDeclaration, boolean indent, Element element, String encoding) SerializeDocumentto stringstatic Stringstatic StringSerialize elementstatic StringCheck invalid input: '&' convert non-valid XML paramstatic ElementwriteElementString(Document doc, Element element, String elName, String value) Write string emenet-value toElement
-
Constructor Details
-
StiXmlHelper
public StiXmlHelper()
-
-
Method Details
-
loadXML
public static Document loadXML(String filePath) throws ParserConfigurationException, SAXException, IOException -
loadXML
public static Document loadXML(File file) throws ParserConfigurationException, SAXException, IOException Parse xml file toDocumentIf file not foutn it tries to load from resuorces- Parameters:
filePath-- Returns:
- Throws:
ParserConfigurationExceptionSAXExceptionIOException
-
loadXML
public static Document loadXML(InputStream is) throws ParserConfigurationException, SAXException, IOException -
serialize
SerializeDocumentto string- Parameters:
doc-Document- Returns:
- Serialized
Document - Throws:
IOExceptionTransformerException
-
serialize
public static String serialize(Document doc, boolean omitXMLDeclaration, Element element) throws IOException, TransformerException - Throws:
IOExceptionTransformerException
-
serialize
public static String serialize(Document doc, boolean omitXMLDeclaration, boolean indent, Element element) throws IOException, TransformerException - Throws:
IOExceptionTransformerException
-
serialize
public static String serialize(Document doc, boolean omitXMLDeclaration, boolean indent, Element element, String encoding) throws IOException, TransformerException SerializeDocumentto string- Parameters:
doc-DocumentomitXMLDeclaration- Omit XML declaration- Returns:
- Throws:
IOExceptionTransformerException
-
serialize
Serialize element- Parameters:
doc-Documentel-Element- Returns:
- Serialized element
- Throws:
IOExceptionTransformerException
-
validName
Check invalid input: '&' convert non-valid XML param- Parameters:
value-- Returns:
-
writeElementString
public static Element writeElementString(Document doc, Element element, String elName, String value) Write string emenet-value toElement
-