|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectno.uio.edd.utils.xmlutils.DomUtils
public class DomUtils
A class of static methods for XML DOM tasks.
Constructor Summary | |
---|---|
DomUtils()
|
Method Summary | |
---|---|
static java.lang.String |
convertToString(org.w3c.dom.Document doc)
Convert from XML document to String |
static java.lang.StringBuilder |
convertToStringBuffer(org.w3c.dom.Document doc)
Convert from XML document to StringBuffer |
static org.w3c.dom.Element |
findNamedElementBefore(org.w3c.dom.Node inNode,
java.lang.String nodeName)
Only finds on same sibling level for the time being. |
static org.w3c.dom.Element |
findNamedElementBeforeOrUnder(org.w3c.dom.Node inNode)
Only look on same sibling level for the time being - dangerous. |
static java.lang.String |
findTextBetween(org.w3c.dom.Node firstNode,
org.w3c.dom.Node lastNode)
|
static org.w3c.dom.Node |
findXmlAttrValue(org.w3c.dom.Node inNode,
java.lang.String inAttrName,
java.lang.String inAttrValue)
Searches a subtree for a node with a specific attribute name and value pair. |
static ExtendableNodeList |
getElementsByTagNames(org.w3c.dom.Document doc,
java.lang.String[] elementNames)
Creates a list of nodes based on one or more element names. |
static java.lang.String |
getGmlFooter()
Creates a GML footer. |
static java.lang.String |
getGmlHeader()
Create a GML header, with all values set to default. |
static java.lang.String |
getSvgFooter()
Created a SVG footer. |
static java.lang.String |
getSvgHeader(java.lang.String title)
Created a SVG header, with some standard values set. |
static java.lang.String |
getSvgHeader(java.lang.String title,
int sizeX,
int sizeY)
Created a SVG header, with some standard values set. |
static java.lang.String |
getXhtmlFooter()
Creates an xhtml footer, from the point where the body element is open. |
static java.lang.String |
getXhtmlHeader(java.lang.String title)
Creates a xhtml1-strict header, up to the point where the body element is open. |
static java.lang.String |
getXmlHeader()
|
static java.lang.String |
isErrorReturnMessage(java.lang.String xmlIn)
Checks if an XML is a error message. |
static java.lang.String |
isErrorReturnXml(java.lang.String xmlIn)
Checks if an XML is a error message. |
static org.w3c.dom.Document |
parseStringAsXML(java.lang.String inString)
Parses a string and return an XML DOM tree. |
static org.w3c.dom.Document |
parseStringAsXML(java.lang.String inString,
java.lang.String inSchemaFileUrl)
Parses a string and return an XML DOM tree. |
static org.w3c.dom.Document |
parseXMLFile(java.lang.String inFilePath)
Parses a file and return an XML DOM tree. |
static org.w3c.dom.Document |
parseXMLFile(java.lang.String inFilePath,
java.lang.String inSchemaFilePath)
Parses a file using an XML schema and return an XML DOM tree. |
static org.w3c.dom.Document |
parseXMLUrl(java.lang.String inFileUrl)
Parses a file and return an XML DOM tree. |
static org.w3c.dom.Document |
parseXMLUrl(java.lang.String inFileUrl,
java.lang.String inSchemaFileUrl)
Parses a file using an XML schema and return an XML DOM tree. |
static void |
removeAllChildren(org.w3c.dom.Element parent)
Removes all children of all types from this element. |
static org.w3c.dom.Node |
removeNamedNode(org.w3c.dom.Node rootNode,
java.lang.String elementName)
Removes all nodes in the subtree with the specified element name. |
static java.lang.String |
xmlFragment(org.w3c.dom.Node def)
Creates an xml string including the input node and all siblings. |
static java.lang.String |
xmlNodeContents(org.w3c.dom.Node encapsule)
Returns all the contents in one specific node, including tags. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DomUtils()
Method Detail |
---|
public static java.lang.StringBuilder convertToStringBuffer(org.w3c.dom.Document doc)
doc
- An xmlParser document
public static java.lang.String convertToString(org.w3c.dom.Document doc)
doc
- An xmlParser document
public static org.w3c.dom.Document parseStringAsXML(java.lang.String inString)
inString
- an XML document expresses as a string.
public static org.w3c.dom.Document parseStringAsXML(java.lang.String inString, java.lang.String inSchemaFileUrl)
inString
- an XML document expresses as a string.inSchemaFileUrl
- Path to an XML schema used in the parsing.
public static org.w3c.dom.Document parseXMLFile(java.lang.String inFilePath)
inFilePath
- Path to an XML document expresses as a string.
public static org.w3c.dom.Document parseXMLUrl(java.lang.String inFileUrl, java.lang.String inSchemaFileUrl)
inFileUrl
- URL to an XML document expresses as a string.inSchemaFileUrl
- Path to an XML schema used in the parsing.
public static org.w3c.dom.Document parseXMLUrl(java.lang.String inFileUrl)
inFileUrl
- URL to an XML document expresses as a string.
public static org.w3c.dom.Document parseXMLFile(java.lang.String inFilePath, java.lang.String inSchemaFilePath)
inFilePath
- Path to an XML document expresses as a string.inSchemaFilePath
- Path to an XML schema used in the parsing.
public static java.lang.String xmlNodeContents(org.w3c.dom.Node encapsule) throws java.io.IOException
encapsule
- The root node
java.io.IOException
public static java.lang.String xmlFragment(org.w3c.dom.Node def) throws java.io.IOException
def
- The input node
java.io.IOException
public static org.w3c.dom.Node findXmlAttrValue(org.w3c.dom.Node inNode, java.lang.String inAttrName, java.lang.String inAttrValue)
inNode
- the root node of the subtree to be searched.inAttrName
- the name of the attribute.inAttrValue
- the value of the attribute.
public static java.lang.String isErrorReturnXml(java.lang.String xmlIn)
xmlIn
- the XML
public static java.lang.String isErrorReturnMessage(java.lang.String xmlIn)
xmlIn
- the XML
public static org.w3c.dom.Node removeNamedNode(org.w3c.dom.Node rootNode, java.lang.String elementName)
rootNode
- the root node of the subtree.elementName
- the element name for the elements to be removed.
public static void removeAllChildren(org.w3c.dom.Element parent)
parent
- The partent from which all children will be removed.public static org.w3c.dom.Element findNamedElementBefore(org.w3c.dom.Node inNode, java.lang.String nodeName)
inNode
- nodeName
-
public static org.w3c.dom.Element findNamedElementBeforeOrUnder(org.w3c.dom.Node inNode)
inNode
-
public static java.lang.String findTextBetween(org.w3c.dom.Node firstNode, org.w3c.dom.Node lastNode)
public static java.lang.String getXhtmlHeader(java.lang.String title)
title
- The title to be set in the head element.
public static java.lang.String getXhtmlFooter()
public static java.lang.String getSvgHeader(java.lang.String title, int sizeX, int sizeY)
title
- The title of the SVG document.sizeX
- Size of canvas.sizeY
- Size of canvas.
public static java.lang.String getSvgHeader(java.lang.String title)
title
- The title of the SVG document.
public static java.lang.String getSvgFooter()
public static java.lang.String getGmlHeader()
public static java.lang.String getGmlFooter()
public static java.lang.String getXmlHeader()
public static ExtendableNodeList getElementsByTagNames(org.w3c.dom.Document doc, java.lang.String[] elementNames)
doc
- The DOM document to look for nodes in.elementNames
- The list of names to look for
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |