oracle.sysman.dbTarget.db.changemgr.emo.docaccess
Class CMXMLUtils

java.lang.Object
  extended by oracle.sysman.dbTarget.db.changemgr.emo.docaccess.CMXMLUtils

public class CMXMLUtils
extends java.lang.Object


Field Summary
static java.lang.String SXML_NS_PREFIX
           
 
Constructor Summary
CMXMLUtils()
           
 
Method Summary
static oracle.xml.parser.v2.XMLNode createNode(oracle.xml.parser.v2.XMLNode baseNode, java.lang.String path, java.lang.String nodeName, java.lang.String textValue)
          Creates an ELEMENT node
static java.net.URL createURL(java.lang.String fileName)
           
static java.net.URL createURL(java.lang.String fileName, boolean useSystemResource)
           
static oracle.xml.parser.v2.XMLNode getNode(oracle.xml.parser.v2.XMLNode sn, java.lang.String xpath)
           
static org.w3c.dom.Node getPINode(org.w3c.dom.Document doc, java.lang.String xpath)
          Gets the first PI node under given XPATH expr.
static java.lang.String getRelativeTextNodeValue(oracle.xml.parser.v2.XMLNode n, java.lang.String xpath)
           
static java.net.URL getResource(javax.servlet.ServletContext context, java.lang.String path)
           
static oracle.sysman.dbTarget.db.changemgr.emo.docaccess.SXMLPrefixResolver getSXMLResolver()
           
static java.lang.String getTextNodeValue(org.w3c.dom.Document doc, java.lang.String xpath)
          This method returns text node value under an element node that's accessed from a given xpath within the Document.
static void main(java.lang.String[] args)
           
static boolean nodeExists(oracle.xml.parser.v2.XMLNode n, java.lang.String xpath)
          Returns true if a node exists at the given path.
static org.w3c.dom.Document parseXMLDocument(java.io.InputStream xmlIs)
          Parses an input xml stream into a document tree.
static org.w3c.dom.Document parseXMLDocument(java.io.InputStream xmlIs, boolean ignoreWS)
           
static org.w3c.dom.Document parseXMLDocument(java.io.Reader characterStream)
          Parses an input char stream into a document tree.
static org.w3c.dom.Document parseXMLDocument(java.io.Reader characterStream, boolean ignoreWhitespace, boolean validate)
          Parses an input char stream into a document tree.
static java.lang.String processMDXML(oracle.xml.parser.v2.XMLDocument xml, java.lang.String xslfile)
          Returns MDAPI ddl string using xml and xsl.
static java.lang.String processMDXML(oracle.xml.parser.v2.XMLDocument xml, java.lang.String xslfile, java.lang.String dbVersion)
           
static java.lang.String processMDXML(oracle.xml.parser.v2.XMLDocument xml, java.lang.String xslfile, java.lang.String dbVersion, int params)
           
static boolean removeNode(oracle.xml.parser.v2.XMLNode sn, java.lang.String xpath)
           
static org.w3c.dom.NodeList selectNodes(oracle.xml.parser.v2.XMLNode n, java.lang.String xpath)
           
static java.lang.String selectTextValue(oracle.xml.parser.v2.XMLNode n, java.lang.String xpath)
          This method returns text node value under an element node that's accessed from a given xpath starting with XMLNode n.
static java.lang.String[] selectTextValues(oracle.xml.parser.v2.XMLNode n, java.lang.String xpath)
          This method returns text node value under an element node that's accessed from a given xpath starting with XMLNode n.
static void setRelativeTextNodeValue(oracle.xml.parser.v2.XMLNode n, java.lang.String xpath, java.lang.String newValue)
           
static void setTextNodeValue(org.w3c.dom.Document doc, java.lang.String xpath, java.lang.String newValue)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SXML_NS_PREFIX

public static final java.lang.String SXML_NS_PREFIX
See Also:
Constant Field Values
Constructor Detail

CMXMLUtils

public CMXMLUtils()
Method Detail

getTextNodeValue

public static java.lang.String getTextNodeValue(org.w3c.dom.Document doc,
                                                java.lang.String xpath)
This method returns text node value under an element node that's accessed from a given xpath within the Document. Note: if there are more than 1 nodes that are accessed by the same xpath, the first one will be chosen (see oracle.xml.parser.v2.XMLDocument).

Parameters:
doc - the Document that contains parsed xml nodes
xpath - the xpath that accesses an element node

getRelativeTextNodeValue

public static java.lang.String getRelativeTextNodeValue(oracle.xml.parser.v2.XMLNode n,
                                                        java.lang.String xpath)

setTextNodeValue

public static void setTextNodeValue(org.w3c.dom.Document doc,
                                    java.lang.String xpath,
                                    java.lang.String newValue)

setRelativeTextNodeValue

public static void setRelativeTextNodeValue(oracle.xml.parser.v2.XMLNode n,
                                            java.lang.String xpath,
                                            java.lang.String newValue)

selectTextValue

public static java.lang.String selectTextValue(oracle.xml.parser.v2.XMLNode n,
                                               java.lang.String xpath)
This method returns text node value under an element node that's accessed from a given xpath starting with XMLNode n. This is used in case caller has a partial document: e.g., DocumentFragment

