Oracle Fusion Middleware extensions for XML based Datamodel Framework
11g Release 1 (11.1.1.5)

E22566-01

oracle.apps.fnd.applxdf.comp
Class XMLUtil

java.lang.Object
  extended by oracle.apps.fnd.applxdf.comp.XMLUtil

public class XMLUtil
extends java.lang.Object

XML related utility class

Author:
Guoqiang Su <Guoqiang.Su@oracle.com>, izhang <irene.zhang@oracle.com>

Constructor Summary
XMLUtil()
          Constructor.
 
Method Summary
static oracle.xml.parser.v2.XMLDocument CLOBToXMLDocument(oracle.sql.CLOB theClob)
          Convert CLOB to XMLDocument.
static java.net.URL createURL(java.lang.String fileName)
          Create the URL for the file.
static void getConsUDPMap(oracle.xml.parser.v2.XMLElement xmlDoc, java.lang.String szConsTag, java.lang.String szUDPName, java.util.HashMap oMap)
          Retrieve a specific UDP from a given constraint type.
static oracle.xml.parser.v2.XMLDocument getDocument(java.net.URL url)
          Get the XML document from the input file URL.
static oracle.xml.parser.v2.DOMParser getDOMParser()
          Return the DOM parser.
static oracle.xml.parser.v2.XMLElement getFirstElementFromNodeList(org.w3c.dom.NodeList tempList)
          Get the first XML element from the node list.
static org.w3c.dom.Node getNode(org.w3c.dom.Node root, java.lang.String path)
          Utility method that parses the document 'doc' based on the given 'path' and returns the matching node object Returns null if no such node is found.
static java.lang.String getODBProp(oracle.xml.parser.v2.XMLElement customElm, java.lang.String szPropertyName)
          Get ODB property for given a custom area element and a property name.
static void getPartitionNames(oracle.xml.parser.v2.XMLElement xmlElm, java.util.HashMap oMap)
          Retrieve all partition names from table file.
static oracle.xml.parser.v2.XMLElement getTabColItem(oracle.xml.parser.v2.XMLElement xmlDoc, java.lang.String szColName)
          Retrieve a given column name's col list item in the table file.
static java.lang.String getTagNameValue(oracle.xml.parser.v2.XMLElement doc, java.lang.String tagName)
          Get the vlaue for the specific tag in the XML element.
static java.lang.String getUDP(oracle.xml.parser.v2.XMLElement customElm, java.lang.String szPropertyName)
          Get UDP for a given custom area element and property name.
static void insertNode(oracle.xml.parser.v2.XMLDocument xmlDoc, org.w3c.dom.Node parent, java.lang.String nodeName, java.lang.String text)
          Inserts a node with the specified name and text value, to the parent node.
static boolean isIOT(oracle.xml.parser.v2.XMLElement tableElm)
           
static void modifyConsNode(oracle.xml.parser.v2.XMLDocument xmlDoc, java.lang.String szTag, oracle.xml.parser.v2.XMLElement xmlElm, java.util.HashMap isLogicalMap)
          Modifie a constrant node to add tags 'rely', 'disable' and 'novalidate' if the constraint node with isLogical UDP value of "Y".
static void modifyConsNodes(oracle.xml.parser.v2.XMLDocument xmlDoc, oracle.xml.parser.v2.XMLElement xmlElm, java.util.HashMap isLogicalMap)
          Modifie constraint nodes(PK, UK, CK, FK) to add tags 'rely', 'disable' and 'novalidate' if the constraint nodes with isLogical UDP value of "Y".
protected static void outputClob(oracle.sql.CLOB clob, java.lang.String comment)
          Debug helper method to display the contents of the CLOB type data.
protected static void outputXML(oracle.xml.parser.v2.XMLDocumentFragment xmlDocFrgmt, java.lang.String comment)
          Debug helper method to display the contents of the XMLDocumentFragment.
protected static void outputXML(oracle.xml.parser.v2.XMLDocument xmlDocument, java.lang.String comment)
          Debug helper method to display the contents of the XMLDocument.
static void outputXML(oracle.xml.parser.v2.XMLElement xmlElm, java.lang.String comment)
          Debug helper method to display the contents of the XMLElement.
static oracle.xml.parser.v2.XMLElement retrieveConsCustomArea(oracle.xml.parser.v2.XMLElement xmlDoc, java.lang.String szConsType, java.lang.String szConsName)
          Retrieve Constraint Custom Area Element in the object level sxml and given the constraint type and name.
