Package org.cip4.jdflib.core
Class XMLDoc
- java.lang.Object
-
- org.cip4.jdflib.core.XMLDoc
-
- All Implemented Interfaces:
java.lang.Cloneable,IStreamWriter
- Direct Known Subclasses:
JDFDoc
public class XMLDoc extends java.lang.Object implements java.lang.Cloneable, IStreamWriter
-
-
Field Summary
Fields Modifier and Type Field Description protected DocumentXMLImplm_doc
-
Constructor Summary
Constructors Constructor Description XMLDoc()constructorXMLDoc(java.lang.String strDocType)convenience constructorXMLDoc(java.lang.String strDocType, java.lang.String namespaceURI)constructorXMLDoc(DocumentXMLImpl document)constructorXMLDoc(XMLDoc other)constructorXMLDoc(org.w3c.dom.Document document)constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.w3c.dom.NodeappendChild(org.w3c.dom.Node newChild)append a new child node to 'this'XMLDocclone()clone the document, completely severing all connections to the original documentorg.w3c.dom.NodecloneNode(boolean deep)get a copy of 'this'voidcopyMeta(XMLDoc dMine)copy metadata from other documentorg.w3c.dom.AttrcreateAttribute(java.lang.String name)createAttribute in namespace JDFCoreConstants.NONAMESPACE (DOM Level 2)org.w3c.dom.AttrcreateAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)create an attribute withe the given name in the given namespaceorg.w3c.dom.CDATASectioncreateCDATASection(java.lang.String data)create a CDATA section, which has this document as ownerDocorg.w3c.dom.CommentcreateComment(java.lang.String data)createCommentorg.w3c.dom.DocumentFragmentcreateDocumentFragment()createDocumentFragmentorg.w3c.dom.DocumentTypecreateDocumentType(java.lang.String qualifiedName, java.lang.String publicID, java.lang.String systemID)createDocumentTypeorg.w3c.dom.ElementcreateElement(java.lang.String elementName)createElement create a JDFElement that floats in nirvana.org.apache.xerces.dom.ElementDefinitionImplcreateElementDefinition(java.lang.String name)creates an element definition.org.w3c.dom.ElementcreateElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)create a Element that floats in nirvana, this must be appended to a node with appendChildorg.w3c.dom.EntitycreateEntity(java.lang.String name)create an entityorg.w3c.dom.EntityReferencecreateEntityReference(java.lang.String name)creates an EntityReferenceorg.w3c.dom.events.EventcreateEvent(java.lang.String type)create an Event objectorg.w3c.dom.traversal.NodeIteratorcreateNodeIterator(org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean entityReferenceExpansion)createNodeIteratororg.w3c.dom.traversal.NodeIteratorcreateNodeIterator(org.w3c.dom.Node root, short whatToShow, org.w3c.dom.traversal.NodeFilter filter)create a node iteratororg.w3c.dom.NotationcreateNotation(java.lang.String name)creates a Notation having this Document as its OwnerDocorg.w3c.dom.ProcessingInstructioncreateProcessingInstruction(java.lang.String target, java.lang.String data)creates a ProcessingInstruction having this Document as ownerDocorg.w3c.dom.ranges.RangecreateRange()createRangeprotected XMLDoccreateRoot(org.w3c.dom.Document document)org.w3c.dom.TextcreateTextNode(java.lang.String data)createTextNodeorg.w3c.dom.traversal.TreeWalkercreateTreeWalker(org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean entityReferenceExpansion)creates a TreeWalkerorg.w3c.dom.traversal.TreeWalkercreateTreeWalker(org.w3c.dom.Node root, short whatToShow, org.w3c.dom.traversal.NodeFilter filter)creates a TreeWalkerbooleanequals(java.lang.Object o)protected booleanflush()Method Flush
clean the m_doc and restart from scratch.org.w3c.dom.NamedNodeMapgetAttributes()get the attributes associated with this nodejavax.mail.BodyPartgetBodyPart()get the Javax.Mail.BodyPartprotected org.w3c.dom.NodegetChildNode(int nodeType, int iPos)gets the n'th child node of nodetypenodeTypewith n = iPosorg.w3c.dom.NodeListgetChildNodes()get the child nodes of this nodelonggetDocMemoryUsed()rough guestimate of the memory used by this if called after parsingorg.w3c.dom.DocumentTypegetDoctype()getDoctypeorg.w3c.dom.ElementgetDocumentElement()getDocumentElementorg.w3c.dom.ElementgetElementById(java.lang.String elementId)get element with ID = elementId similar to Docoment.getElementByID but works with non schema parsed documentsorg.w3c.dom.NodeListgetElementsByTagName(java.lang.String tagname)return a NodeList of all elements having the specified tagnameorg.w3c.dom.NodeListgetElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String myLocalName)get a NodeList of all elements with a given name and namespace URIbooleangetErrorChecking()does the DOM implementation perform error checking upon operations?org.w3c.dom.NodegetFirstChild()get the first child node of 'this'org.w3c.dom.ElementgetIdentifier(java.lang.String idName)gets the element with the registered name = "idName"java.util.Enumeration<?>getIdentifiers()gets the registered identifiersprotected DocumentXMLImplgetImpl()org.w3c.dom.DOMImplementationgetImplementation()getImplementationstatic intgetIndent()org.w3c.dom.NodegetLastChild()get the last child node of 'this'static intgetLineWidth()java.lang.StringgetLocalName()get the the local part of the qualified name of 'this'DocumentXMLImplgetMemberDocument()getMemberDocumentjavax.mail.MultipartgetMultiPart()get the Javax.Mail.Multipartorg.w3c.dom.NodegetNextSibling()get the next sibling of 'this'org.w3c.dom.NodegetNode(short type, int skip, java.lang.String nodeName)java.lang.StringgetNodeName()gets the node nameshortgetNodeType()get node typejava.lang.StringgetNodeValue()gets the node valueJDFAttributeMapgetNSMap()get a copy of the nsmapjava.lang.StringgetOriginalFileName()org.w3c.dom.NodegetParentNode()get the parent node of 'this' nodejava.lang.StringgetPrefix()get the namespace prefix of 'this' nodeorg.w3c.dom.NodegetPreviousSibling()get the previous sibling of 'this'org.w3c.dom.ProcessingInstructiongetProcessingInstruction(int skip, java.lang.String name)KElementgetRoot()get the root of the dom treejava.lang.StringgetRootName()java.lang.StringgetSchemaLocation(java.lang.String nsURI)java.io.FilegetSchemaLocationFile(java.lang.String nsURI)XMLDocgetValidationResult()java.lang.StringgetXMLComment()gets of 'this' the text of the i-th child XMLComment.protected XMLParsergetXMLParser()java.lang.StringgetXSLTURL()gets the url for an xslt stylesheet eZipReadergetZipReader()get the ZipReaderbooleanhasAttributes()check if 'this' has attributesbooleanhasChildNodes()test if 'this' has any childreninthashCode()org.w3c.dom.NodeimportNode(org.w3c.dom.Node importedNode, boolean deep)copy a node from another document in this documentorg.w3c.dom.NodeinsertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)insert a new node before a given nodebooleanisDirty()check whether the underlying document is nullbooleanisNull()check whether the underlying document is nullbooleanisSchemaValid()booleanisSupported(java.lang.String feature, java.lang.String version)test whether a specific DOMImplelementation feature is supported by 'this'voidnormalize()normalizestatic XMLDocparseFile(java.io.File file)parse an XML filestatic XMLDocparseFile(java.lang.String fileName)parse an XML filestatic XMLDocparseStream(java.io.InputStream is)parse a JDF input streamstatic XMLDocparseString(java.lang.String string)parse an XML filestatic XMLDocparseURL(java.lang.String url, javax.mail.BodyPart bp)parse a given urlstatic XMLDocparseZipFile(java.io.File file)parse an XML fileprotected voidpushParser(XMLParser xmlParser)voidputIdentifier(java.lang.String idName, org.w3c.dom.Element element)Registers an identifier name with a specified element nodeorg.w3c.dom.NoderemoveChild(org.w3c.dom.Node oldChild)remove a child from 'this'voidremoveIdentifier(java.lang.String idName)remove element with identifier "idName"org.w3c.dom.NodereplaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)replace a child node with a new onevoidsetBodyPart(javax.mail.BodyPart bodyPart)set the Javax.Mail.BodyPartvoidsetErrorChecking(boolean check)sets whether the DOM implementation performs error checking upon operationsstatic voidsetIndent(int indent)static voidsetLineWidth(int lineWidth)protected voidsetMemberDoc(DocumentXMLImpl myDoc)voidsetNodeValue(java.lang.String nodeValue)set the node valuevoidsetNSMap(XMLDoc other)set the namespace map from another documentvoidsetOriginalFileName(java.lang.String originalFileName)voidsetPrefix(java.lang.String prefix)set the namespace prefix of 'this' nodeKElementsetRoot(java.lang.String strDocType, java.lang.String namespaceURI)initialize a new root of strDocType in the document called by constructor XMLDoc(String strDocType)voidsetSchemaLocation(java.lang.String nsURI, java.io.File _schemaLocation)set xs:schemalocation tovoidsetValidationResult(XMLDoc validationResult)voidsetXPathValues(JDFAttributeMap valueMap)set the xpath values of thei to the values in the nodevoidsetXSLTURL(java.lang.String url)sets the processing instruction for an xslt stylesheetvoidsetZipReader(ZipReader zip)set the ZipReaderjava.lang.StringtoString()toStringjava.lang.StringtoXML()toXMLbooleanwrite2File(java.io.File oFilePath)write2File - write to a file; Create if it doesn't exist always assume utf-8 encodingbooleanwrite2File(java.io.File file, int indent, boolean bPreserveSpace)write2File - write to a file; Create if it doesn't existbooleanwrite2File(java.lang.String oFilePath)write2File - write to a file; Create if it doesn't exist always assume utf-8 encodingbooleanwrite2File(java.lang.String oFilePath, int indent)Deprecated.060419 use write2File(oFilePath, indent, true);booleanwrite2File(java.lang.String oFilePath, int indent, boolean bPreserveSpace)write2File - write to a file; Create if it doesn't exist DO NOT attempt any url escaping voodoo @see write2URLUrlPartwrite2HttpURL(java.net.URL url, java.lang.String strContentType, HTTPDetails det)java.net.HttpURLConnectionwrite2HTTPURL(java.net.URL url, java.lang.String strContentType, HTTPDetails det)voidwrite2Stream(java.io.OutputStream outStream, int indent)voidwrite2Stream(java.io.OutputStream outStream, int indent, boolean bPreserveSpace)write this to a streamstatic voidwrite2StreamStatic(org.w3c.dom.Element elem, java.io.OutputStream outStream, int indent)Deprecated.060306static voidwrite2StreamStatic(org.w3c.dom.Element elem, java.io.OutputStream outStream, int indent, boolean bPreserveSpace)Deprecated.060306java.lang.Stringwrite2String(int indent)write2String - write to a string;XMLDocwrite2URL(java.lang.String strURL, java.lang.String strContentType)This method sends the contents of this XMLDoc to the URLstrURLand receives the response in the returned XMLDoc.XMLDocwrite2URL(java.lang.String strURL, java.lang.String strContentType, HTTPDetails details)This method sends the contents of this XMLDoc to the URLstrURLand receives the response in the returned XMLDoc.java.io.Filewrite2Zip(java.io.File file)write2Zip - write to a file and compress as zip; remove the .zip from the extension in the zip entry or add .zipvoidwriteStream(java.io.OutputStream stream)write myself to a stream
-
-
-
Field Detail
-
m_doc
protected DocumentXMLImpl m_doc
-
-
Constructor Detail
-
XMLDoc
public XMLDoc()
constructor
-
XMLDoc
public XMLDoc(org.w3c.dom.Document document)
constructor- Parameters:
document-
-
XMLDoc
public XMLDoc(DocumentXMLImpl document)
constructor- Parameters:
document-
-
XMLDoc
public XMLDoc(XMLDoc other)
constructor- Parameters:
other-
-
XMLDoc
public XMLDoc(java.lang.String strDocType)
convenience constructor- Parameters:
strDocType- ElementName.JDF, ElementName.JMF, "Config" ...
-
XMLDoc
public XMLDoc(java.lang.String strDocType, java.lang.String namespaceURI)constructor- Parameters:
strDocType- ElementName.JDF, ElementName.JMF, "Config" ...namespaceURI- namespace to be used by the new XMLDoc
-
-
Method Detail
-
getIndent
public static int getIndent()
-
setIndent
public static void setIndent(int indent)
-
getLineWidth
public static int getLineWidth()
-
setLineWidth
public static void setLineWidth(int lineWidth)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object- See Also:
Object.equals(java.lang.Object)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object- See Also:
Object.hashCode()
-
createRoot
protected XMLDoc createRoot(org.w3c.dom.Document document)
-
getImpl
protected DocumentXMLImpl getImpl()
-
setRoot
public KElement setRoot(java.lang.String strDocType, java.lang.String namespaceURI)
initialize a new root of strDocType in the document called by constructor XMLDoc(String strDocType)- Parameters:
strDocType- qualified tag name of the doc root to create if still emptynamespaceURI- namespace URI of the doc root- Returns:
- JDFElement - the root element
-
getMemberDocument
public DocumentXMLImpl getMemberDocument()
getMemberDocument- Returns:
- the MemberDocument
-
flush
protected boolean flush()
Method Flush
clean the m_doc and restart from scratch. The root element remains- Returns:
- boolean - true if successful
-
getRoot
public KElement getRoot()
get the root of the dom tree- Returns:
- JDFElement default: getRoot()
-
write2String
public java.lang.String write2String(int indent)
write2String - write to a string;- Parameters:
indent- the indentation of the xml- Returns:
- String - output
-
write2File
@Deprecated public boolean write2File(java.lang.String oFilePath, int indent)Deprecated.060419 use write2File(oFilePath, indent, true);write2File - write to a file; Create if it doesn't exist always assume utf-8 encoding- Parameters:
oFilePath-indent-- Returns:
- boolean
-
write2File
public boolean write2File(java.lang.String oFilePath)
write2File - write to a file; Create if it doesn't exist always assume utf-8 encoding- Parameters:
oFilePath-indent-- Returns:
- boolean
-
write2File
public boolean write2File(java.io.File oFilePath)
write2File - write to a file; Create if it doesn't exist always assume utf-8 encoding- Parameters:
oFilePath-indent-- Returns:
- boolean
-
write2Zip
public java.io.File write2Zip(java.io.File file)
write2Zip - write to a file and compress as zip; remove the .zip from the extension in the zip entry or add .zip- Parameters:
file-- Returns:
- the created file
-
write2File
public boolean write2File(java.lang.String oFilePath, int indent, boolean bPreserveSpace)write2File - write to a file; Create if it doesn't exist DO NOT attempt any url escaping voodoo @see write2URL- Parameters:
oFilePath- the file path where to write the fileindent- indentationbPreserveSpace- if true, preserve whitespace- Returns:
- boolean - true if successful
-
write2File
public boolean write2File(java.io.File file, int indent, boolean bPreserveSpace)write2File - write to a file; Create if it doesn't exist- Parameters:
file- the file to write toindent- indentationbPreserveSpace- if true, preserve whitespace- Returns:
- boolean - true if successful
-
getRootName
public java.lang.String getRootName()
-
write2Stream
public void write2Stream(java.io.OutputStream outStream, int indent) throws java.io.IOException- Parameters:
outStream-indent-- Throws:
java.io.IOException
-
writeStream
public void writeStream(java.io.OutputStream stream) throws java.io.IOExceptionDescription copied from interface:IStreamWriterwrite myself to a stream- Specified by:
writeStreamin interfaceIStreamWriter- Parameters:
stream- the output stream- Throws:
java.io.IOException- if io snafu...
-
write2Stream
public void write2Stream(java.io.OutputStream outStream, int indent, boolean bPreserveSpace) throws java.io.IOExceptionwrite this to a stream- Parameters:
outStream-indent-bPreserveSpace-- Throws:
java.io.IOException- Since:
- 080425 synchronized
-
write2StreamStatic
@Deprecated public static void write2StreamStatic(org.w3c.dom.Element elem, java.io.OutputStream outStream, int indent) throws java.io.IOExceptionDeprecated.060306- Parameters:
elem-outStream-indent-- Throws:
java.io.IOException
-
write2StreamStatic
@Deprecated public static void write2StreamStatic(org.w3c.dom.Element elem, java.io.OutputStream outStream, int indent, boolean bPreserveSpace) throws java.io.IOExceptionDeprecated.060306- Parameters:
elem-outStream-indent-bPreserveSpace-- Throws:
java.io.IOException
-
getDoctype
public org.w3c.dom.DocumentType getDoctype()
getDoctype- Returns:
- DocumentType
-
getImplementation
public org.w3c.dom.DOMImplementation getImplementation()
getImplementation- Returns:
- DOMImplementation
-
getDocumentElement
public org.w3c.dom.Element getDocumentElement()
getDocumentElement- Returns:
- Element
-
createElement
public org.w3c.dom.Element createElement(java.lang.String elementName)
createElement create a JDFElement that floats in nirvana. This must be appended to a node with appendChild (created in namespace JDFCoreConstants.NONAMESPACE (DOM Level 2)).
Another way would be to use KElement.appendElement(String elementName, String nameSpaceURI)- Parameters:
elementName- name of the element that is created- Returns:
- Element - unconnected element that is created
-
createDocumentFragment
public org.w3c.dom.DocumentFragment createDocumentFragment()
createDocumentFragment- Returns:
- DocumentFragment
-
createTextNode
public org.w3c.dom.Text createTextNode(java.lang.String data)
createTextNode- Parameters:
data-- Returns:
- Text
-
createComment
public org.w3c.dom.Comment createComment(java.lang.String data)
createComment- Parameters:
data-- Returns:
- Comment
-
createCDATASection
public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
create a CDATA section, which has this document as ownerDoc- Parameters:
data- content of the CDATA- Returns:
- CDATASection
-
setXSLTURL
public void setXSLTURL(java.lang.String url)
sets the processing instruction for an xslt stylesheet- Parameters:
url- the url of the xslt file
-
getXSLTURL
public java.lang.String getXSLTURL()
gets the url for an xslt stylesheet e
-
setXPathValues
public void setXPathValues(JDFAttributeMap valueMap)
set the xpath values of thei to the values in the node- Parameters:
valueMap- the map of values, if this is still null, MUST be fully qualified
-
createProcessingInstruction
public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)creates a ProcessingInstruction having this Document as ownerDoc- Parameters:
target- the target "processor channel"data- parameter string to be passed to the target- Returns:
- ProcessingInstruction
-
getProcessingInstruction
public org.w3c.dom.ProcessingInstruction getProcessingInstruction(int skip, java.lang.String name)- Parameters:
skip-name-- Returns:
-
getNode
public org.w3c.dom.Node getNode(short type, int skip, java.lang.String nodeName)- Parameters:
type- the node type seeDocumentskip- the number onodes to skip- Returns:
-
createAttribute
public org.w3c.dom.Attr createAttribute(java.lang.String name)
createAttribute in namespace JDFCoreConstants.NONAMESPACE (DOM Level 2)- Parameters:
name- attribute name- Returns:
- Attr
-
createEntityReference
public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
creates an EntityReference- Parameters:
name- name of the entity to refer to- Returns:
- the newly created EntityReference
-
getElementsByTagName
public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
return a NodeList of all elements having the specified tagname- Parameters:
tagname- tag name of the elements to find (JDFCoreConstants.star for all elements)- Returns:
- NodeList
-
importNode
public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep)copy a node from another document in this document- Parameters:
importedNode- node to importdeep- if true: recurse and import the subtree under the node as well- Returns:
- Node
-
createElementNS
public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)create a Element that floats in nirvana, this must be appended to a node with appendChild- Parameters:
namespaceURI- the namespace uri of the created elementqualifiedName- name of the element that is created- Returns:
- Element - unconnected element that is created
-
createAttributeNS
public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)create an attribute withe the given name in the given namespace- Parameters:
namespaceURI- namespace URI of the attributequalifiedName- qualified name of the attribute- Returns:
- Attr - the newly created attribute
-
getElementsByTagNameNS
public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String myLocalName)get a NodeList of all elements with a given name and namespace URI- Parameters:
namespaceURI- the namespace URI to look formyLocalName- the element name to look for- Returns:
- NodeList with all elements found
-
getElementById
public org.w3c.dom.Element getElementById(java.lang.String elementId)
get element with ID = elementId similar to Docoment.getElementByID but works with non schema parsed documents- Parameters:
elementId- the element ID to look for- Returns:
- the Element found
-
getNodeName
public java.lang.String getNodeName()
gets the node name- Returns:
- String
-
getNodeValue
public java.lang.String getNodeValue()
gets the node value- Returns:
- String
-
setNodeValue
public void setNodeValue(java.lang.String nodeValue)
set the node value- Parameters:
nodeValue- value to set the node to
-
setNSMap
public void setNSMap(XMLDoc other)
set the namespace map from another document- Parameters:
other- value to set the node to
-
getNSMap
public JDFAttributeMap getNSMap()
get a copy of the nsmap
-
getNodeType
public short getNodeType()
get node type- Returns:
- a short representing the node type
-
getParentNode
public org.w3c.dom.Node getParentNode()
get the parent node of 'this' node- Returns:
- the parent node
-
getChildNodes
public org.w3c.dom.NodeList getChildNodes()
get the child nodes of this node- Returns:
- a NodeList containing the child nodes
-
getFirstChild
public org.w3c.dom.Node getFirstChild()
get the first child node of 'this'- Returns:
- the first child node
-
getLastChild
public org.w3c.dom.Node getLastChild()
get the last child node of 'this'- Returns:
- the last child node
-
getPreviousSibling
public org.w3c.dom.Node getPreviousSibling()
get the previous sibling of 'this'- Returns:
- the previous sibling node
-
getNextSibling
public org.w3c.dom.Node getNextSibling()
get the next sibling of 'this'- Returns:
- the next sibling node
-
getAttributes
public org.w3c.dom.NamedNodeMap getAttributes()
get the attributes associated with this node- Returns:
- NamedNodeMap containing the attributes associated with this node
-
insertBefore
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)insert a new node before a given node- Parameters:
newChild- the new child node to insertrefChild- the ref child node, the new node is inserted before it- Returns:
- Node
-
replaceChild
public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node oldChild)replace a child node with a new one- Parameters:
newChild- the new child node to addoldChild- the old child node to be replaced- Returns:
- Node
-
removeChild
public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
remove a child from 'this'- Parameters:
oldChild- the child node to be removed- Returns:
- oldChild, in its new state (removed)
-
appendChild
public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
append a new child node to 'this'- Parameters:
newChild- new child node to add- Returns:
- Node
-
hasChildNodes
public boolean hasChildNodes()
test if 'this' has any children- Returns:
- boolean - true, if 'this' has children
-
cloneNode
public org.w3c.dom.Node cloneNode(boolean deep)
get a copy of 'this'- Parameters:
deep- true: copy children as well- Returns:
- Node - a copy of 'this'
-
normalize
public void normalize()
normalize
-
isSupported
public boolean isSupported(java.lang.String feature, java.lang.String version)test whether a specific DOMImplelementation feature is supported by 'this'- Parameters:
feature- package name of the feature to testversion- version number of the package name to test- Returns:
- boolean - true, if the feature is sopported
- See Also:
- Xerxes-Documentation
-
getPrefix
public java.lang.String getPrefix()
get the namespace prefix of 'this' node- Returns:
- String - namespace prefix (null if unspecified)
-
setPrefix
public void setPrefix(java.lang.String prefix)
set the namespace prefix of 'this' node- Parameters:
prefix- namespace prefix
-
getLocalName
public java.lang.String getLocalName()
get the the local part of the qualified name of 'this'- Returns:
- String - local name
-
isNull
public boolean isNull()
check whether the underlying document is null- Returns:
- true if m_doc==null
-
isDirty
public boolean isDirty()
check whether the underlying document is null- Returns:
- true if m_doc==null
-
hasAttributes
public boolean hasAttributes()
check if 'this' has attributes- Returns:
- true, if 'this' has attributes
-
createDocumentType
public org.w3c.dom.DocumentType createDocumentType(java.lang.String qualifiedName, java.lang.String publicID, java.lang.String systemID)createDocumentType- Parameters:
qualifiedName-publicID-systemID-- Returns:
- DocumentType
-
setErrorChecking
public void setErrorChecking(boolean check)
sets whether the DOM implementation performs error checking upon operations- Parameters:
check- true - enable error checking
-
getErrorChecking
public boolean getErrorChecking()
does the DOM implementation perform error checking upon operations?- Returns:
- true - error checking is enabled, otherwise false
-
createEntity
public org.w3c.dom.Entity createEntity(java.lang.String name)
create an entity- Parameters:
name- name of the entity- Returns:
- Entity - the newly created entity
-
createNotation
public org.w3c.dom.Notation createNotation(java.lang.String name)
creates a Notation having this Document as its OwnerDoc- Parameters:
name- name of the notation- Returns:
- Notation - the newly created notation
-
createElementDefinition
public org.apache.xerces.dom.ElementDefinitionImpl createElementDefinition(java.lang.String name)
creates an element definition. Element definitions hold default attribute values.- Parameters:
name-- Returns:
- ElementDefinitionImpl
-
putIdentifier
public void putIdentifier(java.lang.String idName, org.w3c.dom.Element element)Registers an identifier name with a specified element node- Parameters:
idName-element-
-
getIdentifier
public org.w3c.dom.Element getIdentifier(java.lang.String idName)
gets the element with the registered name = "idName"- Parameters:
idName- name of the element to get- Returns:
- Element - the element with "idName"
-
removeIdentifier
public void removeIdentifier(java.lang.String idName)
remove element with identifier "idName"- Parameters:
idName-
-
getIdentifiers
public java.util.Enumeration<?> getIdentifiers()
gets the registered identifiers- Returns:
- Enumeration of registered identifiers
-
createNodeIterator
public org.w3c.dom.traversal.NodeIterator createNodeIterator(org.w3c.dom.Node root, short whatToShow, org.w3c.dom.traversal.NodeFilter filter)create a node iterator- Parameters:
root- the root of the iteratorwhatToShow- the whatToShow maskfilter- the node filter (null = no filter)- Returns:
- the newly created NodeIterator
-
createNodeIterator
public org.w3c.dom.traversal.NodeIterator createNodeIterator(org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean entityReferenceExpansion)createNodeIterator- Parameters:
root- the root of the iteratorwhatToShow- the whatToShow maskfilter- the node filter (null = no filter)entityReferenceExpansion- true: expand the contents of EntityReference nodes- Returns:
- the newly created NodeIterator
-
createTreeWalker
public org.w3c.dom.traversal.TreeWalker createTreeWalker(org.w3c.dom.Node root, short whatToShow, org.w3c.dom.traversal.NodeFilter filter)creates a TreeWalker- Parameters:
root- the root of the iteratorwhatToShow- the whatToShow maskfilter- the node filter (null = no filter)- Returns:
- the newly created TreeWalker
-
createTreeWalker
public org.w3c.dom.traversal.TreeWalker createTreeWalker(org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean entityReferenceExpansion)creates a TreeWalker- Parameters:
root- the root of the iteratorwhatToShow- the whatToShow maskfilter- the node filter (null = no filter)entityReferenceExpansion- true: expand the contents of EntityReference nodes- Returns:
- the newly created TreeWalker
-
createRange
public org.w3c.dom.ranges.Range createRange()
createRange- Returns:
- Range
-
createEvent
public org.w3c.dom.events.Event createEvent(java.lang.String type)
create an Event object- Parameters:
type- type of Event interface to be created- Returns:
- the newly created Event
-
clone
public XMLDoc clone()
clone the document, completely severing all connections to the original document- Overrides:
clonein classjava.lang.Object- Returns:
- Object
-
toString
public java.lang.String toString()
toString- Overrides:
toStringin classjava.lang.Object- Returns:
- String
-
toXML
public java.lang.String toXML()
toXML- Returns:
- String
-
setMemberDoc
protected void setMemberDoc(DocumentXMLImpl myDoc)
-
write2URL
public XMLDoc write2URL(java.lang.String strURL, java.lang.String strContentType)
This method sends the contents of this XMLDoc to the URLstrURLand receives the response in the returned XMLDoc.- Parameters:
strURL- the URL to write tostrContentType- the content type to write to- Returns:
- docResponse the response received from URL. if url is a file, an empty doc is returned A Null document if no response was received, or an exception occurred
-
write2URL
public XMLDoc write2URL(java.lang.String strURL, java.lang.String strContentType, HTTPDetails details)
This method sends the contents of this XMLDoc to the URLstrURLand receives the response in the returned XMLDoc.- Parameters:
strURL- the URL to write tostrContentType- the content type to write to- Returns:
- docResponse the response received from URL. if url is a file, an empty doc is returned A Null document if no response was received, or an exception occurred
-
pushParser
protected void pushParser(XMLParser xmlParser)
- Parameters:
xmlParser-
-
getChildNode
protected org.w3c.dom.Node getChildNode(int nodeType, int iPos)gets the n'th child node of nodetypenodeTypewith n = iPos- Parameters:
nodeType- 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 occurance- Returns:
- KElement: a node that matches the filter, null if iPos is higher then the number of child nodes
-
-
getXMLComment
public java.lang.String getXMLComment()
gets of 'this' the text of the i-th child XMLComment.would returnthis is a XMLComment- Returns:
- String text document XMLComment, null if i is higher then the number of child nodes
-
getXMLParser
protected XMLParser getXMLParser()
- Returns:
-
getValidationResult
public XMLDoc getValidationResult()
- Returns:
- Returns the validation result.
-
isSchemaValid
public boolean isSchemaValid()
- Returns:
- Returns the m_OriginalFileName.
-
write2HTTPURL
public java.net.HttpURLConnection write2HTTPURL(java.net.URL url, java.lang.String strContentType, HTTPDetails det)- Parameters:
url- the url to write tostrContentType- the content type; if null use text/xmldet- the details to set- Returns:
- the HttpURLConnection, null if failure
-
write2HttpURL
public UrlPart write2HttpURL(java.net.URL url, java.lang.String strContentType, HTTPDetails det)
- Parameters:
url- the url to write tostrContentType- the content type; if null use text/xmldet- the details to set- Returns:
- the HttpURLConnection, null if failure
-
getDocMemoryUsed
public long getDocMemoryUsed()
rough guestimate of the memory used by this if called after parsing- Returns:
- the difference of memory used when calling compared to construction time
-
getBodyPart
public javax.mail.BodyPart getBodyPart()
get the Javax.Mail.BodyPart- Returns:
- the BodyPart
-
getMultiPart
public javax.mail.Multipart getMultiPart()
get the Javax.Mail.Multipart- Returns:
- the Multipart
-
setBodyPart
public void setBodyPart(javax.mail.BodyPart bodyPart)
set the Javax.Mail.BodyPart- Parameters:
bodyPart- the value to set
-
setZipReader
public void setZipReader(ZipReader zip)
set the ZipReader- Parameters:
zip- the value to set
-
getZipReader
public ZipReader getZipReader()
get the ZipReader- Returns:
- zip the value to set
-
getOriginalFileName
public java.lang.String getOriginalFileName()
- Returns:
- Returns the m_OriginalFileName.
-
setOriginalFileName
public void setOriginalFileName(java.lang.String originalFileName)
- Parameters:
originalFileName- The OriginalFileName to set.
-
getSchemaLocation
public java.lang.String getSchemaLocation(java.lang.String nsURI)
- Parameters:
nsURI- the namespace uri to get the schema location for- Returns:
- String that corresponds to the schema, null if no schemalocation is defined for nsURI
-
getSchemaLocationFile
public java.io.File getSchemaLocationFile(java.lang.String nsURI)
- Parameters:
nsURI- the namespace uri to get the schema location for- Returns:
- File that corresponds to the schema, null if no readable file is found
-
setSchemaLocation
public void setSchemaLocation(java.lang.String nsURI, java.io.File _schemaLocation)set xs:schemalocation to- Parameters:
nsURI-_schemaLocation-
-
setValidationResult
public void setValidationResult(XMLDoc validationResult)
- Parameters:
validationResult- the validationResult to set.
-
parseStream
public static XMLDoc parseStream(java.io.InputStream is)
parse a JDF input stream- Parameters:
is-- Returns:
- the parsed JDFDoc
-
parseFile
public static XMLDoc parseFile(java.lang.String fileName)
parse an XML file- Parameters:
fileName-- Returns:
- the parsed JDFDoc
-
parseString
public static XMLDoc parseString(java.lang.String string)
parse an XML file- Parameters:
string-- Returns:
- the parsed JDFDoc
-
parseFile
public static XMLDoc parseFile(java.io.File file)
parse an XML file- Parameters:
file-- Returns:
- the parsed JDFDoc
-
parseZipFile
public static XMLDoc parseZipFile(java.io.File file)
parse an XML file- Parameters:
file-- Returns:
- the parsed JDFDoc
-
parseURL
public static XMLDoc parseURL(java.lang.String url, javax.mail.BodyPart bp)
parse a given url- Parameters:
url- the url to searchbp- the bodypart that the CID url is located in- Returns:
- the parsed JDFDoc
-
copyMeta
public void copyMeta(XMLDoc dMine)
copy metadata from other document- Parameters:
dMine-
-