Package PamUtils
Class XMLUtils
java.lang.Object
PamUtils.XMLUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Document
Creates a blank Document object, or returns null if there was an errorstatic Document
createDocument
(File xmlFile) Create an xml document from an xml file.static Document
createDocument
(String xmlFileName) Create an xml document from an xml file.static String
getAsString
(Document doc) Get the xml document as a String.static Document
getDocumentFromString
(String xmlString) Convert a string back into an XML document.static Double
getDoubleValue
(Element el, String name) Get a Double attribute from an Elementstatic Integer
getIntegerValue
(Element el, String name) Get an integer attribute from an Elementstatic String
Convert an xml document to a String.static void
writeToFile
(Document doc, File outFile) Write to the given file.
-
Constructor Details
-
XMLUtils
public XMLUtils()
-
-
Method Details
-
getStringFromDocument
Convert an xml document to a String.- Parameters:
doc
- xml document
-
getDocumentFromString
Convert a string back into an XML document.- Parameters:
xmlString
- String- Returns:
- XML Document, or null if there was an error
-
getIntegerValue
Get an integer attribute from an Element- Parameters:
el
- XML Elementname
- Attribute name- Returns:
- null if not a number
-
getDoubleValue
Get a Double attribute from an Element- Parameters:
el
- XML Elementname
- Attribute name- Returns:
- null if not a number
-
createBlankDoc
Creates a blank Document object, or returns null if there was an error- Returns:
-
createDocument
Create an xml document from an xml file.- Parameters:
xmlFileName
- xml file name- Returns:
- document
-
createDocument
Create an xml document from an xml file.- Parameters:
xmlFile
- xml file- Returns:
- document
-
writeToFile
Write to the given file.- Parameters:
doc
- xml documentoutFile
- file- Throws:
IOException
-
getAsString
Get the xml document as a String.- Parameters:
doc
- xml document- Returns:
- xml content as a a string.
-