static oracle.xml.parser.v2.XMLElement retrieveConsListItem(oracle.xml.parser.v2.XMLElement xmlDoc, java.lang.String szConsType, java.lang.String szConsName)
          Retrieve Constraint List item by given the constraint type and name.
static oracle.xml.parser.v2.XMLElement retrieveIdxCustomArea(oracle.xml.parser.v2.XMLElement idxElm)
           
static oracle.xml.parser.v2.XMLElement retrieveObjectCustomArea(oracle.xml.parser.v2.XMLElement xmlDoc)
          Retrieve Object Custom Area Element in the given object xml element.
static oracle.xml.parser.v2.XMLElement retrieveRelationalNode(oracle.xml.parser.v2.XMLElement xmlDoc)
           
static oracle.xml.parser.v2.XMLElement retrieveTabColCustomArea(oracle.xml.parser.v2.XMLElement xmlDoc, java.lang.String szColName)
          Retrieve table columns' Custom Area in a given sxml and the column name.
static void setLoggerAndParameter(XDFLogger theLogger, Parameters theParam)
          Set the logger and parameters instances to this class.
static oracle.xml.parser.v2.XMLDocumentFragment transformXML(oracle.xml.parser.v2.XMLDocumentFragment xmlDocFragment, java.lang.String xslFile, java.util.Hashtable inParms)
          Transform the XML document using the XSL file and pass-in parameters.
static oracle.xml.parser.v2.XMLDocumentFragment transformXML(oracle.xml.parser.v2.XMLDocument xmlDoc, java.lang.String xslFile, java.util.Hashtable inParameters)
          Transform the XML document using the XSL file and pass-in parameters.
static oracle.xml.parser.v2.XMLDocumentFragment transformXML(oracle.xml.parser.v2.XMLElement xmlElm, java.lang.String xslFile, java.util.Hashtable inParameters)
          Transform the XML document using the XSL file and pass-in parameters.
static oracle.sql.CLOB XMLDocumentFragmentToCLOB(oracle.xml.parser.v2.XMLDocumentFragment xmlDocFrgmt)
          Convert XMLDocumentFragment to CLOB.
static oracle.sql.CLOB XMLElementToCLOB(oracle.xml.parser.v2.XMLElement xmlElm)
          Convert XMLElement to CLOB.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLUtil

public XMLUtil()
Constructor.

Method Detail

getDOMParser

public static oracle.xml.parser.v2.DOMParser getDOMParser()
Return the DOM parser.

Returns:
DOM Parser

setLoggerAndParameter

public static void setLoggerAndParameter(XDFLogger theLogger,
                                         Parameters theParam)
Set the logger and parameters instances to this class.

Parameters:
theLogger - logger
theParam - Parameters

createURL

public static java.net.URL createURL(java.lang.String fileName)
                              throws java.net.MalformedURLException
Create the URL for the file.

Parameters:
fileName - XML file name
Returns:
URL for the file
Throws:
java.net.MalformedURLException - when the file URL is malformed.

getDocument

public static oracle.xml.parser.v2.XMLDocument getDocument(java.net.URL url)
                                                    throws java.lang.Exception
Get the XML document from the input file URL.

Parameters:
url - input file URL
Returns:
XML document
Throws:
java.lang.Exception - when getting the document.

CLOBToXMLDocument

public static oracle.xml.parser.v2.XMLDocument CLOBToXMLDocument(oracle.sql.CLOB theClob)
                                                          throws java.lang.Exception
Convert CLOB to XMLDocument.

Parameters:
theClob - CLOB to be converted
Returns:
XML document converted from CLOB
Throws:
java.lang.Exception - when transforming the CLOB to xml doc.

transformXML

public static oracle.xml.parser.v2.XMLDocumentFragment transformXML(oracle.xml.parser.v2.XMLDocument xmlDoc,
                                                                    java.lang.String xslFile,
                                                                    java.util.Hashtable inParameters)
Transform the XML document using the XSL file and pass-in parameters.

Parameters:
xmlDoc - XML document to be transformed
xslFile - XSL file
inParameters - parameters used in the XML tranformation by XSL file
Returns:
transformed XMLDocumentFragment

transformXML