Parameters:
n - the xml node that contains parsed xml nodes
xpath - the xpath that accesses an element node

selectTextValues

public static java.lang.String[] selectTextValues(oracle.xml.parser.v2.XMLNode n,
                                                  java.lang.String xpath)
This method returns text node value under an element node that's accessed from a given xpath starting with XMLNode n. This is used in case caller has a partial document: e.g., DocumentFragment

Parameters:
n - the xml node that contains parsed xml nodes
xpath - the xpath that accesses an element node

selectNodes

public static org.w3c.dom.NodeList selectNodes(oracle.xml.parser.v2.XMLNode n,
                                               java.lang.String xpath)

getPINode

public static org.w3c.dom.Node getPINode(org.w3c.dom.Document doc,
                                         java.lang.String xpath)
Gets the first PI node under given XPATH expr.


nodeExists

public static boolean nodeExists(oracle.xml.parser.v2.XMLNode n,
                                 java.lang.String xpath)
Returns true if a node exists at the given path.

Parameters:
n - the xml node that contains parsed xml nodes
xpath - the xpath that accesses an element node
Returns:
true if the node exists, false otherwise

getNode

public static oracle.xml.parser.v2.XMLNode getNode(oracle.xml.parser.v2.XMLNode sn,
                                                   java.lang.String xpath)

removeNode

public static boolean removeNode(oracle.xml.parser.v2.XMLNode sn,
                                 java.lang.String xpath)

createNode

public static oracle.xml.parser.v2.XMLNode createNode(oracle.xml.parser.v2.XMLNode baseNode,
                                                      java.lang.String path,
                                                      java.lang.String nodeName,
                                                      java.lang.String textValue)
Creates an ELEMENT node

Parameters:
baseNode - The node at which the path will be based.
path - The path to the node to be created, ending with the name of the node being created. (E.g.,. if creating the PARALLEL node, path should end with PARALLEL, not its parent.) If null, the new node is created under baseNode.
nodeName - The qualified (including prefix?) name of the node to be created. If null, defaults to the last element of the path.
textValue - If non-null, a TEXT node is created under the new node, having this value.
Returns:
The created node.

parseXMLDocument

public static org.w3c.dom.Document parseXMLDocument(java.io.Reader characterStream)
                                             throws javax.xml.parsers.FactoryConfigurationError,
                                                    javax.xml.parsers.ParserConfigurationException,
                                                    org.xml.sax.SAXException,
                                                    java.io.IOException
Parses an input char stream into a document tree. Ignores whitespace in the input and does not validate the input.

Parameters:
characterStream - Reader containing XML text
Returns:
Document containing the parsed XML text
Throws:
javax.xml.parsers.FactoryConfigurationError
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

parseXMLDocument

public static org.w3c.dom.Document parseXMLDocument(java.io.Reader characterStream,
                                                    boolean ignoreWhitespace,
                                                    boolean validate)
                                             throws javax.xml.parsers.FactoryConfigurationError,
                                                    javax.xml.parsers.ParserConfigurationException,
                                                    org.xml.sax.SAXException,
                                                    java.io.IOException
Parses an input char stream into a document tree.

Parameters:
characterStream - Reader containing XML text of an XMLDocument
ignoreWhitespace - if true, ignore whitespace in the input
validate - if true, validate input
Returns:
Document containing the parsed XML text
Throws:
javax.xml.parsers.FactoryConfigurationError
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

parseXMLDocument

public static org.w3c.dom.Document parseXMLDocument(java.io.InputStream xmlIs)
Parses an input xml stream into a document tree.

Parameters:
xmlIs - xml stream

parseXMLDocument

public static org.w3c.dom.Document parseXMLDocument(java.io.InputStream xmlIs,
                                                    boolean ignoreWS)

processMDXML

public static java.lang.String processMDXML(oracle.xml.parser.v2.XMLDocument xml,
                                            java.lang.String xslfile)
                                     throws java.lang.Throwable
Returns MDAPI ddl string using xml and xsl.

Parameters:
xml - the mdapi generated xml document
xslfile - the real file path of the stylesheet
Throws:
java.lang.Throwable

processMDXML

public static java.lang.String processMDXML(oracle.xml.parser.v2.XMLDocument xml,
                                            java.lang.String xslfile,
                                            java.lang.String dbVersion)
                                     throws java.lang.Throwable
Throws:
java.lang.Throwable

processMDXML

public static java.lang.String processMDXML(oracle.xml.parser.v2.XMLDocument xml,
                                            java.lang.String xslfile,
                                            java.lang.String dbVersion,
                                            int params)
                                     throws java.lang.Throwable
Throws:
java.lang.Throwable

getResource

public static java.net.URL getResource(javax.servlet.ServletContext context,
                                       java.lang.String path)

createURL

public static java.net.URL createURL(java.lang.String fileName)

createURL

public static java.net.URL createURL(java.lang.String fileName,
                                     boolean useSystemResource)

main

public static void main(java.lang.String[] args)

getSXMLResolver

public static oracle.sysman.dbTarget.db.changemgr.emo.docaccess.SXMLPrefixResolver getSXMLResolver()