|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.xcap.xml.XMLUtils
public class XMLUtils
Field Summary | |
---|---|
static java.lang.String |
COPYRIGHT
|
Constructor Summary | |
---|---|
XMLUtils()
Constructor for XMLUtils. |
Method Summary | |
---|---|
void |
addSchema(java.io.InputStream schema)
Adds a schema from the InputStream. |
void |
addSchemas(java.util.ArrayList<java.io.InputStream> schemaInputStreams)
Adds schemas given an array of InputStreams containing the schemas. |
void |
addSchemaStrings(java.util.ArrayList<java.lang.String> schemaStrings)
Adds the schema Strings to the XMLUtils |
java.lang.Object |
clone()
|
boolean |
compareNode(org.w3c.dom.Node node1,
org.w3c.dom.Node node2)
Method compareNode. |
boolean |
compareXML(java.lang.String xml1,
java.lang.String xml2)
Method compareXML. |
static void |
findNodeElementsByName(org.w3c.dom.Node node,
java.lang.String elementName,
java.util.ArrayList<org.w3c.dom.Node> resultList)
Method findNodeElementsByName. |
static org.w3c.dom.Attr |
getAttribute(org.w3c.dom.Element element,
java.lang.String attrName,
java.lang.String namespace,
java.lang.String nsPrefix)
Returns the attribute associated with the element. |
static java.lang.String |
getDeclaredNamespaces(org.w3c.dom.Element element)
Returns the declared namespaces for this element. |
protected javax.xml.parsers.DocumentBuilder |
getDocumentBuilder(boolean isValidating)
Returns the DocumentBuilder depending on whether validation is needed or not |
static java.lang.String |
getLocalName(org.w3c.dom.Node node)
Returns the local name without the namespace prefix if any |
org.w3c.dom.Document |
getNewDocument(boolean isValidating,
java.lang.String namespaceURI,
java.lang.String qualifiedName,
org.w3c.dom.DocumentType doc)
|
static java.lang.String |
getNodeValue(org.w3c.dom.Node node)
Returns the element value |
static java.lang.String |
getPrefix(org.w3c.dom.Node node)
Returns the namespace prefix for the node |
java.util.ArrayList<java.io.InputStream> |
getSchemaStreams()
Returns the schemas as an ArrayList of InputStreams |
java.util.ArrayList<java.lang.String> |
getSchemaStrings()
Returns the schemas as an ArrayList of Strings |
static boolean |
isNodeMatch(org.w3c.dom.Node node,
java.lang.String name,
java.lang.String namespace,
java.lang.String nsPrefix)
Returns true if the node matches the given name and matches either the namespace or nsPrefix. |
void |
loadDefaultSchemas()
Loads the default xml.xsd, XmlSchema.xsd, and ibm-application-usage.xsd contained within the XcapUtils.jar. |
java.lang.String |
node2String(org.w3c.dom.Node node)
Method document2String. |
java.lang.String |
node2String(org.w3c.dom.Node node,
boolean omitXmlDeclaration)
Method document2String. |
org.w3c.dom.Document |
stream2Document(java.io.InputStream is,
boolean isValidating)
Converts an InputStream containing XML into a DOM |
static java.lang.String |
stream2String(java.io.InputStream is)
Converts the InputStream into a String |
org.w3c.dom.Document |
string2Document(java.lang.String str,
boolean isValidating)
Converts a String containing XML into a DOM |
boolean |
validateXML(org.w3c.dom.Document doc)
Method validateXML. |
boolean |
validateXML(java.lang.String xml)
Method validateXML. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String COPYRIGHT
Constructor Detail |
---|
public XMLUtils() throws javax.xml.parsers.ParserConfigurationException, javax.xml.transform.TransformerConfigurationException
javax.xml.parsers.ParserConfigurationException
javax.xml.transform.TransformerConfigurationException
Method Detail |
---|
public java.util.ArrayList<java.lang.String> getSchemaStrings()
public java.util.ArrayList<java.io.InputStream> getSchemaStreams()
protected javax.xml.parsers.DocumentBuilder getDocumentBuilder(boolean isValidating) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
isValidating
- Is validation needed.
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public void loadDefaultSchemas() throws java.io.IOException
java.io.IOException
public static java.lang.String stream2String(java.io.InputStream is) throws java.io.IOException
is
- An InputStream
java.io.IOException
public void addSchema(java.io.InputStream schema) throws java.io.IOException
schema
- The InputStream containing the schema.
java.io.IOException
public void addSchemas(java.util.ArrayList<java.io.InputStream> schemaInputStreams) throws java.io.IOException
schemaInputStreams
- An array of InputStreams containing the
schemas.
java.io.IOException
public void addSchemaStrings(java.util.ArrayList<java.lang.String> schemaStrings)
schemaStrings
- The ArrayList of String schemas to add.public org.w3c.dom.Document stream2Document(java.io.InputStream is, boolean isValidating) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
is
- An InputStream containing XMLisValidating
- Whether the XML should be validated or not.
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public org.w3c.dom.Document getNewDocument(boolean isValidating, java.lang.String namespaceURI, java.lang.String qualifiedName, org.w3c.dom.DocumentType doc) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public org.w3c.dom.Document string2Document(java.lang.String str, boolean isValidating) throws javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException
str
- A String containing XMLisValidating
- Whether the XML should be validated or not.
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
public java.lang.String node2String(org.w3c.dom.Node node) throws javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
node
- The node to convert to a String.
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
public java.lang.String node2String(org.w3c.dom.Node node, boolean omitXmlDeclaration) throws javax.xml.transform.TransformerConfigurationException, javax.xml.transform.TransformerException
node
- The node to convert to a String.omitXmlDeclaration
- true
if the XML Declaration
should be omitted, false
otherwise
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
public boolean validateXML(java.lang.String xml)
xml
-
public boolean validateXML(org.w3c.dom.Document doc)
doc
- The document to validate.
public boolean compareXML(java.lang.String xml1, java.lang.String xml2)
xml1
- One XML to compare.xml2
- Another XML to compare against.
public boolean compareNode(org.w3c.dom.Node node1, org.w3c.dom.Node node2)
node1
- One node to compare.node2
- Another node to compare against.
public static java.lang.String getNodeValue(org.w3c.dom.Node node)
node
- The Node to get the value from
public static java.lang.String getLocalName(org.w3c.dom.Node node)
node
- The node to inspect
public static java.lang.String getPrefix(org.w3c.dom.Node node)
node
- The node to inspect
public static boolean isNodeMatch(org.w3c.dom.Node node, java.lang.String name, java.lang.String namespace, java.lang.String nsPrefix)
node
- Mandatory node to compare withname
- Mandatory name to compare withnamespace
- Optional namespace to compare withnsPrefix
- Optional nsPrefix to compare with
public static org.w3c.dom.Attr getAttribute(org.w3c.dom.Element element, java.lang.String attrName, java.lang.String namespace, java.lang.String nsPrefix)
element
- Mandatory element containing the attribute.attrName
- Mandatory attribute to find.namespace
- Optional namespace of the attributensPrefix
- Optional nsPrefix of the attribute.
public static java.lang.String getDeclaredNamespaces(org.w3c.dom.Element element)
element
- Mandatory element containing interested namespaces.
public static void findNodeElementsByName(org.w3c.dom.Node node, java.lang.String elementName, java.util.ArrayList<org.w3c.dom.Node> resultList)
node
- Root node to start search.elementName
- Name of element to search for.resultList
- List containing nodes which match node parameter.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |