public class XMLUtils
extends java.lang.Object
Constructor and Description |
---|
XMLUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
exportContent(DialogueSystem system,
java.lang.String file,
java.lang.String tag)
Exports a dialogue state or prior parameter distributions.
|
static java.util.Properties |
extractMapping(org.w3c.dom.Node mainNode)
Extract the settings from the XML node.
|
static java.util.Properties |
extractMapping(java.lang.String settingsFile)
Extract the settings from the XML file.
|
static org.w3c.dom.Node |
getMainNode(org.w3c.dom.Document doc)
Returns the main node of the XML document
|
static org.w3c.dom.Document |
getXMLDocument(org.xml.sax.InputSource is)
Opens the XML document referenced by the input source, and returns it
|
static org.w3c.dom.Document |
getXMLDocument(java.lang.String filename)
Opens the XML document referenced by the filename, and returns it
|
static boolean |
hasContent(org.w3c.dom.Node node)
Returns true if the node has some actual content (other than a comment or an
empty text).
|
static void |
importContent(DialogueSystem system,
java.lang.String file,
java.lang.String tag)
Imports a dialogue state or prior parameter distributions.
|
static org.w3c.dom.Document |
loadXMLFromString(java.lang.String xml) |
static org.w3c.dom.Document |
newXMLDocument()
Creates a new XML, empty document
|
static java.lang.String |
serialise(org.w3c.dom.Node node)
Serialises the XML node into a string.
|
static boolean |
validateXML(java.lang.String dialSpecs,
java.lang.String schemaFile)
Validates a XML document containing a specification of a dialogue domain.
|
static void |
writeXMLDocument(org.w3c.dom.Document doc,
java.lang.String filename)
Writes the XML document to the particular file specified as argument
|
static java.lang.String |
writeXMLString(org.w3c.dom.Document doc)
Writes the XML document as a raw string
|
public static org.w3c.dom.Document getXMLDocument(java.lang.String filename)
filename
- the filenamepublic static org.w3c.dom.Document getXMLDocument(org.xml.sax.InputSource is)
is
- the input sourcepublic static java.lang.String serialise(org.w3c.dom.Node node)
node
- the XML nodepublic static org.w3c.dom.Document newXMLDocument()
public static void writeXMLDocument(org.w3c.dom.Document doc, java.lang.String filename)
doc
- the documentfilename
- the path to the file in which to write the XML data writing
operation failspublic static java.lang.String writeXMLString(org.w3c.dom.Document doc)
doc
- the documentpublic static org.w3c.dom.Document loadXMLFromString(java.lang.String xml) throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
public static org.w3c.dom.Node getMainNode(org.w3c.dom.Document doc)
doc
- the XML documentpublic static java.util.Properties extractMapping(java.lang.String settingsFile)
settingsFile
- the file containing the settingspublic static java.util.Properties extractMapping(org.w3c.dom.Node mainNode)
mainNode
- the XML node containing the settingspublic static boolean validateXML(java.lang.String dialSpecs, java.lang.String schemaFile)
dialSpecs
- the domain fileschemaFile
- the schema filepublic static void importContent(DialogueSystem system, java.lang.String file, java.lang.String tag)
system
- the dialogue systemfile
- the file that contains the state or parameter contenttag
- the expected top XML tag. into the systempublic static void exportContent(DialogueSystem system, java.lang.String file, java.lang.String tag)
system
- the dialogue systemfile
- the file in which to write the state or parameter contenttag
- the expected top XML tag. from the systempublic static boolean hasContent(org.w3c.dom.Node node)
node
- the XML node