Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
log |
protected DocumentXMLImpl |
m_doc |
Constructor and Description |
---|
XMLDoc()
constructor
|
XMLDoc(Document document)
constructor
|
XMLDoc(DocumentXMLImpl document)
constructor
|
XMLDoc(String strDocType)
Deprecated.
use XMLDoc(String strDocType, String namespaceURI)
|
XMLDoc(String strDocType,
String namespaceURI)
constructor
|
XMLDoc(XMLDoc other)
constructor
|
Modifier and Type | Method and Description |
---|---|
Node |
appendChild(Node newChild)
append a new child node to 'this'
|
XMLDoc |
clone()
clone the document, completely severing all connections to the original document
|
Node |
cloneNode(boolean deep)
get a copy of 'this'
|
void |
copyMeta(XMLDoc dMine)
copy metadata from other document
|
Attr |
createAttribute(String name)
createAttribute in namespace JDFCoreConstants.NONAMESPACE (DOM Level 2)
|
Attr |
createAttributeNS(String namespaceURI,
String qualifiedName)
create an attribute withe the given name in the given namespace
|
CDATASection |
createCDATASection(String data)
create a CDATA section, which has this document as ownerDoc
|
Comment |
createComment(String data)
createComment
|
DocumentFragment |
createDocumentFragment()
createDocumentFragment
|
DocumentType |
createDocumentType(String qualifiedName,
String publicID,
String systemID)
createDocumentType
|
Element |
createElement(String elementName)
createElement create a JDFElement that floats in nirvana.
|
org.apache.xerces.dom.ElementDefinitionImpl |
createElementDefinition(String name)
creates an element definition.
|
Element |
createElementNS(String namespaceURI,
String qualifiedName)
create a Element that floats in nirvana, this must be appended to a node with appendChild
|
Entity |
createEntity(String name)
create an entity
|
EntityReference |
createEntityReference(String name)
creates an EntityReference
|
Event |
createEvent(String type)
create an Event object
|
org.w3c.dom.traversal.NodeIterator |
createNodeIterator(Node root,
int whatToShow,
org.w3c.dom.traversal.NodeFilter filter,
boolean entityReferenceExpansion)
createNodeIterator
|
org.w3c.dom.traversal.NodeIterator |
createNodeIterator(Node root,
short whatToShow,
org.w3c.dom.traversal.NodeFilter filter)
create a node iterator
|
Notation |
createNotation(String name)
creates a Notation having this Document as its OwnerDoc
|
ProcessingInstruction |
createProcessingInstruction(String target,
String data)
creates a ProcessingInstruction having this Document as ownerDoc
|
org.w3c.dom.ranges.Range |
createRange()
createRange
|
protected XMLDoc |
createRoot(Document document) |
Text |
createTextNode(String data)
createTextNode
|
org.w3c.dom.traversal.TreeWalker |
createTreeWalker(Node root,
int whatToShow,
org.w3c.dom.traversal.NodeFilter filter,
boolean entityReferenceExpansion)
creates a TreeWalker
|
org.w3c.dom.traversal.TreeWalker |
createTreeWalker(Node root,
short whatToShow,
org.w3c.dom.traversal.NodeFilter filter)
creates a TreeWalker
|
boolean |
equals(Object o) |
protected boolean |
flush()
Method Flush
clean the m_doc and restart from scratch. |
NamedNodeMap |
getAttributes()
get the attributes associated with this node
|
javax.mail.BodyPart |
getBodyPart()
get the Javax.Mail.BodyPart
|
protected Node |
getChildNode(int nodeType,
int iPos)
gets the n'th child node of nodetype
nodeType with n = iPos |
NodeList |
getChildNodes()
get the child nodes of this node
|
long |
getDocMemoryUsed()
rough guestimate of the memory used by this if called after parsing
|
DocumentType |
getDoctype()
getDoctype
|
Element |
getDocumentElement()
getDocumentElement
|
Element |
getElementById(String elementId)
get element with ID = elementId similar to Docoment.getElementByID but works with non schema parsed documents
|
NodeList |
getElementsByTagName(String tagname)
return a NodeList of all elements having the specified tagname
|
NodeList |
getElementsByTagNameNS(String namespaceURI,
String myLocalName)
get a NodeList of all elements with a given name and namespace URI
|
boolean |
getErrorChecking()
does the DOM implementation perform error checking upon operations?
|
Node |
getFirstChild()
get the first child node of 'this'
|
Element |
getIdentifier(String idName)
gets the element with the registered name = "idName"
|
Enumeration<?> |
getIdentifiers()
gets the registered identifiers
|
protected DocumentXMLImpl |
getImpl() |
DOMImplementation |
getImplementation()
getImplementation
|
Node |
getLastChild()
get the last child node of 'this'
|
String |
getLocalName()
get the the local part of the qualified name of 'this'
|
DocumentXMLImpl |
getMemberDocument()
getMemberDocument
|
javax.mail.Multipart |
getMultiPart()
get the Javax.Mail.Multipart
|
Node |
getNextSibling()
get the next sibling of 'this'
|
Node |
getNode(short type,
int skip,
String nodeName) |
String |
getNodeName()
gets the node name
|
short |
getNodeType()
get node type
|
String |
getNodeValue()
gets the node value
|
String |
getOriginalFileName() |
Node |
getParentNode()
get the parent node of 'this' node
|
String |
getPrefix()
get the namespace prefix of 'this' node
|
Node |
getPreviousSibling()
get the previous sibling of 'this'
|
ProcessingInstruction |
getProcessingInstruction(int skip,
String name) |
KElement |
getRoot()
get the root of the dom tree
|
String |
getSchemaLocation(String nsURI) |
File |
getSchemaLocationFile(String nsURI) |
String |
getXMLComment()
gets of 'this' the text of the i-th child XMLComment.
|
protected XMLParser |
getXMLParser() |
String |
getXSLTURL()
gets the url for an xslt stylesheet
e
|
ZipReader |
getZipReader()
get the ZipReader
|
boolean |
hasAttributes()
check if 'this' has attributes
|
boolean |
hasChildNodes()
test if 'this' has any children
|
int |
hashCode() |
Node |
importNode(Node importedNode,
boolean deep)
copy a node from another document in this document
|
Node |
insertBefore(Node newChild,
Node refChild)
insert a new node before a given node
|
boolean |
isNull()
check whether the underlying document is null
|
boolean |
isSupported(String feature,
String version)
test whether a specific DOMImplelementation feature is supported by 'this'
|
void |
normalize()
normalize
|
static XMLDoc |
parseFile(File file)
parse an XML file
|
static XMLDoc |
parseFile(String fileName)
parse an XML file
|
static XMLDoc |
parseStream(InputStream is)
parse a JDF input stream
|
static XMLDoc |
parseString(String string)
parse an XML file
|
static XMLDoc |
parseURL(String url,
javax.mail.BodyPart bp)
parse a given url
|
protected void |
pushParser(XMLParser xmlParser) |
void |
putIdentifier(String idName,
Element element)
Registers an identifier name with a specified element node
|
Node |
removeChild(Node oldChild)
remove a child from 'this'
|
void |
removeIdentifier(String idName)
remove element with identifier "idName"
|
Node |
replaceChild(Node newChild,
Node oldChild)
replace a child node with a new one
|
void |
setBodyPart(javax.mail.BodyPart bodyPart)
set the Javax.Mail.BodyPart
|
void |
setErrorChecking(boolean check)
sets whether the DOM implementation performs error checking upon operations
|
protected void |
setMemberDoc(DocumentXMLImpl myDoc) |
void |
setNodeValue(String nodeValue)
set the node value
|
void |
setNSMap(XMLDoc other)
set the namespace map from another document
|
void |
setOriginalFileName(String originalFileName) |
void |
setPrefix(String prefix)
set the namespace prefix of 'this' node
|
KElement |
setRoot(String strDocType,
String namespaceURI)
initialize a new root of strDocType in the document called by constructor XMLDoc(String strDocType)
|
void |
setSchemaLocation(String nsURI,
File _schemaLocation)
set xs:schemalocation to
|
void |
setValidationResult(XMLDoc validationResult) |
void |
setXPathValues(JDFAttributeMap valueMap)
set the xpath values of thei to the values in the node
|
void |
setXSLTURL(String url)
sets the processing instruction for an xslt stylesheet
|
void |
setZipReader(ZipReader zip)
set the ZipReader
|
String |
toString()
toString
|
String |
toXML()
toXML
|
boolean |
write2File(File file,
int indent,
boolean bPreserveSpace)
write2File - write to a file; Create if it doesn't exist
|
boolean |
write2File(String oFilePath,
int indent)
Deprecated.
060419 use write2File(oFilePath, indent, true);
|
boolean |
write2File(String oFilePath,
int indent,
boolean bPreserveSpace)
write2File - write to a file; Create if it doesn't exist always assume utf-8 encoding
|
UrlPart |
write2HttpURL(URL url,
String strContentType,
UrlUtil.HTTPDetails det) |
HttpURLConnection |
write2HTTPURL(URL url,
String strContentType,
UrlUtil.HTTPDetails det) |
void |
write2Stream(OutputStream outStream,
int indent)
Deprecated.
use write2Stream(outStream, indent, true);
|
void |
write2Stream(OutputStream outStream,
int indent,
boolean bPreserveSpace)
write this to a stream
|
static void |
write2StreamStatic(Element elem,
OutputStream outStream,
int indent)
Deprecated.
060306
|
static void |
write2StreamStatic(Element elem,
OutputStream outStream,
int indent,
boolean bPreserveSpace)
Deprecated.
060306
|
String |
write2String(int indent)
write2String - write to a string;
|
XMLDoc |
write2URL(String strURL,
String strContentType)
This method sends the contents of this XMLDoc to the URL
strURL and receives the response in the returned XMLDoc. |
protected DocumentXMLImpl m_doc
protected final org.apache.commons.logging.Log log
public XMLDoc()
public XMLDoc(Document document)
document
- public XMLDoc(DocumentXMLImpl document)
document
- public XMLDoc(XMLDoc other)
other
- @Deprecated public XMLDoc(String strDocType)
strDocType
- ElementName.JDF, ElementName.JMF, "Config" ...public boolean equals(Object o)
equals
in class Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Object
Object.hashCode()
protected DocumentXMLImpl getImpl()
public KElement setRoot(String strDocType, String namespaceURI)
strDocType
- qualified tag name of the doc root to create if still emptynamespaceURI
- namespace URI of the doc rootpublic DocumentXMLImpl getMemberDocument()
protected boolean flush()
public KElement getRoot()
public String write2String(int indent)
indent
- the indentation of the xml@Deprecated public boolean write2File(String oFilePath, int indent)
oFilePath
- indent
- public boolean write2File(String oFilePath, int indent, boolean bPreserveSpace)
oFilePath
- where to write the fileindent
- indentationbPreserveSpace
- if true, preserve whitespacepublic boolean write2File(File file, int indent, boolean bPreserveSpace)
file
- the file to write toindent
- indentationbPreserveSpace
- if true, preserve whitespace@Deprecated public void write2Stream(OutputStream outStream, int indent) throws IOException
outStream
- indent
- IOException
public void write2Stream(OutputStream outStream, int indent, boolean bPreserveSpace) throws IOException
outStream
- indent
- bPreserveSpace
- IOException
@Deprecated public static void write2StreamStatic(Element elem, OutputStream outStream, int indent) throws IOException
elem
- outStream
- indent
- IOException
@Deprecated public static void write2StreamStatic(Element elem, OutputStream outStream, int indent, boolean bPreserveSpace) throws IOException
elem
- outStream
- indent
- bPreserveSpace
- IOException
public DocumentType getDoctype()
public DOMImplementation getImplementation()
public Element getDocumentElement()
public Element createElement(String elementName)
elementName
- name of the element that is createdpublic DocumentFragment createDocumentFragment()
public Text createTextNode(String data)
data
- public Comment createComment(String data)
data
- public CDATASection createCDATASection(String data)
data
- content of the CDATApublic void setXSLTURL(String url)
url
- the url of the xslt filepublic String getXSLTURL()
public void setXPathValues(JDFAttributeMap valueMap)
valueMap
- the map of values, if this is still null, MUST be fully qualifiedpublic ProcessingInstruction createProcessingInstruction(String target, String data)
target
- the target "processor channel"data
- parameter string to be passed to the targetpublic ProcessingInstruction getProcessingInstruction(int skip, String name)
skip
- name
- public Node getNode(short type, int skip, String nodeName)
type
- the node type see Document
skip
- the number onodes to skippublic Attr createAttribute(String name)
name
- attribute namepublic EntityReference createEntityReference(String name)
name
- name of the entity to refer topublic NodeList getElementsByTagName(String tagname)
tagname
- tag name of the elements to find (JDFCoreConstants.star for all elements)public Node importNode(Node importedNode, boolean deep)
importedNode
- node to importdeep
- if true: recurse and import the subtree under the node as wellpublic Element createElementNS(String namespaceURI, String qualifiedName)
namespaceURI
- the namespace uri of the created elementqualifiedName
- name of the element that is createdpublic Attr createAttributeNS(String namespaceURI, String qualifiedName)
namespaceURI
- namespace URI of the attributequalifiedName
- qualified name of the attributepublic NodeList getElementsByTagNameNS(String namespaceURI, String myLocalName)
namespaceURI
- the namespace URI to look formyLocalName
- the element name to look forpublic Element getElementById(String elementId)
elementId
- the element ID to look forpublic String getNodeName()
public String getNodeValue()
public void setNodeValue(String nodeValue)
nodeValue
- value to set the node topublic void setNSMap(XMLDoc other)
other
- value to set the node topublic short getNodeType()
public Node getParentNode()
public NodeList getChildNodes()
public Node getFirstChild()
public Node getLastChild()
public Node getPreviousSibling()
public Node getNextSibling()
public NamedNodeMap getAttributes()
public Node insertBefore(Node newChild, Node refChild)
newChild
- the new child node to insertrefChild
- the ref child node, the new node is inserted before itpublic Node replaceChild(Node newChild, Node oldChild)
newChild
- the new child node to addoldChild
- the old child node to be replacedpublic Node removeChild(Node oldChild)
oldChild
- the child node to be removedpublic Node appendChild(Node newChild)
newChild
- new child node to addpublic boolean hasChildNodes()
public Node cloneNode(boolean deep)
deep
- true: copy children as wellpublic void normalize()
public boolean isSupported(String feature, String version)
feature
- package name of the feature to testversion
- version number of the package name to testpublic String getPrefix()
public void setPrefix(String prefix)
prefix
- namespace prefixpublic String getLocalName()
public boolean isNull()
public boolean hasAttributes()
public DocumentType createDocumentType(String qualifiedName, String publicID, String systemID)
qualifiedName
- publicID
- systemID
- public void setErrorChecking(boolean check)
check
- true - enable error checkingpublic boolean getErrorChecking()
public Entity createEntity(String name)
name
- name of the entitypublic Notation createNotation(String name)
name
- name of the notationpublic org.apache.xerces.dom.ElementDefinitionImpl createElementDefinition(String name)
name
- public void putIdentifier(String idName, Element element)
idName
- element
- public Element getIdentifier(String idName)
idName
- name of the element to getpublic void removeIdentifier(String idName)
idName
- public Enumeration<?> getIdentifiers()
public org.w3c.dom.traversal.NodeIterator createNodeIterator(Node root, short whatToShow, org.w3c.dom.traversal.NodeFilter filter)
root
- the root of the iteratorwhatToShow
- the whatToShow maskfilter
- the node filter (null = no filter)public org.w3c.dom.traversal.NodeIterator createNodeIterator(Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean entityReferenceExpansion)
root
- the root of the iteratorwhatToShow
- the whatToShow maskfilter
- the node filter (null = no filter)entityReferenceExpansion
- true: expand the contents of EntityReference nodespublic org.w3c.dom.traversal.TreeWalker createTreeWalker(Node root, short whatToShow, org.w3c.dom.traversal.NodeFilter filter)
root
- the root of the iteratorwhatToShow
- the whatToShow maskfilter
- the node filter (null = no filter)public org.w3c.dom.traversal.TreeWalker createTreeWalker(Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean entityReferenceExpansion)
root
- the root of the iteratorwhatToShow
- the whatToShow maskfilter
- the node filter (null = no filter)entityReferenceExpansion
- true: expand the contents of EntityReference nodespublic org.w3c.dom.ranges.Range createRange()
public Event createEvent(String type)
type
- type of Event interface to be createdpublic XMLDoc clone()
public String toXML()
protected void setMemberDoc(DocumentXMLImpl myDoc)
public XMLDoc write2URL(String strURL, String strContentType)
strURL
and receives the response in the returned XMLDoc.strURL
- the URL to write tostrContentType
- the content type to write toprotected void pushParser(XMLParser xmlParser)
xmlParser
- protected Node getChildNode(int nodeType, int iPos)
nodeType
with n = iPosnodeType
- the DOM node type to get - copy from KElement -
- ELEMENT_NODE = 1
- ATTRIBUTE_NODE = 2
- TEXT_NODE = 3
- CDATA_SECTION_NODE = 4
- ENTITY_REFERENCE_NODE = 5
- ENTITY_NODE = 6
- PROCESSING_INSTRUCTION_NODE = 7
- COMMENT_NODE = 8
- DOCUMENT_NODE = 9
- DOCUMENT_TYPE_NODE = 10
- DOCUMENT_FRAGMENT_NODE = 11
- NOTATION_NODE = 12
- XML_DECL_NODE = 13
iPos
- the index of the node with default 0 for the first occurancepublic String getXMLComment()
would return this is a XMLComment
protected XMLParser getXMLParser()
public HttpURLConnection write2HTTPURL(URL url, String strContentType, UrlUtil.HTTPDetails det)
url
- the url to write tostrContentType
- the content type; if null use text/xmldet
- the details to setpublic UrlPart write2HttpURL(URL url, String strContentType, UrlUtil.HTTPDetails det)
url
- the url to write tostrContentType
- the content type; if null use text/xmldet
- the details to setpublic long getDocMemoryUsed()
public javax.mail.BodyPart getBodyPart()
public javax.mail.Multipart getMultiPart()
public void setBodyPart(javax.mail.BodyPart bodyPart)
bodyPart
- the value to setpublic void setZipReader(ZipReader zip)
zip
- the value to setpublic ZipReader getZipReader()
public String getOriginalFileName()
public void setOriginalFileName(String originalFileName)
originalFileName
- The OriginalFileName to set.public String getSchemaLocation(String nsURI)
nsURI
- the namespace uri to get the schema location forpublic File getSchemaLocationFile(String nsURI)
nsURI
- the namespace uri to get the schema location forpublic void setSchemaLocation(String nsURI, File _schemaLocation)
nsURI
- _schemaLocation
- public void setValidationResult(XMLDoc validationResult)
validationResult
- the validationResult to set.public static XMLDoc parseStream(InputStream is)
is
- public static XMLDoc parseFile(String fileName)
fileName
- public static XMLDoc parseString(String string)
string
- public static XMLDoc parseFile(File file)
file
- public static XMLDoc parseURL(String url, javax.mail.BodyPart bp)
url
- the url to searchbp
- the bodypart that the CID url is located inpublic void copyMeta(XMLDoc dMine)
dMine
- Copyright © 2018. All rights reserved.