public class ParsedXMLDocument extends java.lang.Object implements NodeInfo
ParsedXMLDocumentCreator
creates instances of this class. This is
basically a DOM document. The main advantage over native DOM documents is the
possibility to query for a nodes location.Constructor and Description |
---|
ParsedXMLDocument(org.w3c.dom.Document pDocument)
Creates a new instance with the given document.
|
Modifier and Type | Method and Description |
---|---|
void |
checkElement(org.w3c.dom.Node pNode,
javax.xml.namespace.QName pQName)
Checks, whether the given element has the given name.
|
org.w3c.dom.Document |
getDocument()
Returns the document, which has been created.
|
org.xml.sax.Locator |
getLocator(org.w3c.dom.Node pNode)
Returns the given node's locator.
|
javax.xml.namespace.QName |
getMandatoryQNameAttribute(org.w3c.dom.Element pElement,
java.lang.String pAttr)
Queries the given element for a mandatory attribute.
|
java.lang.String |
getMandatoryStringAttribute(org.w3c.dom.Element pElement,
java.lang.String pAttr)
Queries the given element for a mandatory attribute.
|
javax.xml.namespace.QName |
getQName(org.w3c.dom.Node pNode,
java.lang.String pValue)
Converts the given argument into a
QName . |
boolean |
isElement(org.w3c.dom.Node pNode,
javax.xml.namespace.QName pQName)
Returns, whether the given node is an element with the given name.
|
javax.xml.namespace.QName |
newQName(org.w3c.dom.Node pNode)
Creates a new QName with the given nodes name.
|
javax.xml.namespace.QName |
newQName(java.lang.String pURI,
java.lang.String pLocalPart)
Creates a new QName with the given URI, and local part.
|
void |
registerNode(org.w3c.dom.Node pNode,
org.xml.sax.Locator pLocator,
com.softwareag.centrasite.appl.framework.parser.ParsedXMLDocument.PrefixLookup pPrefixLookup)
Registers the given nodes locator.
|
public ParsedXMLDocument(org.w3c.dom.Document pDocument)
pDocument
- The Document
instancepublic void registerNode(org.w3c.dom.Node pNode, org.xml.sax.Locator pLocator, com.softwareag.centrasite.appl.framework.parser.ParsedXMLDocument.PrefixLookup pPrefixLookup)
pNode
- The Node
instancepLocator
- The Locator
instance to register with pNodepPrefixLookup
- The PrefixLookup
instancepublic org.w3c.dom.Document getDocument()
Document
instancepublic org.xml.sax.Locator getLocator(org.w3c.dom.Node pNode)
NodeInfo
getLocator
in interface NodeInfo
pNode
- The Node
instanceLocator
for the given nodepublic javax.xml.namespace.QName getQName(org.w3c.dom.Node pNode, java.lang.String pValue)
NodeInfo
QName
.public void checkElement(org.w3c.dom.Node pNode, javax.xml.namespace.QName pQName) throws CSAppFrameworkException
pNode
- The Node
elementpQName
- The QName
for the nodeCSAppFrameworkException
- If pNode is not an element node or if isElement(Node, QName)
returns false
public boolean isElement(org.w3c.dom.Node pNode, javax.xml.namespace.QName pQName)
pNode
- The Node
elementpQName
- The QName
for the nodetrue
if the given node is an element and false
otherwisepublic javax.xml.namespace.QName newQName(org.w3c.dom.Node pNode)
pNode
- The Node
instanceQName
created with the name of the given nodepublic javax.xml.namespace.QName newQName(java.lang.String pURI, java.lang.String pLocalPart)
pURI
- The URI part of the QNamepLocalPart
- The local part of the QNameQName
instancepublic javax.xml.namespace.QName getMandatoryQNameAttribute(org.w3c.dom.Element pElement, java.lang.String pAttr) throws CSAppFrameworkException
pElement
- The Element
to querypAttr
- The attribute name which is being looked forQName
of the attributeCSAppFrameworkException
- If pAttr is not an attribute of pElement or if the QName
of pAttr cannot be constructed or becomes null
public java.lang.String getMandatoryStringAttribute(org.w3c.dom.Element pElement, java.lang.String pAttr) throws CSAppFrameworkException
pElement
- The Element
to querypAttr
- The attribute name which is being looked forCSAppFrameworkException
- If pAttr is not an attribute of pElement or if the value
of pAttr is empty