public static oracle.xml.parser.v2.XMLDocumentFragment transformXML(oracle.xml.parser.v2.XMLElement xmlElm,
                                                                    java.lang.String xslFile,
                                                                    java.util.Hashtable inParameters)
Transform the XML document using the XSL file and pass-in parameters.

Parameters:
xmlElm - XML element to be transformed
xslFile - XSL file
inParameters - parameters used in the XML tranformation by XSL file
Returns:
transformed XMLDocumentFragment

transformXML

public static oracle.xml.parser.v2.XMLDocumentFragment transformXML(oracle.xml.parser.v2.XMLDocumentFragment xmlDocFragment,
                                                                    java.lang.String xslFile,
                                                                    java.util.Hashtable inParms)
Transform the XML document using the XSL file and pass-in parameters.

Parameters:
xmlDocFragment - XML document fragment to be transformed
xslFile - XSL file
inParms - parameters used in the XML tranformation by XSL file
Returns:
transformed XMLDocumentFragment

getTagNameValue

public static java.lang.String getTagNameValue(oracle.xml.parser.v2.XMLElement doc,
                                               java.lang.String tagName)
Get the vlaue for the specific tag in the XML element.

Parameters:
doc - XML element
tagName - tag name to get the value
Returns:
value for the tag name

getFirstElementFromNodeList

public static oracle.xml.parser.v2.XMLElement getFirstElementFromNodeList(org.w3c.dom.NodeList tempList)
Get the first XML element from the node list.

Parameters:
tempList - the node list
Returns:
the first elment in the node list

getNode

public static org.w3c.dom.Node getNode(org.w3c.dom.Node root,
                                       java.lang.String path)
Utility method that parses the document 'doc' based on the given 'path' and returns the matching node object Returns null if no such node is found. The 'path' is in the format of root-node/child-node/sub-child-node/..etc.


outputClob

protected static void outputClob(oracle.sql.CLOB clob,
                                 java.lang.String comment)
Debug helper method to display the contents of the CLOB type data.

Parameters:
clob - CLOB to be ouputed
comment - comment put before the whole output

outputXML

protected static void outputXML(oracle.xml.parser.v2.XMLDocument xmlDocument,
                                java.lang.String comment)
Debug helper method to display the contents of the XMLDocument.

Parameters:
xmlDocument - XMLDocument to be ouputed
comment - comment put before the whole output

outputXML

protected static void outputXML(oracle.xml.parser.v2.XMLDocumentFragment xmlDocFrgmt,
                                java.lang.String comment)
Debug helper method to display the contents of the XMLDocumentFragment.

Parameters:
xmlDocFrgmt - XMLDocumentFragment to be ouputed
comment - comment put before the whole output

outputXML

public static void outputXML(oracle.xml.parser.v2.XMLElement xmlElm,
                             java.lang.String comment)
Debug helper method to display the contents of the XMLElement.

Parameters:
xmlElm - XMLElement to be ouputed
comment - comment put before the whole output

XMLDocumentFragmentToCLOB

public static oracle.sql.CLOB XMLDocumentFragmentToCLOB(oracle.xml.parser.v2.XMLDocumentFragment xmlDocFrgmt)
Convert XMLDocumentFragment to CLOB.

Parameters:
xmlDocFrgmt - XMLDocumentFragment to be converted
Returns:
CLOB converted from the XMLDocumentFragment

XMLElementToCLOB

public static oracle.sql.CLOB XMLElementToCLOB(oracle.xml.parser.v2.XMLElement xmlElm)
Convert XMLElement to CLOB.

Parameters:
xmlElm - XMLElement to be converted
Returns:
CLOB converted from the XMLElement

getUDP

public static java.lang.String getUDP(oracle.xml.parser.v2.XMLElement customElm,
                                      java.lang.String szPropertyName)
Get UDP for a given custom area element and property name.

Parameters:
customElm - - xml element
szPropertyName -
Returns:
String

getODBProp

public static java.lang.String getODBProp(oracle.xml.parser.v2.XMLElement customElm,
                                          java.lang.String szPropertyName)
Get ODB property for given a custom area element and a property name.

Parameters:
customElm -
szPropertyName -
Returns:
String

retrieveObjectCustomArea

public static oracle.xml.parser.v2.XMLElement retrieveObjectCustomArea(oracle.xml.parser.v2.XMLElement xmlDoc)
Retrieve Object Custom Area Element in the given object xml element.

