public class XMLUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
xmlSkeleton |
Constructor and Description |
---|
XMLUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addChildNodesOfParentUnderRoot(org.w3c.dom.Node parent,
org.w3c.dom.Node root)
Utility to add child nodes of parent directly under root node.
|
static org.w3c.dom.Node |
addToDocument(org.w3c.dom.Document dataDoc,
javax.xml.xpath.XPath xPath,
org.w3c.dom.Node currentNode,
java.lang.String path,
java.lang.Object value) |
static org.w3c.dom.Node |
addToDocument(org.w3c.dom.Document dataDoc,
javax.xml.xpath.XPath xPath,
org.w3c.dom.Node currentNode,
java.lang.String path,
java.lang.Object value,
org.w3c.dom.Node refNode)
This API adds a node in the document before the refNode
|
static void |
appendNodeListToNode(org.w3c.dom.Node rootNode,
org.w3c.dom.NodeList nodeList)
This API adds a nodelist to the root node.
|
static boolean |
checkIfStringHasIndexOperator(java.lang.String bindRef) |
static void |
convertRTEValXfaCmplntHTML(org.w3c.dom.Node node)
Returns the html compliant dor xml.
|
static void |
copyChildren(org.w3c.dom.Node source,
org.w3c.dom.Node target) |
static void |
createAttachmentTag(org.w3c.dom.Document document,
org.w3c.dom.Node fileComponentNode,
JSONObject jsonObject)
Create XML tag for File attachment component
|
static org.w3c.dom.Node |
createNode(org.w3c.dom.Document dataDoc,
javax.xml.xpath.XPath xPath,
org.w3c.dom.Node node,
java.lang.String path) |
static org.w3c.dom.Node |
createNode(org.w3c.dom.Document dataDoc,
javax.xml.xpath.XPath xPath,
org.w3c.dom.Node node,
java.lang.String path,
org.w3c.dom.Node refNode) |
static void |
disableExternalEntities(javax.xml.parsers.DocumentBuilderFactory factory) |
static java.lang.String |
docToStr(org.w3c.dom.Document doc)
Deprecated.
|
static java.lang.Object |
evaluateXPath(java.lang.String xPathQuery,
org.w3c.dom.Node contextNode,
javax.xml.namespace.QName type) |
static org.w3c.dom.Document |
exportDocumentFromDataRef(java.lang.String dataRef,
javax.xml.parsers.DocumentBuilder builder,
FormDataXMLProviderRegistry formDataXMLProviderRegistry,
ResourceResolverHelper resourceResolverHelper)
Deprecated.
|
static java.util.List<java.lang.String> |
extractAttachmentNames(org.w3c.dom.Document doc) |
static java.lang.String |
extractXsdRootElement(JSONObject guideJson) |
static org.w3c.dom.Element |
getBoundDataXmlElement(org.w3c.dom.Document doc)
Returns the bound part(portion bound to schema XSD/XFA) of data XML as element object
|
static java.lang.String |
getBoundDataXmlPart(org.w3c.dom.Document doc)
Returns the bound part(portion bound to schema XSD/XFA) of data XML
|
static java.lang.String |
getChildBoundRootXpath(java.lang.String fsRoot,
java.lang.String bindRefPrefix,
java.lang.String childRoot) |
static org.w3c.dom.Node |
getChildNodeByName(org.w3c.dom.Node node,
java.lang.String childName)
Utility API to get a child node by name
|
static org.w3c.dom.Document |
getChildXmlDoc(org.w3c.dom.Element fsUnBoundDataRoot,
org.w3c.dom.Element fsBoundDataRoot,
java.lang.String childBoundRootXpath,
boolean keepBoundPart) |
static java.util.Map<java.lang.String,java.lang.String> |
getDataMap(org.w3c.dom.Document document)
Returns Map of all the fields and their values
|
static java.io.InputStream |
getDataRefInputStream(java.lang.String dataRef,
FormDataXMLProviderRegistry formDataXMLProviderRegistry,
ResourceResolverHelper resourceResolverHelper)
Deprecated.
|
static java.lang.String |
getDorDataXmlPart(org.w3c.dom.Document dorDoc,
org.w3c.dom.Document doc,
java.lang.String excludeFromDorIfHidden,
boolean bSetXfaNameSpace,
JSONObject guideJson)
Returns the DOR part of data XML
Dor Part is:
a) ExcludeFromDorIfHidden Tag
b) Unbound part of guide data
c) bound part of guide data
d) afSubmissionInfo of guide data
|
static org.w3c.dom.Document |
getEmptySubmitDoc() |
static JSONObject |
getMapOfUnboundData(org.w3c.dom.Document doc)
Returns JSON representation of unbound part of Data XML
|
static java.util.List<org.w3c.dom.Node> |
getNamedChildNodes(org.w3c.dom.Node parent,
java.lang.String childNode)
Returns list of child and attribute nodes which have passed name
|
static org.w3c.dom.NodeList |
getNodeListFromXmlString(java.lang.String xmlStr)
This API converts xmlstring to node.
|
static java.lang.String |
getPrefillXmlWithoutBoundPart(org.w3c.dom.Document doc) |
static java.lang.String |
getRelativeXpath(java.lang.String bindRef,
java.lang.String root) |
static org.w3c.dom.Element |
getSignersDataXmlElement(org.w3c.dom.Document doc)
Returns the signers part of data XML as element object
|
static org.w3c.dom.Element |
getSubmissionInfoDataXmlElement(org.w3c.dom.Document doc,
java.lang.String submitInfoPart)
Returns the Submission info part of data XML as element object
The returned element must be cloned to do further modification
|
static java.lang.String |
getSubmissionInfoDataXmlPart(org.w3c.dom.Document doc,
java.lang.String submitInfoPart)
Returns the submission info part of data XML
|
static org.w3c.dom.Element |
getUnboundDataXmlElement(org.w3c.dom.Document doc)
Returns the unbound part of data XML as element object
|
static java.lang.String |
getUnboundDataXmlPart(org.w3c.dom.Document doc)
Returns the unbound part of data XML
|
static java.lang.String |
getXMLFromDom(org.w3c.dom.Document doc,
java.lang.String tagName)
Returns the XML String of the Node whose tag name is provided from a Document object
|
static java.lang.String |
getXMLfromXsdDom(org.w3c.dom.Element doc) |
static java.lang.String |
getXMLfromXsdDom(org.w3c.dom.Element doc,
java.lang.Boolean omitXmlDeclaration) |
static java.lang.String |
getXSDRootBindRef(JSONObject jsonObject,
java.lang.String xsdRoot)
Returns the normalized bindref for XSD binded field.
|
static boolean |
isValidXsdRoot(java.lang.String root) |
static boolean |
isWrappedXml(org.w3c.dom.Document doc) |
static boolean |
isWrappedXmlStr(java.lang.String docStr) |
static boolean |
isXsd(JSONObject obj) |
static java.lang.String |
nodeToStr(org.w3c.dom.Node node,
java.lang.Boolean omitXmlDeclaration)
convert node object to string.
|
static void |
removeFromDocument(javax.xml.xpath.XPath xPath,
org.w3c.dom.Node currentNode,
java.lang.String path) |
static void |
setXfaNameSpace(org.w3c.dom.Element data)
Set XFA namespace to the element object passed
|
static void |
setXmlSchemaInstanceNamespace(org.w3c.dom.Element data)
Set XML Schema Instance namespace to the element object passed
|
static org.w3c.dom.Document |
strToDoc(java.lang.String xmlStr) |
public static final java.lang.String xmlSkeleton
public static boolean checkIfStringHasIndexOperator(java.lang.String bindRef)
public static java.lang.String extractXsdRootElement(JSONObject guideJson)
public static java.lang.String getXSDRootBindRef(JSONObject jsonObject, java.lang.String xsdRoot) throws JSONException
jsonObject
- JSONException
public static java.lang.String getRelativeXpath(java.lang.String bindRef, java.lang.String root)
public static java.lang.String getXMLfromXsdDom(org.w3c.dom.Element doc)
doc
- public static java.lang.String getXMLfromXsdDom(org.w3c.dom.Element doc, java.lang.Boolean omitXmlDeclaration)
doc
- omitXmlDeclaration
- public static void addChildNodesOfParentUnderRoot(org.w3c.dom.Node parent, org.w3c.dom.Node root)
parent
- node whose child nodes are to added under root noderoot
- node under which child nodes have to be directly insertedpublic static java.lang.String getDorDataXmlPart(org.w3c.dom.Document dorDoc, org.w3c.dom.Document doc, java.lang.String excludeFromDorIfHidden, boolean bSetXfaNameSpace, JSONObject guideJson)
dorDoc
- document representing dordoc
- document representing the data xmlexcludeFromDorIfHidden
- bSetXfaNameSpace
- this is true if xdpRef is not presentguideJson
- Document
public static void convertRTEValXfaCmplntHTML(org.w3c.dom.Node node)
node
- Node node representing the dor xml.Node
public static org.w3c.dom.Element getSubmissionInfoDataXmlElement(org.w3c.dom.Document doc, java.lang.String submitInfoPart)
doc
- document representing the data xmlsubmitInfoPart
- child tag of submission info if any, null would return the submission info tag of data xmlDocument
public static java.lang.String getSubmissionInfoDataXmlPart(org.w3c.dom.Document doc, java.lang.String submitInfoPart)
doc
- document representing the data xmlsubmitInfoPart
- child tag of submission info if any, null would return the submission info tag of data xmlDocument
public static void setXfaNameSpace(org.w3c.dom.Element data)
data
- element objectpublic static void setXmlSchemaInstanceNamespace(org.w3c.dom.Element data)
data
- element objectpublic static java.lang.String getBoundDataXmlPart(org.w3c.dom.Document doc)
doc
- document representing the data xmlDocument
public static org.w3c.dom.Element getBoundDataXmlElement(org.w3c.dom.Document doc)
doc
- document representing the data xmlDocument
public static java.lang.String getUnboundDataXmlPart(org.w3c.dom.Document doc)
doc
- document representing the data xmlDocument
public static org.w3c.dom.Element getUnboundDataXmlElement(org.w3c.dom.Document doc)
doc
- document representing the data xmlDocument
public static org.w3c.dom.Element getSignersDataXmlElement(org.w3c.dom.Document doc)
doc
- document representing the data xmlDocument
public static org.w3c.dom.Node getChildNodeByName(org.w3c.dom.Node node, java.lang.String childName)
node
- node under which the given childName is to be foundchildName
- name of the child to be foundpublic static java.util.Map<java.lang.String,java.lang.String> getDataMap(org.w3c.dom.Document document)
document
- representing the data xmlpublic static JSONObject getMapOfUnboundData(org.w3c.dom.Document doc)
doc
- document representing the data xmlDocument
public static java.lang.String getPrefillXmlWithoutBoundPart(org.w3c.dom.Document doc)
public static java.lang.String getXMLFromDom(org.w3c.dom.Document doc, java.lang.String tagName)
doc
- Document Object where to search for the tag NametagName
- tag name of the XML Element whose String representation has to be returned@Deprecated public static java.io.InputStream getDataRefInputStream(java.lang.String dataRef, FormDataXMLProviderRegistry formDataXMLProviderRegistry, ResourceResolverHelper resourceResolverHelper)
dataRef
- formDataXMLProviderRegistry
- resourceResolverHelper
- java.lang.Exception
@Deprecated public static org.w3c.dom.Document exportDocumentFromDataRef(java.lang.String dataRef, javax.xml.parsers.DocumentBuilder builder, FormDataXMLProviderRegistry formDataXMLProviderRegistry, ResourceResolverHelper resourceResolverHelper) throws java.lang.Exception
dataRef,
- document builder and reference to the servicebuilder
- formDataXMLProviderRegistry
- resourceResolverHelper
- java.lang.Exception
public static org.w3c.dom.Node createNode(org.w3c.dom.Document dataDoc, javax.xml.xpath.XPath xPath, org.w3c.dom.Node node, java.lang.String path) throws javax.xml.xpath.XPathExpressionException
dataDoc
- xPath
- node
- path
- javax.xml.xpath.XPathExpressionException
public static org.w3c.dom.Node createNode(org.w3c.dom.Document dataDoc, javax.xml.xpath.XPath xPath, org.w3c.dom.Node node, java.lang.String path, org.w3c.dom.Node refNode) throws javax.xml.xpath.XPathExpressionException
dataDoc
- xPath
- node
- path
- refNode
- javax.xml.xpath.XPathExpressionException
public static void removeFromDocument(javax.xml.xpath.XPath xPath, org.w3c.dom.Node currentNode, java.lang.String path)
xPath
- currentNode
- path
- public static void createAttachmentTag(org.w3c.dom.Document document, org.w3c.dom.Node fileComponentNode, JSONObject jsonObject)
document
- fileComponentNode
- jsonObject
- public static org.w3c.dom.Node addToDocument(org.w3c.dom.Document dataDoc, javax.xml.xpath.XPath xPath, org.w3c.dom.Node currentNode, java.lang.String path, java.lang.Object value)
dataDoc
- xPath
- currentNode
- path
- value
- public static org.w3c.dom.Node addToDocument(org.w3c.dom.Document dataDoc, javax.xml.xpath.XPath xPath, org.w3c.dom.Node currentNode, java.lang.String path, java.lang.Object value, org.w3c.dom.Node refNode)
dataDoc
- xPath
- currentNode
- path
- value
- refNode
- reference node with respect to which the new node is to be insertedpublic static boolean isXsd(JSONObject obj)
public static boolean isWrappedXml(org.w3c.dom.Document doc)
public static boolean isWrappedXmlStr(java.lang.String docStr)
public static boolean isValidXsdRoot(java.lang.String root)
public static org.w3c.dom.Document getEmptySubmitDoc()
public static java.lang.String getChildBoundRootXpath(java.lang.String fsRoot, java.lang.String bindRefPrefix, java.lang.String childRoot)
public static java.util.List<org.w3c.dom.Node> getNamedChildNodes(org.w3c.dom.Node parent, java.lang.String childNode)
parent
- node whose children and attributes are searchedchildNode
- name of child to be returnedpublic static java.lang.Object evaluateXPath(java.lang.String xPathQuery, org.w3c.dom.Node contextNode, javax.xml.namespace.QName type)
public static void copyChildren(org.w3c.dom.Node source, org.w3c.dom.Node target)
public static org.w3c.dom.Document getChildXmlDoc(org.w3c.dom.Element fsUnBoundDataRoot, org.w3c.dom.Element fsBoundDataRoot, java.lang.String childBoundRootXpath, boolean keepBoundPart)
public static java.lang.String nodeToStr(org.w3c.dom.Node node, java.lang.Boolean omitXmlDeclaration)
node
- Node to be converted to string.omitXmlDeclaration
- Boolean to check if xml declaration tag should be there in converted string or not.java.lang.Exception
@Deprecated public static java.lang.String docToStr(org.w3c.dom.Document doc)
nodeToStr
doc
- Document to be converted to string.java.lang.Exception
public static org.w3c.dom.NodeList getNodeListFromXmlString(java.lang.String xmlStr)
xmlStr
- String xml String which needs to be converted to nodeList.public static void appendNodeListToNode(org.w3c.dom.Node rootNode, org.w3c.dom.NodeList nodeList)
rootNode
- Node root node to which the nodelist needs to be appended.nodeList
- NodeList created converting xml string.public static org.w3c.dom.Document strToDoc(java.lang.String xmlStr)
public static java.util.List<java.lang.String> extractAttachmentNames(org.w3c.dom.Document doc)
public static void disableExternalEntities(javax.xml.parsers.DocumentBuilderFactory factory)
Copyright © 2010 - 2020 Adobe. All Rights Reserved