Parameters:
xmlDoc - - xml element
Returns:
XMLElement

retrieveConsCustomArea

public static oracle.xml.parser.v2.XMLElement retrieveConsCustomArea(oracle.xml.parser.v2.XMLElement xmlDoc,
                                                                     java.lang.String szConsType,
                                                                     java.lang.String szConsName)
Retrieve Constraint Custom Area Element in the object level sxml and given the constraint type and name.

Parameters:
xmlDoc - - xml element
szConsType - - constraint type
szConsName - - constraint name
Returns:
XMLElement

retrieveTabColCustomArea

public static oracle.xml.parser.v2.XMLElement retrieveTabColCustomArea(oracle.xml.parser.v2.XMLElement xmlDoc,
                                                                       java.lang.String szColName)
Retrieve table columns' Custom Area in a given sxml and the column name.

Parameters:
xmlDoc - - xml element
szColName - - column name
Returns:
XMLElement

getConsUDPMap

public static void getConsUDPMap(oracle.xml.parser.v2.XMLElement xmlDoc,
                                 java.lang.String szConsTag,
                                 java.lang.String szUDPName,
                                 java.util.HashMap oMap)
Retrieve a specific UDP from a given constraint type.

Parameters:
xmlDoc - - xml element
szConsTag - - constraint tag name
szUDPName - - constraint property name
oMap - - map contains constraint name and status values

retrieveIdxCustomArea

public static oracle.xml.parser.v2.XMLElement retrieveIdxCustomArea(oracle.xml.parser.v2.XMLElement idxElm)

retrieveRelationalNode

public static oracle.xml.parser.v2.XMLElement retrieveRelationalNode(oracle.xml.parser.v2.XMLElement xmlDoc)

modifyConsNodes

public static void modifyConsNodes(oracle.xml.parser.v2.XMLDocument xmlDoc,
                                   oracle.xml.parser.v2.XMLElement xmlElm,
                                   java.util.HashMap isLogicalMap)
Modifie constraint nodes(PK, UK, CK, FK) to add tags 'rely', 'disable' and 'novalidate' if the constraint nodes with isLogical UDP value of "Y".

Parameters:
xmlElm - - the xml element
isLogicalMap - - isLogical Map

modifyConsNode

public static void modifyConsNode(oracle.xml.parser.v2.XMLDocument xmlDoc,
                                  java.lang.String szTag,
                                  oracle.xml.parser.v2.XMLElement xmlElm,
                                  java.util.HashMap isLogicalMap)
Modifie a constrant node to add tags 'rely', 'disable' and 'novalidate' if the constraint node with isLogical UDP value of "Y".

Parameters:
xmlElm - - the xml element
isLogicalMap - - isLogical Map

insertNode

public static void insertNode(oracle.xml.parser.v2.XMLDocument xmlDoc,
                              org.w3c.dom.Node parent,
                              java.lang.String nodeName,
                              java.lang.String text)
Inserts a node with the specified name and text value, to the parent node.

Parameters:
xmlDoc - The Document element
parent - The parent node.
nodeName - The desired name for the node.
text - Any text value for the node.

isIOT

public static boolean isIOT(oracle.xml.parser.v2.XMLElement tableElm)

getTabColItem

public static oracle.xml.parser.v2.XMLElement getTabColItem(oracle.xml.parser.v2.XMLElement xmlDoc,
                                                            java.lang.String szColName)
Retrieve a given column name's col list item in the table file.

Parameters:
xmlDoc - - The table element.
szColName - - the name of the column

retrieveConsListItem

public static oracle.xml.parser.v2.XMLElement retrieveConsListItem(oracle.xml.parser.v2.XMLElement xmlDoc,
                                                                   java.lang.String szConsType,
                                                                   java.lang.String szConsName)
Retrieve Constraint List item by given the constraint type and name.

Parameters:
xmlDoc - - xml element
szConsType - - constraint type
szConsName - - constraint name
Returns:
XMLElement

getPartitionNames

public static void getPartitionNames(oracle.xml.parser.v2.XMLElement xmlElm,
                                     java.util.HashMap oMap)
Retrieve all partition names from table file.

Parameters:
xmlDoc - - xml element
oMap - - map contains partition names

Oracle Fusion Middleware extensions for XML based Datamodel Framework
11g Release 1 (11.1.1.5)

E22566-01

Copyright © 2011 Oracle. All Rights Reserved.