Class KElement
- java.lang.Object
-
- org.apache.xerces.dom.NodeImpl
-
- org.apache.xerces.dom.ChildNode
-
- org.apache.xerces.dom.ParentNode
-
- org.apache.xerces.dom.ElementImpl
-
- org.apache.xerces.dom.ElementNSImpl
-
- org.cip4.jdflib.core.KElement
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,IStreamWriter,org.w3c.dom.Element,org.w3c.dom.ElementTraversal,org.w3c.dom.events.EventTarget,org.w3c.dom.Node,org.w3c.dom.NodeList,org.w3c.dom.TypeInfo
- Direct Known Subclasses:
JDFElement
public class KElement extends org.apache.xerces.dom.ElementNSImpl implements org.w3c.dom.Element, IStreamWriter
KElement wraps Element and contains some generic utilities.
Every access to a Element should be wrapped using KElement.
KElement is completely agnostic to JDF.
Typically elements in non-JDF namespaces will be KElements.
note that it is discouraged to mix direct calls to Dom Element and KElement routines a future version will most likely contain a private ElementNSImpl rather than inherit from it. The current extension solution is a work around around a xerces bug
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKElement.SimpleElementNameComparatorsorts according to the lexical string representation of the xml objectsstatic classKElement.SimpleNodeComparatorsorts according to the lexical string representation of the xml objectsstatic classKElement.SingleAttributeComparatorsorts according to the value of one attribute
if the attribute is numeric, compare numerically, else lexical comparison is donestatic classKElement.SingleXPathComparatorsorts according to the value of one attribute
if the attribute is numeric, compare numerically, else lexical comparison is done
-
Field Summary
-
Fields inherited from class org.apache.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocument
-
Fields inherited from class org.apache.xerces.dom.NodeImpl
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, ID, IGNORABLEWS, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE
-
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
-
-
Constructor Summary
Constructors Constructor Description KElement(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, java.lang.String qualifiedName)Constructor for KElementKElement(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, java.lang.String myNamespaceURI, java.lang.String qualifiedName)Constructor for KElementKElement(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, java.lang.String myNamespaceURI, java.lang.String qualifiedName, java.lang.String myLocalName)Constructor for KElement
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description doubleaddAttribute(java.lang.String key, double inc, java.lang.String nameSpaceURI)increments or decrements a numeric attribute by incintaddAttribute(java.lang.String key, int inc, java.lang.String nameSpaceURI)increments or decrements a numeric attribute by incbooleanaddNameSpace(java.lang.String strPrefix, java.lang.String strNameSpaceURI)Adds a NameSpace and maps the prefix to a URI.intancestorDistance(KElement child)distance to ancestor (0=this)java.lang.StringappendAnchor(java.lang.String newID)create and append a unique id, keep the existing one if it already existsjava.lang.StringappendAttribute(java.lang.String key, java.lang.String value, boolean unique)conveniencejava.lang.StringappendAttribute(java.lang.String key, java.lang.String value, java.lang.String nameSpaceURI, java.lang.String sep, boolean bUnique)Append the contents of value to the existing attribute key.voidappendAttributes(java.lang.String key, java.util.List<java.lang.String> value, java.lang.String nameSpaceURI, java.lang.String sep, boolean bUnique)Append the contents of value to the existing attribute key.voidappendCData(java.lang.String cDataText)Appends XML CData section<![CDATA[ CData Section ]]>some character data
Appends a new CData section child node to the end of 'this 'voidappendCData(KElement cDataElem)Appends XML CData section<![CDATA[ CData Section ]]>some character data
Appends a new CData section child node to the end of 'this 'org.w3c.dom.NodeappendChild(org.w3c.dom.Node arg0)KElementappendElement(java.lang.String elementName)append a DOM element.KElementappendElement(java.lang.String elementName, java.lang.String nameSpaceURI)KElementappendElementN(java.lang.String elementName, int maxAllowed, java.lang.String nameSpaceURI)Appends a new child element to the end of 'this', if it's maximum number of the children with defined name and nameSpace doesn't exceed maxAllowedKElementappendElementRaw(java.lang.String elementName, java.lang.String nameSpaceURI)appends an element without any namespace validity checks or initialization Faster but not sa safe...voidappendEntityReference(java.lang.String refName)appends a entity reference to the actual elementvoidappendText(java.lang.String textName)append some generic textKElementappendTextElement(java.lang.String nodeName, java.lang.String text)append a text element with text includedvoidappendXMLComment(java.lang.String commentText)Deprecated.use appendXMLComment(commentText, null);org.w3c.dom.NodeappendXMLComment(java.lang.String commentText, KElement beforeChild)append a DOM comment<!-- XMLComment -->The double minus sign '--' is escaped with an underscore '_' in order to ensure valid xmljava.lang.StringbuildRelativeXPath(KElement relativeTo, int methCountSiblings)Gets the XPath full tree representation of 'this'java.lang.StringbuildXPath()Deprecated.use buildXPath(null,true);java.lang.StringbuildXPath(java.lang.String relativeTo)Deprecated.use buildXPath(relativeTo,true);java.lang.StringbuildXPath(java.lang.String relativeTo, int methCountSiblings)Gets the XPath full tree representation of 'this'voidcleanup()removes everythingvoidclearNSMap()cleanup all namespace stuffprotected voidclearTargets()KElementclone()the clone is the same documentKElementcloneNewDoc()same as @see clone but the clone is in a new document
the document gets copies of context sensitive stuff like zip, mime, filename...java.lang.StringcopyAttribute(java.lang.String attrib, KElement src)copy an attribute from src to this - shorthand if no renaming or namespace handling is necessaryjava.lang.StringcopyAttribute(java.lang.String attrib, KElement src, boolean overwriteEmpty)copy an attribute from src to this - shorthand if no renaming or namespace handling is necessaryjava.lang.StringcopyAttribute(java.lang.String attrib, KElement src, java.lang.String srcAttrib, java.lang.String nameSpaceURI, java.lang.String srcNameSpaceURI)copy an attribute from src to this, if null - remove the attributejava.lang.StringcopyAttribute(java.lang.String attrib, KElement src, java.lang.String srcAttrib, java.lang.String nameSpaceURI, java.lang.String srcNameSpaceURI, boolean overwriteEmpty)copy an attribute from src to this, if null - remove the attributevoidcopyChildren(java.lang.String elementName, KElement src)KElementcopyElement(KElement src, KElement beforeChild)Copies src node (including all attributes and subelements) and inserts the copy into 'this' in front of beforeChild, if it exists.voidcopyElements(VElement v, KElement beforeChild)append all children in a vector of elements in the order of the vectorKElementcopyInto(KElement src, boolean bRemove)copies a node into this, ignoring identical node names i.e.java.lang.StringcopyXPathValue(java.lang.String dstXPath, KElement src, java.lang.String srcXPath)copy attribute values or text from an xpath in src to thisstatic KElementcreateRoot(java.lang.String nodename)create a new root documentstatic KElementcreateRoot(java.lang.String nodename, java.lang.String namespaceURI)create a new root documentKElementdeleteNode()Deletes itself from its parentjava.lang.StringensureCase(java.lang.String key)ensure the correct case of n attribute, if presentvoideraseEmptyAttributes(boolean bRecurse)remove all empty attributes from this (e.g.interaseEmptyNodes(boolean bTrimWhite)Erases all empty text nodes in 'this' and its subelements If there any empty text nodes removes them.java.util.HashSet<java.lang.String>fillHashSet(java.lang.String attName, java.lang.String attNS)fills a HashSet with all values of the attribute in all child elementsbooleanfitsName(java.lang.String nodeName, java.lang.String nameSpaceURI)Tests whether the specified nodename and namespace fits the nodename and namespace of 'this'protected booleanfitsName_KElement(java.lang.String nodeName, java.lang.String nameSpaceURI)booleanflush()Flush - remove all attributes, elements and text, leaving only a stub tagjava.lang.StringgenerateDotID(java.lang.String key, java.lang.String nameSpaceURI)generate a unique id in the syntax newID=oldID.nn
nn is a unique number, that is generated as the first integer higher than the number of sibling elements with the same name.java.lang.StringgetAttribute(java.lang.String strLocalName)Mother of all attribute getters
Gets an attribute value out of an elementjava.lang.StringgetAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, java.lang.String def)mother of all attribute getters.java.lang.StringgetAttribute_KElement(java.lang.String strLocalName)Mother of all attribute getters
Gets an attribute value out of an elementjava.lang.StringgetAttribute_KElement(java.lang.String attrib, java.lang.String nameSpaceURI, java.lang.String def)Because getAttribute is overwritten in various classes this method can be called directly to get only KElement Attribute.java.util.List<java.lang.String>getAttributeArray_KElement()Gets all attribute keys of 'this' as a vector of stringsjava.lang.StringgetAttributeIgnoreCase(java.lang.String key)Gets an atrribute if the local nameJDFAttributeMapgetAttributeMap()Get the Attribute Map of the actual elementJDFAttributeMapgetAttributeMap_KElement()Get the Attribute Map of the actual elementjava.lang.StringgetAttributeRaw(java.lang.String qualifiedName)getAttribute with no pardon for namespaces or anythingVStringgetAttributeVector()Gets all attribute keys of 'this' as a vector of stringsVStringgetAttributeVector_KElement()Gets all attribute keys of 'this' as a vector of stringsbooleangetBoolAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, boolean def)get a boolean attributejava.lang.StringgetCData(int i)Gets of 'this' the text of the i'th XML CData section.java.util.Collection<KElement>getChildArray(java.lang.String nodeName, java.lang.String nameSpaceURI)Get all children from the actual element matching the given conditions
convenience for getChildElementVector(nodeName, nameSpaceURI, null, true, 0, true)java.util.List<KElement>getChildArray_KElement(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bAnd, int maxSize)Get all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElements<A extends KElement>
java.util.List<A>getChildArrayByClass(java.lang.Class<A> clazz, boolean bRecurse, int nMax)Get all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElements never null<A extends KElement>
java.util.List<A>getChildArrayByClass_KElement(java.lang.Class<A> clazz, boolean bRecurse, int nMax)Get all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElements never nullVStringgetChildAttributeList(java.lang.String nodeName, java.lang.String attName, java.lang.String nameSpaceURI, java.lang.String attValue, boolean bDirect, boolean bUnique)Get a vector of all value of the attribute attName in the children of this nodeKElementgetChildByTagName(java.lang.String s, java.lang.String nameSpaceURI, int index, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd)Get a child from the actual element by the tag name.KElement[]getChildElementArray()gets an array of the direct children of the current elementVElementgetChildElementVector(java.lang.String nodeName, java.lang.String nameSpaceURI)Get all children from the actual element matching the given conditions
convenience for getChildElementVector(nodeName, nameSpaceURI, null, true, 0, true)VElementgetChildElementVector(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bAnd, int maxSize)Deprecated.060302 - use 6 parameter versionVElementgetChildElementVector(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bAnd, int maxSize, boolean bResolveTarget)Get all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElementsVElementgetChildElementVector_KElement(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bAnd, int maxSize)Get all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElementsKElementgetChildFromList(VString nodeNames, int iSkip)Deprecated.use getChildFromList(Vector nodeNames, int iSkip, JDFAttributeMap map)KElementgetChildFromList(VString nodeNames, int iSkip, JDFAttributeMap map, boolean bDirect)Get any Child that matches a string defined in nodeNames.java.util.List<KElement>getChildList()never null list of all kidsjava.util.List<KElement>getChildList(java.lang.String nodeName, java.lang.String nameSpaceURI)Get all children from the actual element matching the given conditions
convenience for getChildElementVector(nodeName, nameSpaceURI, null, true, 0, true)protected org.w3c.dom.NodegetChildNode(int nodeType, int iPos)gets the n'th child node of nodetypenodeTypewith n = iPosVElementgetChildNodes_KElement()Deprecated.use getChildElementVector(null, null, null, true, 0)java.util.VectorgetChildNodeVector(int maxSize)Deprecated.<A extends KElement>
java.util.Vector<A>getChildrenByClass(java.lang.Class<A> clazz, boolean bRecurse, int nMax)Deprecated.use getChildArrayByClassVElementgetChildrenByTagName(java.lang.String elementName)convenience helperVElementgetChildrenByTagName(java.lang.String elementName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd, int maxSize)Gets children of 'this' by tag name, nameSpaceURI and attribute map, if the attribute map is not empty.
Searches the entire tree including hidden nodes that are children of non-matching nodesVElementgetChildrenByTagName_KElement(java.lang.String elementName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd, int maxSize)Gets children of 'this' by tag name, nameSpaceURI and attribute map, if the attribute map is not empty.
Searches the entire tree including hidden nodes that are children of non-matching nodesVElementgetChildrenFromList(VString nodeNames, JDFAttributeMap map, boolean bDirect, VElement v)get a vector of all Children that match the strings defined in nodeNamesVElementgetChildrenIgnoreList(VString nodeNames, boolean bDirect, VElement v)get a vector of all Children that do not match the strings defined in nodeNamesVElementgetChildrenWithAttribute(java.lang.String nodeName, java.lang.String attName, java.lang.String nameSpaceURI, java.lang.String attVal, boolean bDirect)Deprecated.use getChildrenByTagName(nodeName, nameSpaceURI, new JDFAttributeMap(attName, attVal), bDirect, true, 0);<A extends KElement>
AgetChildWithAttribute(java.lang.Class<A> clazz, java.lang.String attName, java.lang.String attVal)<A extends KElement>
AgetChildWithAttribute(java.lang.Class<A> clazz, java.lang.String attName, java.lang.String attVal, boolean recurse)KElementgetChildWithAttribute(java.lang.String nodeName, java.lang.String attName, java.lang.String nameSpaceURI, java.lang.String attVal, int index, boolean bDirect)GetChildWithAttribute - Get a child with matching attributesKElementgetCreateChildWithAttribute(java.lang.String nodeName, java.lang.String attName, java.lang.String nameSpaceURI, java.lang.String attVal, int index)GetChildWithAttribute - Get a child with matching attributes; craete it if it does not existKElementgetCreateElement(java.lang.String nodeName)Get the actual element, create if not thereKElementgetCreateElement(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)Get the actual element, create if not thereKElementgetCreateElement_KElement(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)Gets the iSkip-th child node with matching nodeName and nameSpaceURI, optionally creates it if it doesn't exist.KElementgetCreateXPathElement(java.lang.String path)gets an element as defined by XPath to value and creates it if it does not existKElementgetDeepElement(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)Deprecated.use getChildByTagName(nodeName, nameSpaceURI, iSkip, null, false, true);KElementgetDeepParent(java.lang.String parentNode, int depth)Get the n'th Ancestor node with name parentNodeKElementgetDeepParent(java.util.Vector vParentElement, int depth)Deprecated.- loop over the single node methodKElementgetDeepParentChild(java.lang.String parentNode)Get the first child of parentNode with name parentNodeKElementgetDeepParentNotName(java.lang.String thisNode)Get the Ancestor node with name other than thisNodeKElementgetDocRoot()Gets the root element of the current documentorg.w3c.dom.AttrgetDOMAttr(java.lang.String attrib, java.lang.String nameSpaceURI, boolean bInherit)Get The DOM Attribute node of a given attribute if attrib has no namespace prefix and nameSpaceURI is a wildcard the attribute with the element prefix will be returned if no empty attribute exists e.g.KElementgetElement(java.lang.String nodeName)Get the actual element - utility routine.KElementgetElement(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)Gets an existing iSkip-th child node with matching nodeName and nameSpaceURIKElementgetElement_KElement(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)getElement - Get the actual element<A extends KElement>
AgetElementByClass(java.lang.Class<A> clazz, int iSkip, boolean bRecurse)getElement - Get the actual element by java classjava.util.HashMap<java.lang.String,KElement>getElementHashMap(java.lang.String elementName, java.lang.String elementNS, java.lang.String attName)performance enhanced function to access multiple elements e.g.VStringgetElementNameVector()Returns a vector which contains the childs of the actual element.VElementgetElementsByTagName_KElement(java.lang.String s, java.lang.String nameSpaceURI)wrappers of DOM routines that dont bang on null nodesKElementgetFirstChildElement()get the first child element<a extends KElement>
agetFirstChildElement(java.lang.Class<a> clazz)Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.KElementgetFirstChildElement(java.lang.String nodeName, java.lang.String nameSpaceURI)Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.static org.w3c.dom.ElementgetFirstElementNode(org.w3c.dom.Element parent)Deprecated.use elem.getFirstChildElementjava.lang.StringgetID()gets attribute IDprotected java.lang.StringgetIDPrefix()getIDPrefixjava.lang.StringgetIgnoreCase(java.lang.String strLocalName)similar to getAttribute but returns null for all empty strings Gets an attribute value out of an elementjava.lang.StringgetIgnoreCase_KElement(java.lang.String strLocalName)similar to getAttribute but returns null for all empty strings Gets an attribute value out of an elementjava.lang.StringgetInheritedAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, java.lang.String def)searches for the first attribute occurence in this element or any ancestorsKElementgetInheritedElement(java.lang.String elementName, java.lang.String nameSpaceURI, int iSkip)searches for the first child element occurence in this element or any ancestorsjava.lang.StringgetInheritedXPathAttribute(java.lang.String path, java.lang.String def)Gets an attribute value as defined by XPath namespace prefixes are resolved
Attributes are searched for in partitioned resources if appropriateintgetIntAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, int def)Get a integer attribute if presentstatic java.lang.StringgetLocalNameStatic(KElement kElem)Deprecated.use getLocalNamelonggetLongAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, long def)Get a long attribute if presentVStringgetMultipleIDs(java.lang.String attName)Get a vector of all IDs that occur multiple timesjava.lang.StringgetNamespaceURI()Get the NameSpaceURIjava.lang.StringgetNamespaceURIFromPrefix(java.lang.String prefix)Gets the NameSpaceURI corresponding to a given prefix, returns null if no namespace is definedstatic org.w3c.dom.ElementgetNextElementNode(org.w3c.dom.Element elem)Deprecated.- use elem.getNextSiblingElement();KElementgetNextSiblingElement()get the next sibling element<a extends KElement>
agetNextSiblingElement(java.lang.Class<a> clazz)Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.KElementgetNextSiblingElement(java.lang.String nodeName, java.lang.String nameSpaceURI)Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.java.lang.StringgetNonEmpty(java.lang.String strLocalName)similar to getAttribute but returns null for all empty strings Gets an attribute value out of an elementjava.lang.StringgetNonEmpty_KElement(java.lang.String strLocalName)similar to getAttribute but returns null for all empty strings Gets an attribute value out of an elementintgetNumCDatas()gets the number of direct child CData sectionsintgetNumChildNodes(int nodeType)Gets the number of direct child nodes of 'this', that match NodeTypeintgetNumChildText()Gets the number of direct text child nodesintgetNumXMLComments()gets the number of direct XMLComment child nodes of 'this'XMLDocgetOwnerDocument_KElement()Get the document object that owns thisKElementgetParentNode_KElement()get the parent node of thisKElementgetPreviousSiblingElement()get the previous sibling elementKElementgetPreviousSiblingElement(java.lang.String nodeName, java.lang.String nameSpaceURI)Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.doublegetRealAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, double def)get a double attributeKElementgetTarget(java.lang.String id, java.lang.String attrib)looking for a specified target with an id, e.g.KElementgetTarget_KElement(java.lang.String id, java.lang.String attrib)Gets the target of link.java.lang.StringgetText()gets a concatenated string representing of all direct text child nodesjava.lang.StringgetText(int i)gets the i'th text child node of 'this'java.util.List<KElement>getTree(java.lang.String nodeName)Get children from the actual element by the tag name
GetTree only follows direct links, e.g.VElementgetTree(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd)Get children from the actual element by the tag name, nameSpaceURI or attribute map.<A extends KElement>
java.util.List<A>getTreeByClass(java.lang.Class<A> cl, boolean addself)KElementgetTreeElement(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd)Get child from the actual element by the tag name, nameSpaceURI or attribute map.java.lang.StringgetXMLComment(int i)gets of 'this' the text of the i-th child XMLComment.static java.lang.StringgetXMLNSNameSpace(java.lang.String pc)Deprecated.static java.lang.StringgetXMLNSPrefix(java.lang.String pc)Deprecated.use xmlnsPrefixjava.lang.StringgetXPathAttribute(java.lang.String path, java.lang.String def)Gets an attribute value as defined by XPath namespace prefixes are resolved or the node text if an element is specifiedJDFAttributeMapgetXPathAttributeMap(java.lang.String path)Gets a map of attribute values as defined by XPath namespace prefixes are resolvedKElementgetXPathElement(java.lang.String path)gets an element as defined by XPath to valueVElementgetXPathElementVector(java.lang.String path, int maxSize)gets an vector of elements element as defined by XPath to valueJDFAttributeMapgetXPathValueMap()Gets a map of attribute values as defined by XPath namespace prefixes are resolvedJDFAttributeMapgetXPathValueMap(boolean isRelative)Gets a map of attribute values as defined by XPath namespace prefixes are resolvedjava.lang.StringgetXSIType()returns the xsi:type of this element, null if not presentbooleanhasAttribute(java.lang.String attrib)Checks if the actual element has a specific attribute
this version checks only the explicit element and NOT any inherited resource partiotions Attention! this behavior differs from that of @see getAttribute()booleanhasAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, boolean bInherit)Checks if the actual element has a specific attribute
this version checks within the exact xml elementbooleanhasAttribute_KElement(java.lang.String attrib, java.lang.String nameSpaceURI, boolean bInherit)Checks if the actual element has a specific attribute
this version checks within the exact xml elementbooleanhasAttributes()checks if the current element has attributesbooleanhasChildElement(java.lang.String nodeName, java.lang.String nameSpaceURI)Checks whether the current element has a child element NodeNamebooleanhasChildElements()checks if the current element has a child elementprotected booleanhasChildNodes(int nodeType)checks wether this has node childs of the stated node typebooleanhasChildText()Tests, whether 'this' contains any text child nodesbooleanhasNonEmpty(java.lang.String strLocalName)similar to hasAttribute but returns false for all empty strings Gets an attribute value out of an elementbooleanhasNonEmpty_KElement(java.lang.String strLocalName)similar to hasAttribute but returns false for all empty strings Gets an attribute value out of an elementbooleanhasXPathNode(java.lang.String path)returns true if the element or attribute described by this XPath exists, else falsebooleanincludesAttribute(java.lang.String attName, java.lang.String attValue)Check if an attribute is present.booleanincludesAttributes(JDFAttributeMap aMap, boolean bAnd)Checks if the actual element contains the attributes given in aMapbooleaninit()Method init.KElementinsertAt(java.lang.String nodeName, int beforePos, java.lang.String beforeNode, java.lang.String nameSpaceURI, java.lang.String beforeNameSpaceURI)Creates a new child element with defined Name and NameSpace and inserts it in front of the node with a name bForeNode and namespace beforeNameSpaceURI, with index beforePosKElementinsertBefore(java.lang.String elementName, org.w3c.dom.Node beforeChild, java.lang.String nameSpaceURI)Inserts the Element elementName before the existing Element node beforeChild.org.w3c.dom.NodeinsertBefore(org.w3c.dom.Node arg0, org.w3c.dom.Node arg1)booleanisAncestor(KElement child)checks if KElement child is ancestor or notbooleanisDirty()Get the dirty status of this elementbooleanisEqual(KElement kElem)Checks if the contents of this element are equal to element kElem
differs from @see equals because nodes that are in different locations or documents but have the same name, attributes and elements are considered equalstatic booleanisEqual(KElement e1, KElement e2)null safe test whether the elements e1 and e2 are equalstatic booleanisWildCard(java.lang.String nodeName)Tests whether an argument is a wildcard i.e null, empty or * note that Wildcard ("*") is deprecated ideally null should be used to denote a wildcardbooleanmatchesPath(java.lang.String path)Deprecated.use matchesPath(String path, boolean bFollowRefs)booleanmatchesPath(java.lang.String path, boolean bFollowRefs)check whether this element matches a simple xpathprotected booleanmatchesPathName(java.lang.String pathAt)KElementmergeElement(KElement kElem, boolean bDelete)merge nodes in a way that no duplicate elements are created
attention !! this kills pools !! since elements in kElem overwrite those in *thisvoidmoveArray(java.util.Collection<KElement> v, KElement beforeChild)move all children in a vector of elements in the order of the vectorvoidmoveAttribute(java.lang.String attrib, KElement src)moves an attribute from src to this, the attribute will be removed from src and moved to this.voidmoveAttribute(java.lang.String attrib, KElement src, java.lang.String srcAttrib, java.lang.String nameSpaceURI, java.lang.String srcNameSpaceURI)moves an attribute from src to this, the attribute will be removed from src and moved to this.KElementmoveElement(KElement src, KElement beforeChild)Moves src node (including all attributes and subelements) from its parent node into 'this' and inserts it in front of beforeChild, if it exists.voidmoveElements(VElement v, KElement beforeChild)Deprecated.use moveArrayKElementmoveMe(KElement beforeChild)moves this to a position before another child, fails if either this or beforechild are document rootsvoidnormalize()intnumChildElements(java.lang.String node, java.lang.String nameSpaceURI)Get the number of child elements.intnumChildElements_KElement(java.lang.String node, java.lang.String nameSpaceURI)Get the number of child elements.intnumChildNodes(int nodeType)Deprecated.use 2-parameter version numChildNodes(nodeType, false);intnumChildNodes(int nodeType, boolean bRecurse)count the number of child nodes of DOM nodeType nodeType (0=count all)intnumChildrenByClass(java.lang.Class<?> clazz, boolean bRecurse)Get the number of child elements of a certain classintnumSiblingElements(java.lang.String elementName, java.lang.String nameSpaceURI)get the number of sibling elementsstatic KElementparseFile(java.lang.String filename)static KElementparseStream(java.io.InputStream s)static KElementparseString(java.lang.String string)KElementpushUp(java.lang.String newParentName)Moves 'this' from parent to grandparent or to the closest ancestor with name newParentNamevoidremoveAllText()removes all text children of the current nodevoidremoveAttribute(java.lang.String attrib)voidremoveAttribute(java.lang.String attrib, java.lang.String nameSpaceURI)Remove an attribute from the current elementvoidremoveAttribute_KElement(java.lang.String attrib, java.lang.String nameSpaceURI)Remove a attribute from the current elementorg.w3c.dom.AttrremoveAttributeNode(org.w3c.dom.Attr arg0)voidremoveAttributeNS(java.lang.String nameSpaceURI, java.lang.String attrib)voidremoveAttributes(java.util.Collection<java.lang.String> attribs)Removes all attributes spezified in attribs.voidremoveCData(int i)Removes the i'th XML CData sectionKElementremoveChild(java.lang.String node, java.lang.String nameSpaceURI, int n)Removes the n'th child node that matches 'nodeName' and 'nameSpaceURI'org.w3c.dom.NoderemoveChild(org.w3c.dom.Node arg0)booleanremoveChildNode(int nodeType, int i)removes the i'th child node, that match NodeTypevoidremoveChildren(java.lang.String nodeName, java.lang.String nameSpaceURI)Remove children that matchnodeNameandnameSpaceURIvoidremoveChildren(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib)Removes the children namednodeNamein the namespacenameSpaceURIfrom the parent elementvoidremoveChildrenByClass(java.lang.Class<? extends org.w3c.dom.Node> clazz)voidremoveChildText(int i)Removes the i'th text node of 'this'voidremoveExtensions(java.lang.String nsURI)remove all elements and attributes of a given namespaceintremoveFromAttribute(java.lang.String key, java.lang.String token, java.lang.String nameSpaceURI, java.lang.String sep, int nMax)Removes the attribute value from its value list
Removes the contents of value from the existing attribute key.voidremoveIgnoreCase(java.lang.String key)voidremoveIgnoreCase_KElement(java.lang.String key)voidremoveXMLComment(int i)removes the i'th XMLComment nodevoidremoveXPathAttribute(java.lang.String path)remove an attribute or text that is described by the xpath path quietly returns if the attribute or text does not existvoidremoveXPathElement(java.lang.String path)remove an attribute or element that is described by the xpath path quietly returns if the element does not existvoidrenameAttribute(java.lang.String oldName, java.lang.String newName)Rename an attribute in this namespace
if oldName does not exist, newName is NOT modifiedvoidrenameAttribute(java.lang.String oldName, java.lang.String newName, java.lang.String nameSpaceURI, java.lang.String newNameSpaceURI)Rename an attribute in this namespace
if oldName does not exist, newName is NOT modifiedKElementrenameElement(java.lang.String newName, java.lang.String nameSpaceURI)Rename the element with the String newName.org.w3c.dom.NodereplaceChild(org.w3c.dom.Node arg0, org.w3c.dom.Node arg1)KElementreplaceElement(KElement src)Replaces 'this' with src.voidsetAttribute(java.lang.String key, boolean b, java.lang.String nameSpaceURI)SetAttribute - Sets an element attributevoidsetAttribute(java.lang.String key, double value, java.lang.String nameSpaceURI)Sets an element attributevoidsetAttribute(java.lang.String key, double value, java.lang.String nameSpaceURI, int precision)Sets an element attributevoidsetAttribute(java.lang.String key, int value, java.lang.String nameSpaceURI)Sets an element attributevoidsetAttribute(java.lang.String key, long value, java.lang.String nameSpaceURI)Sets an element attributevoidsetAttribute(java.lang.String key, java.lang.String value)no namespace variantvoidsetAttribute(java.lang.String key, java.lang.String value, java.lang.String nameSpaceURI)Mother of all Attribute setters
Sets a new attribute.voidsetAttribute(java.lang.String key, java.util.List<java.lang.String> value, java.lang.String nameSpaceURI)Sets an NMTOKENS attribute to all elements from parameter value will be concatenate with blanks to the resulting NMTOKENvoidsetAttribute(java.lang.String key, org.apache.commons.lang.enums.ValuedEnum value, java.lang.String nameSpaceURI)Sets an element attributevoidsetAttribute(java.lang.String key, VString value, java.lang.String nameSpaceURI)Sets an NMTOKENS attribute to all elements from parameter value will be concatenate with blanks to the resulting NMTOKENvoidsetAttribute(java.lang.String key, JDFNumList value, int precision)voidsetAttribute(java.lang.String key, JDFDate value, java.lang.String nameSpaceURI)org.w3c.dom.AttrsetAttributeNode(org.w3c.dom.Attr arg0)org.w3c.dom.AttrsetAttributeNodeNS(org.w3c.dom.Attr arg0)voidsetAttributeNS(java.lang.String nsURI, java.lang.String arg1, java.lang.String arg2)voidsetAttributeNSRaw(java.lang.String ns, java.lang.String key, java.lang.String value)fastest setAttribute with namespace- use only if you know exactly what you are doingvoidsetAttributeRaw(java.lang.String key, java.lang.String value)fastest setAttribute - use only if you know exactly what you are doingvoidsetAttributes(java.lang.String[] myAttributes, java.lang.String[] strValues)Deprecated.use setAttributes(JDFAttributeMap)intsetAttributes(KElement kElem)Sets the attributes from the curent element to the attributes from kElem.intsetAttributes(KElement kElem, VString ignoreList)Sets the attributes from the curent element to the attributes from kElem.intsetAttributes(JDFAttributeMap map)Sets the attributes from the curent element.voidsetAttributesRaw(KElement kElem)Sets the attributes from the current element to the attributes from kElem.voidsetBoolAttribute(java.lang.String key, boolean b, java.lang.String nameSpaceURI)Deprecated.use setAttribute insteadvoidsetDirty()Set this element as dirtyvoidsetDirty(boolean bAttribute)Set this element as dirtyvoidsetID(java.lang.String id)gets attribute IDvoidsetIntAttribute(java.lang.String key, int value, java.lang.String nameSpaceURI)Deprecated.use setAttribute insteadstatic voidsetLongID(boolean bLong)set the ID generation algorithm to include a datevoidsetNamespaceURI(java.lang.String arg0)voidsetNodeValue(java.lang.String arg0)voidsetNonEmpty(java.lang.String key, java.lang.String val)convenience setter same as setAttribute but never sets ""voidsetPrefix(java.lang.String arg0)voidsetRealAttribute(java.lang.String key, double value, java.lang.String nameSpaceURI)Deprecated.use setAttribute insteadvoidsetText(java.lang.String text)Sets an XML Text
the text contents of this to the value of textvoidsetvStringAttribute(java.lang.String key, VString value, java.lang.String nameSpaceURI)Deprecated.use setAttribute insteadvoidsetXMLComment(java.lang.String commentText)set a DOM comment<!-- XMLComment -->in front ofthisif an xml Comment node already exists directly in front ofthis, the previous comment is removed The double minus sign '--' is escaped with an underscore '_' in order to ensure valid xmlvoidsetXMLComment(java.lang.String commentText, boolean single)set a DOM comment<!-- XMLComment -->in front ofthisif an xml Comment node already exists directly in front ofthis, the previous comment is removed The double minus sign '--' is escaped with an underscore '_' in order to ensure valid xmlvoidsetXPathAttribute(java.lang.String path, java.lang.String value)Sets an attribute as defined by XPath to valuevoidsetXPathValue(java.lang.String path, java.lang.String value)Sets an attribute as defined by XPath to valuevoidsetXPathValues(JDFAttributeMap map)sets all xpaths to the values provided in mapvoidsetXSIType(java.lang.String typ)voidsortChild(KElement e)sorts/inserts e by alphabetvoidsortChild(KElement e, java.util.Comparator<KElement> comparator)insert e into this, assuming that this is already sortedvoidsortChildren()sorts all child elements by alphabetvoidsortChildren(boolean bRecursive)sorts all child elements by alphabetvoidsortChildren(java.util.Comparator<KElement> comparator)sorts all child elements by alphabetvoidsortChildren(java.util.Comparator<KElement> comparator, boolean bRecursive)sorts all child elements by alphabetjava.lang.StringtoDisplayXML(int indent)serialize this to a stringjava.lang.StringtoString()this to string, used for debug purpose mostlyjava.lang.StringtoValueString(char sep)get a concatinated string of all valuesjava.lang.StringtoXML()serialize this to a stringjava.lang.StringtoXML(int indent)serialize this to a stringstatic java.lang.StringuniqueID(int id)UniqueID - create a unique id based on date and time + a counter - 6 digits are taken from id Normally this should only be used internally, @see JDFElement.appendAnchor() for details.static java.lang.StringuniqueID(int id, boolean bDate)booleanwrite2File(java.io.File file)write myself to a filebooleanwrite2File(java.lang.String filename)write myself to a filebooleanwrite2Stream(java.io.OutputStream stream)write myself to an output streamvoidwriteStream(java.io.OutputStream stream)write myself to a streamstatic java.lang.StringxmlNameSpace(java.lang.String s)Deprecated.use xmlnsPrefix()static java.lang.StringxmlnsLocalName(java.lang.String pc)used by get localnamestatic java.lang.StringxmlnsPrefix(java.lang.String nodeName)Parses pc for it's namespace prefix-
Methods inherited from class org.apache.xerces.dom.ElementNSImpl
getLocalName, getPrefix, getTypeName, getTypeNamespace, getXMLBaseAttribute, isDerivedFrom, setType
-
Methods inherited from class org.apache.xerces.dom.ElementImpl
cloneNode, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getBaseURI, getChildElementCount, getDefaultAttributes, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getLastElementChild, getNextElementSibling, getNodeName, getNodeType, getPreviousElementSibling, getSchemaTypeInfo, getTagName, getXercesAttribute, hasAttributeNS, isEqualNode, reconcileDefaultAttributes, setIdAttribute, setIdAttributeNode, setIdAttributeNS, setOwnerDocument, setReadOnly, setupDefaultAttributes, setXercesAttributeNode, synchronizeData
-
Methods inherited from class org.apache.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, getTextContent, hasChildNodes, item, setTextContent, synchronizeChildren
-
Methods inherited from class org.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling
-
Methods inherited from class org.apache.xerces.dom.NodeImpl
addEventListener, changed, changes, compareDocumentPosition, compareTreePosition, dispatchEvent, getContainer, getFeature, getNodeNumber, getNodeValue, getReadOnly, getUserData, getUserData, getUserDataRecord, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setUserData, setUserData
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.w3c.dom.Element
getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS
-
Methods inherited from interface org.w3c.dom.Node
cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasChildNodes, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, setTextContent, setUserData
-
-
-
-
Constructor Detail
-
KElement
public KElement(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, java.lang.String qualifiedName)Constructor for KElement- Parameters:
myOwnerDocument- the owner document of the new elementqualifiedName- the qualified name of the element
-
KElement
public KElement(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, java.lang.String myNamespaceURI, java.lang.String qualifiedName)Constructor for KElement- Parameters:
myOwnerDocument- the owner document of the new elementmyNamespaceURI- the namespace of the new elementqualifiedName- the qualified name of the element
-
KElement
public KElement(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, java.lang.String myNamespaceURI, java.lang.String qualifiedName, java.lang.String myLocalName)Constructor for KElement- Parameters:
myOwnerDocument- the owner document of the new elementmyNamespaceURI- the namespace of the new elementqualifiedName- the qualified name of the elementmyLocalName- the localname of the element
-
-
Method Detail
-
isDirty
public boolean isDirty()
Get the dirty status of this element- Returns:
- boolean true if dirty
-
setDirty
public void setDirty()
Set this element as dirty
-
setDirty
public void setDirty(boolean bAttribute)
Set this element as dirty- Parameters:
bAttribute- if true, only attributes are dirty, else also sub-elements
-
getOwnerDocument_KElement
public XMLDoc getOwnerDocument_KElement()
Get the document object that owns this- Returns:
- XMLDoc the owner document of this
-
getInheritedAttribute
public java.lang.String getInheritedAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, java.lang.String def)searches for the first attribute occurence in this element or any ancestors- Parameters:
attrib- the attribute namenameSpaceURI- the XML-namespacedef- the default if it does not exist- Returns:
- String value of attribute found, value of def if not available
-
getAttribute
public java.lang.String getAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, java.lang.String def)mother of all attribute getters. Get a attribute out of this element- Parameters:
attrib- the name of the attribute you want to havenameSpaceURI- namespace of keydef- the value that is returned if attrib does not exist in this or this is null- Returns:
- String the attribute value as a string, or def if that attribute does not have a specified or default value
-
getAttribute_KElement
public java.lang.String getAttribute_KElement(java.lang.String attrib, java.lang.String nameSpaceURI, java.lang.String def)Because getAttribute is overwritten in various classes this method can be called directly to get only KElement Attribute.- Parameters:
attrib- the name of the attribute you want to havenameSpaceURI- namespace of keydef- the value that is returned if attrib does not exist in this - may be null- Returns:
- String the attribute value as a string, or def if attribute was not found
-
getAttribute
public java.lang.String getAttribute(java.lang.String strLocalName)
Mother of all attribute getters
Gets an attribute value out of an element- Specified by:
getAttributein interfaceorg.w3c.dom.Element- Overrides:
getAttributein classorg.apache.xerces.dom.ElementImpl- Parameters:
strLocalName- the name of the attribute you want to have- Returns:
- String the value of the Attribute or emptystring
-
ensureCase
public java.lang.String ensureCase(java.lang.String key)
ensure the correct case of n attribute, if present- Parameters:
key-- Returns:
-
removeIgnoreCase
public void removeIgnoreCase(java.lang.String key)
-
removeIgnoreCase_KElement
public void removeIgnoreCase_KElement(java.lang.String key)
-
getIgnoreCase
public java.lang.String getIgnoreCase(java.lang.String strLocalName)
similar to getAttribute but returns null for all empty strings Gets an attribute value out of an element- Parameters:
strLocalName- the name of the attribute you want to have- Returns:
- String the value of the Attribute or null
-
getIgnoreCase_KElement
public java.lang.String getIgnoreCase_KElement(java.lang.String strLocalName)
similar to getAttribute but returns null for all empty strings Gets an attribute value out of an element- Parameters:
strLocalName- the name of the attribute you want to have- Returns:
- String the value of the Attribute or null
-
getNonEmpty
public java.lang.String getNonEmpty(java.lang.String strLocalName)
similar to getAttribute but returns null for all empty strings Gets an attribute value out of an element- Parameters:
strLocalName- the name of the attribute you want to have- Returns:
- String the value of the Attribute or null
-
getNonEmpty_KElement
public java.lang.String getNonEmpty_KElement(java.lang.String strLocalName)
similar to getAttribute but returns null for all empty strings Gets an attribute value out of an element- Parameters:
strLocalName- the name of the attribute you want to have- Returns:
- String the value of the Attribute or null
-
hasNonEmpty
public boolean hasNonEmpty(java.lang.String strLocalName)
similar to hasAttribute but returns false for all empty strings Gets an attribute value out of an element- Parameters:
strLocalName- the name of the attribute you want to have- Returns:
- String the value of the Attribute or emptystring
-
hasNonEmpty_KElement
public boolean hasNonEmpty_KElement(java.lang.String strLocalName)
similar to hasAttribute but returns false for all empty strings Gets an attribute value out of an element- Parameters:
strLocalName- the name of the attribute you want to have- Returns:
- String the value of the Attribute or emptystring
-
getAttributeRaw
public java.lang.String getAttributeRaw(java.lang.String qualifiedName)
getAttribute with no pardon for namespaces or anything- Parameters:
qualifiedName- the name of the attribute you want to have- Returns:
- String the value of the Attribute or emptystring
-
getAttribute_KElement
public java.lang.String getAttribute_KElement(java.lang.String strLocalName)
Mother of all attribute getters
Gets an attribute value out of an element- Parameters:
strLocalName- the name of the attribute you want to have- Returns:
- String the value of the Attribute or emptystring
-
getParentNode_KElement
public KElement getParentNode_KElement()
get the parent node of this- Returns:
- KElement the parent node of the actual element
-
setvStringAttribute
@Deprecated public void setvStringAttribute(java.lang.String key, VString value, java.lang.String nameSpaceURI)Deprecated.use setAttribute insteadSets an NMTOKENS attribute to all elements from parameter value will be concatenate with blanks to the resulting NMTOKEN- Parameters:
key- the name of the attribute to setvalue- the values for the attribute keynameSpaceURI- the namespace of the key
-
setAttribute
public void setAttribute(java.lang.String key, VString value, java.lang.String nameSpaceURI)Sets an NMTOKENS attribute to all elements from parameter value will be concatenate with blanks to the resulting NMTOKEN- Parameters:
key- the name of the attribute to setvalue- the values for the attribute keynameSpaceURI- the namespace of the key
-
setAttribute
public void setAttribute(java.lang.String key, java.util.List<java.lang.String> value, java.lang.String nameSpaceURI)Sets an NMTOKENS attribute to all elements from parameter value will be concatenate with blanks to the resulting NMTOKEN- Parameters:
key- the name of the attribute to setvalue- the values for the attribute keynameSpaceURI- the namespace of the key
-
setAttribute
public void setAttribute(java.lang.String key, JDFDate value, java.lang.String nameSpaceURI)- Parameters:
key-value-nameSpaceURI-
-
setAttribute
public void setAttribute(java.lang.String key, JDFNumList value, int precision)- Parameters:
key-value-nameSpaceURI-
-
getDOMAttr
public org.w3c.dom.Attr getDOMAttr(java.lang.String attrib, java.lang.String nameSpaceURI, boolean bInherit)Get The DOM Attribute node of a given attribute if attrib has no namespace prefix and nameSpaceURI is a wildcard the attribute with the element prefix will be returned if no empty attribute exists e.g. getDOMAttr("a") will return the node x:a in- Parameters:
attrib- the attribute NamenameSpaceURI- then namespaceURI, defaults to the local namespacebInherit- search in parent elements as well- Returns:
- Node the DOMAttr node of the matching attribute
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.String value, java.lang.String nameSpaceURI)Mother of all Attribute setters
Sets a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create an Attr node plus any Text and EntityReference nodes, build the appropriate subtree, and use setAttributeNode to assign it as the value of an attribute. To set an attribute with a qualified name and namespace URI, use the setAttributeNS method.- Parameters:
key- the qualified name of the attribute to create or alter.value- the value to set in string form. If null, the attribute is removednameSpaceURI- the namespace the element is in- Throws:
JDFException- if no settings of its attributes are possible
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.String value)no namespace variant- Specified by:
setAttributein interfaceorg.w3c.dom.Element- Overrides:
setAttributein classorg.apache.xerces.dom.ElementImpl- Parameters:
key- name of the attribute to setvalue- value of the attribute
-
setAttributeRaw
public void setAttributeRaw(java.lang.String key, java.lang.String value)fastest setAttribute - use only if you know exactly what you are doing- Parameters:
key- name of the attribute to setvalue- value of the attribute
-
setAttributeNSRaw
public void setAttributeNSRaw(java.lang.String ns, java.lang.String key, java.lang.String value)fastest setAttribute with namespace- use only if you know exactly what you are doing- Parameters:
ns- the namespace urikey- name of the attribute to setvalue- value of the attribute
-
setIntAttribute
@Deprecated public void setIntAttribute(java.lang.String key, int value, java.lang.String nameSpaceURI)Deprecated.use setAttribute insteadSets an element attribute- Parameters:
key- the name of the attribute to setvalue- the value for the attributenameSpaceURI- the namespace the element is in
-
setAttribute
public void setAttribute(java.lang.String key, int value, java.lang.String nameSpaceURI)Sets an element attribute- Parameters:
key- the name of the attribute to setvalue- the value for the attributenameSpaceURI- the namespace the element is in
-
setAttribute
public void setAttribute(java.lang.String key, org.apache.commons.lang.enums.ValuedEnum value, java.lang.String nameSpaceURI)Sets an element attribute- Parameters:
key- the name of the attribute to setvalue- the value for the attributenameSpaceURI- the namespace the element is in
-
setAttribute
public void setAttribute(java.lang.String key, long value, java.lang.String nameSpaceURI)Sets an element attribute- Parameters:
key- the name of the attribute to setvalue- the long value for the attributenameSpaceURI- the namespace the element is in
-
setRealAttribute
@Deprecated public void setRealAttribute(java.lang.String key, double value, java.lang.String nameSpaceURI)Deprecated.use setAttribute insteadSets an element attribute- Parameters:
key- the name of the attribute to setvalue- the value for the attributenameSpaceURI- the namespace the element is in
-
setAttribute
public void setAttribute(java.lang.String key, double value, java.lang.String nameSpaceURI)Sets an element attribute- Parameters:
key- the name of the attribute to setvalue- the value for the attributenameSpaceURI- the namespace the element is in
-
setAttribute
public void setAttribute(java.lang.String key, double value, java.lang.String nameSpaceURI, int precision)Sets an element attribute- Parameters:
key- the name of the attribute to setvalue- the value for the attributenameSpaceURI- the namespace the element is inprecision-
-
setBoolAttribute
@Deprecated public void setBoolAttribute(java.lang.String key, boolean b, java.lang.String nameSpaceURI)Deprecated.use setAttribute insteadSetAttribute - Sets an element attribute- Parameters:
key- the name of the attribute to setb- value of the boolean attribute to be set (true or false)nameSpaceURI- the nameSpace the attribute is in
-
setAttribute
public void setAttribute(java.lang.String key, boolean b, java.lang.String nameSpaceURI)SetAttribute - Sets an element attribute- Parameters:
key- the name of the attribute to setb- value of the boolean attribute to be set (true or false)nameSpaceURI- the nameSpace the attribute is in
-
addAttribute
public double addAttribute(java.lang.String key, double inc, java.lang.String nameSpaceURI)increments or decrements a numeric attribute by inc- Parameters:
key- the name of the attribute to setinc- the value to increment or decrement bynameSpaceURI- the nameSpace the attribute is in- Returns:
- double the attribute value after modification
-
addAttribute
public int addAttribute(java.lang.String key, int inc, java.lang.String nameSpaceURI)increments or decrements a numeric attribute by inc- Parameters:
key- the name of the attribute to setinc- the value to increment or decrement bynameSpaceURI- the nameSpace the attribute is in- Returns:
- double the attribute value after modification
-
removeAttribute
public void removeAttribute(java.lang.String attrib, java.lang.String nameSpaceURI)Remove an attribute from the current element- Parameters:
attrib- attribute name to removenameSpaceURI- the nameSpace of the attribut
-
removeAttribute_KElement
public void removeAttribute_KElement(java.lang.String attrib, java.lang.String nameSpaceURI)Remove a attribute from the current element- Parameters:
attrib- attribute name to removenameSpaceURI- the nameSpace of the attribut
-
hasAttribute
public boolean hasAttribute(java.lang.String attrib)
Checks if the actual element has a specific attribute
this version checks only the explicit element and NOT any inherited resource partiotions Attention! this behavior differs from that of @see getAttribute()- Specified by:
hasAttributein interfaceorg.w3c.dom.Element- Overrides:
hasAttributein classorg.apache.xerces.dom.ElementImpl- Parameters:
attrib- the name of the attribute to look for- Returns:
- boolean true, if the attribute is present
-
hasAttribute
public boolean hasAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, boolean bInherit)Checks if the actual element has a specific attribute
this version checks within the exact xml element- Parameters:
attrib- the name of the attribute to look fornameSpaceURI- the nameSpace to look inbInherit- if true also check recursively in parent elements- Returns:
- boolean true if the attribute is present
-
hasAttribute_KElement
public boolean hasAttribute_KElement(java.lang.String attrib, java.lang.String nameSpaceURI, boolean bInherit)Checks if the actual element has a specific attribute
this version checks within the exact xml element- Parameters:
attrib- the name of the attribute to look fornameSpaceURI- the nameSpace to look inbInherit- if true also check recursively in parent elements- Returns:
- boolean true if the attribute is present
-
appendAttribute
public java.lang.String appendAttribute(java.lang.String key, java.lang.String value, boolean unique)convenience- Parameters:
key- attribute keyvalue- string to be appended
-
appendAttribute
public java.lang.String appendAttribute(java.lang.String key, java.lang.String value, java.lang.String nameSpaceURI, java.lang.String sep, boolean bUnique)Append the contents of value to the existing attribute key. Create Key, if it does not exist- Parameters:
key- attribute keyvalue- string to be appendednameSpaceURI- namespace of keysep- separator between the original attribute value and value, defaults to " " if nullbUnique- if true, the attribute will only be appended if it is not yet within the current attribute value appendAttribute("key","next",JDFCoreConstants.EMPTYSTRING,JDFCoreConstants .COMMA) applied toresults in - Returns:
- the updated value; null if none exists
-
appendAttributes
public void appendAttributes(java.lang.String key, java.util.List<java.lang.String> value, java.lang.String nameSpaceURI, java.lang.String sep, boolean bUnique)Append the contents of value to the existing attribute key. Create Key, if it does not exist- Parameters:
key- attribute keyvalue- string to be appendednameSpaceURI- namespace of keysep- separator between the original attribute value and value, defaults to " " if nullbUnique- if true, the attribute will only be appended if it is not yet within the current attribute value appendAttribute("key","next",JDFCoreConstants.EMPTYSTRING,JDFCoreConstants .COMMA) applied toresults in
-
isWildCard
public static boolean isWildCard(java.lang.String nodeName)
Tests whether an argument is a wildcard i.e null, empty or * note that Wildcard ("*") is deprecated ideally null should be used to denote a wildcard- Parameters:
nodeName- the argument to test- Returns:
- boolean true if the name is wildcard
-
isEqual
public static boolean isEqual(KElement e1, KElement e2)
null safe test whether the elements e1 and e2 are equal- Parameters:
e1-e2-- See Also:
isEqual(org.cip4.jdflib.core.KElement)
-
fitsName
public boolean fitsName(java.lang.String nodeName, java.lang.String nameSpaceURI)Tests whether the specified nodename and namespace fits the nodename and namespace of 'this'- Parameters:
nodeName- the name of the node to test. May be either local or qualifiednameSpaceURI- the namespace of the node to test.- Returns:
- boolean true if fits
-
fitsName_KElement
protected boolean fitsName_KElement(java.lang.String nodeName, java.lang.String nameSpaceURI)
-
getNamespaceURIFromPrefix
public java.lang.String getNamespaceURIFromPrefix(java.lang.String prefix)
Gets the NameSpaceURI corresponding to a given prefix, returns null if no namespace is defined- Parameters:
prefix- the prefix to check for- Returns:
- String The nameSpaceURI that maps to prefix
-
getNamespaceURI
public java.lang.String getNamespaceURI()
Get the NameSpaceURI- Specified by:
getNamespaceURIin interfaceorg.w3c.dom.Node- Overrides:
getNamespaceURIin classorg.apache.xerces.dom.ElementNSImpl- Returns:
- String The nameSpaceURI
-
xmlnsPrefix
public static java.lang.String xmlnsPrefix(java.lang.String nodeName)
Parses pc for it's namespace prefix- Parameters:
nodeName- string to parse- Returns:
- String namespace prefix of element - null if no ":" is in nodeName or nodeName starts with ":"
-
getLocalNameStatic
@Deprecated public static java.lang.String getLocalNameStatic(KElement kElem)
Deprecated.use getLocalNameGets the local name of kElem- Parameters:
kElem- the element to get the LocalName from- Returns:
- String the local name of 'this'
-
setAttributes
public int setAttributes(JDFAttributeMap map)
Sets the attributes from the curent element. If Attributes map is null or empty, zero is returned. otherwhise the size of the map is returned- Parameters:
map- map of attributes to set- Returns:
- int size of the map or zero if empty
-
setAttributes
public int setAttributes(KElement kElem)
Sets the attributes from the curent element to the attributes from kElem. If the Attributes map from kElem is empty (kElem has no attributes), zero is returned. Otherwhise the size of the map (number of attributes from kElem) is returned.- Parameters:
kElem- the attribute source- Returns:
- int number of elements from kElem
-
setAttributesRaw
public void setAttributesRaw(KElement kElem)
Sets the attributes from the current element to the attributes from kElem. If the Attributes map from kElem is empty (kElem has no attributes), zero is returned. Otherwise the size of the map (number of attributes from kElem) is returned.- Parameters:
kElem- the attribute source
-
setAttributes
public int setAttributes(KElement kElem, VString ignoreList)
Sets the attributes from the curent element to the attributes from kElem. If the Attributes map from kElem is empty (kElem has no attributes), zero is returned. Otherwhise the size of the map (number of attributes from kElem) is returned.- Parameters:
kElem- the attribute sourceignoreList-- Returns:
- int number of elements from kElem
-
getAttributeMap
public JDFAttributeMap getAttributeMap()
Get the Attribute Map of the actual element- Returns:
- JDFAttributeMap the attribute map of the actual element - never null
-
getAttributeMap_KElement
public JDFAttributeMap getAttributeMap_KElement()
Get the Attribute Map of the actual element- Returns:
- JDFAttributeMap the attribute map of the actual element
-
init
public boolean init()
Method init. Superclass of all inits- Returns:
- boolean true always
-
appendElement
public KElement appendElement(java.lang.String elementName, java.lang.String nameSpaceURI)
- Parameters:
elementName- the elementname with namespace prefix "xyz:abc"nameSpaceURI- the namespace of the element "null" is valid if the namespace was specified already above. The method will lookup the namespace for you. Performance wise its better to add it nevertheless.- Returns:
- KElement the appended element or null
- Throws:
JDFException- if you tried to append an element into an unspecified namespace
-
appendElementRaw
public KElement appendElementRaw(java.lang.String elementName, java.lang.String nameSpaceURI)
appends an element without any namespace validity checks or initialization Faster but not sa safe...- Parameters:
elementName- element namenameSpaceURI- element namespace- Returns:
- the newly created element
- Since:
- 090216
-
appendElement
public KElement appendElement(java.lang.String elementName)
append a DOM element. This function creates a new element in the given namespace and appends it there.- Parameters:
elementName- the name of the element to append- Returns:
- KElement the appended element
-
copyElements
public void copyElements(VElement v, KElement beforeChild)
append all children in a vector of elements in the order of the vector- Parameters:
v- the vector of elements to append, if null nothing happensbeforeChild- the child before which to append the elements of the vector
-
deleteNode
public KElement deleteNode()
Deletes itself from its parent- Returns:
- KElement - the deleted element, null if this has no parent node
-
getChildElementArray
public KElement[] getChildElementArray()
gets an array of the direct children of the current element- Returns:
- KElement[] the array of direct children
-
getChildList
public java.util.List<KElement> getChildList()
never null list of all kids- Returns:
-
getChildElementVector
@Deprecated public VElement getChildElementVector(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bAnd, int maxSize)
Deprecated.060302 - use 6 parameter versionGet all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElements- Parameters:
nodeName- element name you are searching fornameSpaceURI- nameSpace you are searching formAttrib- attributes you are lokking forbAnd- if true, a child is only added if it has all attributes specified in Attributes mAttribmaxSize- maximum size of the element vector- Returns:
- VElement vector with all found elements
-
getChildElementVector
public VElement getChildElementVector(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bAnd, int maxSize, boolean bResolveTarget)
Get all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElements- Parameters:
nodeName- element name you are searching fornameSpaceURI- nameSpace you are searching formAttrib- attributes you are lokking forbAnd- if true, a child is only added if it has all attributes specified in Attributes mAttribmaxSize- maximum size of the element vector (0=any)bResolveTarget- if true, IDRef elements are followed, dummy at this level but needed in JDFElement- Returns:
- VElement vector with all found elements, an empty vector if no elements match
-
getChildElementVector
public VElement getChildElementVector(java.lang.String nodeName, java.lang.String nameSpaceURI)
Get all children from the actual element matching the given conditions
convenience for getChildElementVector(nodeName, nameSpaceURI, null, true, 0, true)- Parameters:
nodeName- element name you are searching fornameSpaceURI- nameSpace you are searching for- Returns:
- VElement vector with all found elements, an empty vector if no elements match
-
getChildList
public java.util.List<KElement> getChildList(java.lang.String nodeName, java.lang.String nameSpaceURI)
Get all children from the actual element matching the given conditions
convenience for getChildElementVector(nodeName, nameSpaceURI, null, true, 0, true)- Parameters:
nodeName- element name you are searching fornameSpaceURI- nameSpace you are searching for- Returns:
- VElement vector with all found elements, an empty vector if no elements match
-
getChildArray
public java.util.Collection<KElement> getChildArray(java.lang.String nodeName, java.lang.String nameSpaceURI)
Get all children from the actual element matching the given conditions
convenience for getChildElementVector(nodeName, nameSpaceURI, null, true, 0, true)- Parameters:
nodeName- element name you are searching fornameSpaceURI- nameSpace you are searching for- Returns:
- VElement vector with all found elements, an empty vector if no elements match
-
getChildElementVector_KElement
public VElement getChildElementVector_KElement(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bAnd, int maxSize)
Get all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElements- Parameters:
nodeName- element name you are searching fornameSpaceURI- nameSpace you are searching formAttrib- attributes you are lokking forbAnd- if true, a child is only added if it has all attributes specified in Attributes mAttribmaxSize- maximum size of the element vector- Returns:
- VElement vector with all found elements, an empty vector if no elements match
- See Also:
getChildElementVector(java.lang.String, java.lang.String, org.cip4.jdflib.datatypes.JDFAttributeMap, boolean, int)
-
getChildArray_KElement
public java.util.List<KElement> getChildArray_KElement(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bAnd, int maxSize)
Get all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElements- Parameters:
nodeName- element name you are searching fornameSpaceURI- nameSpace you are searching formAttrib- attributes you are lokking forbAnd- if true, a child is only added if it has all attributes specified in Attributes mAttribmaxSize- maximum size of the element vector- Returns:
- VElement vector with all found elements, an empty List if no elements match
- See Also:
getChildElementVector(java.lang.String, java.lang.String, org.cip4.jdflib.datatypes.JDFAttributeMap, boolean, int)
-
removeChildrenByClass
public void removeChildrenByClass(java.lang.Class<? extends org.w3c.dom.Node> clazz)
- Parameters:
clazz- the class of the children to zapp
-
getChildrenByClass
@Deprecated public <A extends KElement> java.util.Vector<A> getChildrenByClass(java.lang.Class<A> clazz, boolean bRecurse, int nMax)
Deprecated.use getChildArrayByClass- Parameters:
clazz-bRecurse-nMax-- Returns:
-
getChildArrayByClass
public <A extends KElement> java.util.List<A> getChildArrayByClass(java.lang.Class<A> clazz, boolean bRecurse, int nMax)
Get all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElements never null- Type Parameters:
A-- Parameters:
clazz-bRecurse- if true recurse through all children, grandchildren etc.nMax- maximum number to search - if 0 or negative, search all- Returns:
- Vector vector with all found elements, never null
- See Also:
getChildElementVector(java.lang.String, java.lang.String, org.cip4.jdflib.datatypes.JDFAttributeMap, boolean, int)
-
getChildArrayByClass_KElement
public <A extends KElement> java.util.List<A> getChildArrayByClass_KElement(java.lang.Class<A> clazz, boolean bRecurse, int nMax)
Get all children from the actual element matching the given conditions
does NOT get refElement targets although the attributes are checked in the target elements in case of refElements never null- Type Parameters:
A-- Parameters:
clazz-bRecurse- if true recurse through all children, grandchildren etc.nMax- maximum number to search - if 0 or negative, search all- Returns:
- Vector vector with all found elements, never null
- See Also:
getChildElementVector(java.lang.String, java.lang.String, org.cip4.jdflib.datatypes.JDFAttributeMap, boolean, int)
-
getChildWithAttribute
public <A extends KElement> A getChildWithAttribute(java.lang.Class<A> clazz, java.lang.String attName, java.lang.String attVal)
-
getChildWithAttribute
public <A extends KElement> A getChildWithAttribute(java.lang.Class<A> clazz, java.lang.String attName, java.lang.String attVal, boolean recurse)
-
getFirstChildElement
public KElement getFirstChildElement()
get the first child element- Returns:
- KElement the first child element of type ELEMENT_NODE if existing otherwise null
-
getNextSiblingElement
public KElement getNextSiblingElement()
get the next sibling element- Returns:
- KElement the next sibling element is existing otherwise null
-
getPreviousSiblingElement
public KElement getPreviousSiblingElement()
get the previous sibling element- Returns:
- KElement the previous sibling element is existing otherwise null
-
getNextSiblingElement
public <a extends KElement> a getNextSiblingElement(java.lang.Class<a> clazz)
Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.- Type Parameters:
a-- Parameters:
clazz- the class of the sibling- Returns:
- KElement the next sibling element of 'this', null if none is found
-
getFirstChildElement
public <a extends KElement> a getFirstChildElement(java.lang.Class<a> clazz)
Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.- Type Parameters:
a-- Parameters:
clazz- the class of the sibling- Returns:
- KElement the next sibling element of 'this', null if none is found
-
getNextSiblingElement
public KElement getNextSiblingElement(java.lang.String nodeName, java.lang.String nameSpaceURI)
Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.- Parameters:
nodeName- the name of the siblingnameSpaceURI- the namespace of the sibling- Returns:
- KElement the next sibling element of 'this', null if none is found
-
getFirstChildElement
public KElement getFirstChildElement(java.lang.String nodeName, java.lang.String nameSpaceURI)
Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.- Parameters:
nodeName- the name of the siblingnameSpaceURI- the namespace of the sibling- Returns:
- KElement the next sibling element of 'this', null if none is found
-
getPreviousSiblingElement
public KElement getPreviousSiblingElement(java.lang.String nodeName, java.lang.String nameSpaceURI)
Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.- Parameters:
nodeName- the name of the siblingnameSpaceURI- the namespace of the sibling- Returns:
- KElement the previous sibling element of 'this', null if none is found
-
includesAttributes
public boolean includesAttributes(JDFAttributeMap aMap, boolean bAnd)
Checks if the actual element contains the attributes given in aMap- Parameters:
aMap- the attribute names to checkbAnd- true if you want to make sure all given attributes in aMap are present. False if it is enough if only one attribute in aMap is present- Returns:
- boolean: true if present
-
includesAttribute
public boolean includesAttribute(java.lang.String attName, java.lang.String attValue)Check if an attribute is present. If attValue is '*', "" or null it is checked if the element attName is present. Only for simple attributes where an exact .equals match is appropriate, for ranges and rangelists use JDFElement.includesMatchingAttributes()- Parameters:
attName- the name of the attributeattValue- the value of the attribute- Returns:
- boolean true if present
-
getChildrenByTagName
public VElement getChildrenByTagName(java.lang.String elementName)
convenience helper- Parameters:
elementName-- Returns:
-
getChildrenByTagName
public VElement getChildrenByTagName(java.lang.String elementName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd, int maxSize)
Gets children of 'this' by tag name, nameSpaceURI and attribute map, if the attribute map is not empty.
Searches the entire tree including hidden nodes that are children of non-matching nodes- Parameters:
elementName- elementname you are searching fornameSpaceURI- nameSpace you are searching formAttrib- map of attributes you are looking for
Wildcards in the attribute map are supportedbDirect- if true, return value is a vector only of all direct child elements.
Otherwise the returned vector contains nodes of arbitrary depthbAnd- if true, a child is only added, if it includes all attributes, specified in mAttribmaxSize- maximum size of the element vector. maxSize is ignored if bDirect is false- Returns:
- VElement: vector with all found elements
- See Also:
getChildElementVector(java.lang.String, java.lang.String, org.cip4.jdflib.datatypes.JDFAttributeMap, boolean, int, boolean)
-
getChildrenByTagName_KElement
public VElement getChildrenByTagName_KElement(java.lang.String elementName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd, int maxSize)
Gets children of 'this' by tag name, nameSpaceURI and attribute map, if the attribute map is not empty.
Searches the entire tree including hidden nodes that are children of non-matching nodes- Parameters:
elementName- elementname you are searching fornameSpaceURI- nameSpace you are searching formAttrib- map of attributes you are looking for
Wildcards in the attribute map are supportedbDirect- if true, return value is a vector only of all direct child elements.
Otherwise the returned vector contains nodes of arbitrary depthbAnd- if true, a child is only added, if it includes all attributes, specified in mAttribmaxSize- maximum size of the element vector. maxSize is ignored if bDirect is false- Returns:
- VElement: vector with all found elements
- See Also:
getChildElementVector(java.lang.String, java.lang.String, org.cip4.jdflib.datatypes.JDFAttributeMap, boolean, int, boolean)
-
getElementsByTagName_KElement
public VElement getElementsByTagName_KElement(java.lang.String s, java.lang.String nameSpaceURI)
wrappers of DOM routines that dont bang on null nodes- Parameters:
s- the local name of the elements to match onnameSpaceURI- the namespace URI of the elements to match on- Returns:
- VElement a new NodeList object containing all the matched Elements
-
getChildrenWithAttribute
@Deprecated public VElement getChildrenWithAttribute(java.lang.String nodeName, java.lang.String attName, java.lang.String nameSpaceURI, java.lang.String attVal, boolean bDirect)
Deprecated.use getChildrenByTagName(nodeName, nameSpaceURI, new JDFAttributeMap(attName, attVal), bDirect, true, 0);Get a vector of all children with a matching attribte- Parameters:
nodeName- elementname you are searching forattName- attributes you are looking fornameSpaceURI- nameSpace you are searching forattVal- value of the attribute you are searching forbDirect- if true : return only direct children if false : search recursively- Returns:
- VElement - vector with all found elements
-
getCreateElement
public KElement getCreateElement(java.lang.String nodeName)
Get the actual element, create if not there- Parameters:
nodeName- name of the node from the element- Returns:
- KElement the requested element
-
getMultipleIDs
public VString getMultipleIDs(java.lang.String attName)
Get a vector of all IDs that occur multiple times- Parameters:
attName- name of the attribute to test for- Returns:
- VString the list of multiply occurring ID values, null if all is well
-
getCreateElement
public KElement getCreateElement(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)
Get the actual element, create if not there- Parameters:
nodeName- name of the node from the elementnameSpaceURI- the name of the namespaceURIiSkip- which one you want- Returns:
- KElement the requested element
-
getCreateElement_KElement
public KElement getCreateElement_KElement(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)
Gets the iSkip-th child node with matching nodeName and nameSpaceURI, optionally creates it if it doesn't exist.
If iSkip is more than one larger that the number of elements only one is appended- Parameters:
nodeName- name of the child node to getnameSpaceURI- namespace to search foriSkip- number of matching child nodes to skip- Returns:
- KElement the matching child element
-
getElement
public KElement getElement(java.lang.String nodeName)
Get the actual element - utility routine.- Parameters:
nodeName- Name of the node- Returns:
- KElement - the child node
-
getElement
public KElement getElement(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)
Gets an existing iSkip-th child node with matching nodeName and nameSpaceURI- Parameters:
nodeName- name of the child node to getnameSpaceURI- namespace to search foriSkip- number of matching child nodes to skip- Returns:
- KElement the matching child element
-
getElementHashMap
public java.util.HashMap<java.lang.String,KElement> getElementHashMap(java.lang.String elementName, java.lang.String elementNS, java.lang.String attName)
performance enhanced function to access multiple elements e.g. by ID get a HashMap of key= attribute value, object=element- Parameters:
elementName- the names of the elements, wildcard if nullelementNS- the namespace URI of the elements, any if nullattName- the attribute name - MUST not be null- Returns:
- a hashmap of the matching elements
-
getElement_KElement
public KElement getElement_KElement(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)
getElement - Get the actual element- Parameters:
nodeName- Name of the nodenameSpaceURI- Name of the namespaceURI to search iniSkip- number of element to get, if negative count backwards (-1 is the last)- Returns:
- KElement the child node
-
getElementByClass
public <A extends KElement> A getElementByClass(java.lang.Class<A> clazz, int iSkip, boolean bRecurse)
getElement - Get the actual element by java class- Type Parameters:
A- the data type to return- Parameters:
clazz- java class of the requested elementiSkip- number of element to get, if negative count backwards (-1 is the last)bRecurse- if true recurse sub elements- Returns:
- KElement the child node
-
getDeepParent
public KElement getDeepParent(java.lang.String parentNode, int depth)
Get the n'th Ancestor node with name parentNode- Parameters:
parentNode- name of the parent node to search fordepth- which one you want to have in order of appearance- Returns:
- KElement the n'th ancestor node with name nodeName
-
getDeepParent
@Deprecated public KElement getDeepParent(java.util.Vector vParentElement, int depth)
Deprecated.- loop over the single node methodGet the ancestor which may have one of the node names defined in parentNode- Parameters:
vParentElement- vector with node names to search fordepth- which one you want to have (in order of appearance)- Returns:
- KElement the first ancestor node with name nodeName
-
getDocRoot
public KElement getDocRoot()
Gets the root element of the current document- Returns:
- KElement the root element of the current document
-
getAttributeVector
public VString getAttributeVector()
Gets all attribute keys of 'this' as a vector of strings- Returns:
- vWString: a vector of all attribute keys in 'this'
-
getAttributeVector_KElement
public VString getAttributeVector_KElement()
Gets all attribute keys of 'this' as a vector of strings- Returns:
- VString: a vector of all attribute keys in 'this'
-
getAttributeArray_KElement
public java.util.List<java.lang.String> getAttributeArray_KElement()
Gets all attribute keys of 'this' as a vector of strings- Returns:
- VString: a vector of all attribute keys in 'this'
-
getAttributeIgnoreCase
public java.lang.String getAttributeIgnoreCase(java.lang.String key)
Gets an atrribute if the local name- Returns:
- VString: a vector of all attribute keys in 'this'
-
getTarget
public KElement getTarget(java.lang.String id, java.lang.String attrib)
looking for a specified target with an id, e.g. resource.
Offers access to exactly KElements implementation of GetTarget even if called for an instance of one of it's subclasses.default: getTarget(id, JDFCoreConstants.ID)
- Parameters:
id- value of the ID tag to searchattrib- name of the ID tag, defaults to "ID"- Returns:
- KElement - the element if existing, otherwise
null
-
getTarget_KElement
public KElement getTarget_KElement(java.lang.String id, java.lang.String attrib)
Gets the target of link. Follows an ID-IDREF pair by recursively searching for an attrib with the value id- Parameters:
id- value of the ID tag to searchattrib- name of the ID tag, defaults to "ID"- Returns:
- KElement the target of link - the element node.
-
getElementNameVector
public VString getElementNameVector()
Returns a vector which contains the childs of the actual element. But every child only once.- Returns:
- Vector vector with the childs of the actual element. Ever child typ is only added once.
-
getFirstElementNode
@Deprecated public static org.w3c.dom.Element getFirstElementNode(org.w3c.dom.Element parent)
Deprecated.use elem.getFirstChildElementget the first child element- Parameters:
parent- the node to get the first element node from- Returns:
- Element - the first child element if existing otherwise null
-
getNextElementNode
@Deprecated public static org.w3c.dom.Element getNextElementNode(org.w3c.dom.Element elem)
Deprecated.- use elem.getNextSiblingElement();get the next sibling element- Parameters:
elem- the Element to get the next element node from- Returns:
- Element the first sibling element if existing otherwise null
-
isEqual
public boolean isEqual(KElement kElem)
Checks if the contents of this element are equal to element kElem
differs from @see equals because nodes that are in different locations or documents but have the same name, attributes and elements are considered equal- Parameters:
kElem- the element to compare- Returns:
- boolean true if equal
-
getChildNodes_KElement
@Deprecated public VElement getChildNodes_KElement()
Deprecated.use getChildElementVector(null, null, null, true, 0)Get all child nodes from the actual element- Returns:
- VElement list of all childs
-
isAncestor
public boolean isAncestor(KElement child)
checks if KElement child is ancestor or not- Parameters:
child- child to check- Returns:
- boolean true if anchestor
-
ancestorDistance
public int ancestorDistance(KElement child)
distance to ancestor (0=this)- Parameters:
child- child to check- Returns:
- int distance to ancestor, -1 if no direct descendant
-
numChildElements
public int numChildElements(java.lang.String node, java.lang.String nameSpaceURI)Get the number of child elements. If String 'node' is an empty string or '*', all nodes are counted.default: numChildElements(null, null)
- Parameters:
node- the nodes with name 'node' to countnameSpaceURI- the nameSpace to look in- Returns:
- int the number of matching child elements
-
numChildrenByClass
public int numChildrenByClass(java.lang.Class<?> clazz, boolean bRecurse)Get the number of child elements of a certain class- Parameters:
clazz- the child classbRecurse- if true search the tree- Returns:
- int the number of matching child elements
-
numChildElements_KElement
public int numChildElements_KElement(java.lang.String node, java.lang.String nameSpaceURI)Get the number of child elements. If String 'node' is null, an empty string or '*', all nodes are counted. This method is the same as numChildElements but prevents before the maybe unwanted virtuality of numChildElements.default: numChildElements_KElement(null, null)
- Parameters:
node- the nodes with name 'node' to countnameSpaceURI- the nameSpace to look in- Returns:
- int the number of matching child elements
-
removeChild
public KElement removeChild(java.lang.String node, java.lang.String nameSpaceURI, int n)
Removes the n'th child node that matches 'nodeName' and 'nameSpaceURI'- Parameters:
node- name of the child node to remove, if empty; or "*" removes the n'th elementnameSpaceURI- namespace to search inn- number of nodes to skip before deleting- Returns:
- KElement the removed element
-
getChildByTagName
public KElement getChildByTagName(java.lang.String s, java.lang.String nameSpaceURI, int index, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd)
Get a child from the actual element by the tag name.default: getChildByTagName(s, null, 0, null, true, true)
- Parameters:
s- elementname you are searching fornameSpaceURI- nameSpace you are searching forindex- if more then one child match the condition you can specify which one you want to have via the indexmAttrib- attributes you are lokking forbDirect- if true return value is directly the elemement. Otherwise the return value is the node of the found element. Only direct child, not grandchild etc.bAnd- if true, a child is only returned if it has all attributes specified in mAttrib- Returns:
- KElement the found child (element or node), null if index < 0 or index < number of matching children
-
removeChildren
public void removeChildren(java.lang.String nodeName, java.lang.String nameSpaceURI)Remove children that matchnodeNameandnameSpaceURIdefault: removeChildren(nodeName, nameSpaceURI, null)
- Parameters:
nodeName- name of the child node to get, if empty or null remove allnameSpaceURI- namespace to search in
-
removeChildren
public void removeChildren(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib)Removes the children namednodeNamein the namespacenameSpaceURIfrom the parent elementdefault: removeChildren(null,null,null)
- Parameters:
nodeName- name of the element typ to removenameSpaceURI- namespace in which the elements are to be removedmAttrib- map of attributes to match
-
removeFromAttribute
public int removeFromAttribute(java.lang.String key, java.lang.String token, java.lang.String nameSpaceURI, java.lang.String sep, int nMax)Removes the attribute value from its value list
Removes the contents of value from the existing attribute key. Deletes the attribute Key, if it has no value.
removeFromAttribute("key","next","",",", -1)applied toresults in- Parameters:
key- attribute keytoken- string to removenameSpaceURI- namespace of attribute keysep- separator between the valuesnMax- maximum number of value instances to remove (-1 = all)- Returns:
- int number of removed instances
-
flush
public boolean flush()
Flush - remove all attributes, elements and text, leaving only a stub tag- Returns:
- boolean true always
-
getChildNodeVector
@Deprecated public java.util.Vector getChildNodeVector(int maxSize)
Deprecated.Get all or the spezified number of childs nodes from the actual element a maxSize of 0 spezifies all children.default: getChildNodeVector(0)
- Parameters:
maxSize-- Returns:
- Vector vector with all found nodes
-
removeAttributes
public void removeAttributes(java.util.Collection<java.lang.String> attribs)
Removes all attributes spezified in attribs. If attribs is empty, all attributes are removed- Parameters:
attribs- list of attributes to remove, if null, remove all
-
eraseEmptyAttributes
public void eraseEmptyAttributes(boolean bRecurse)
remove all empty attributes from this (e.g. att="")- Parameters:
bRecurse- if true, alse recurse subelements, else only local
-
getDeepElement
@Deprecated public KElement getDeepElement(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)
Deprecated.use getChildByTagName(nodeName, nameSpaceURI, iSkip, null, false, true);You can get the iSkip element named by nodeName. If there is no element present, a new empty element is returned. If iSkip is out of range, a new element is returned.default: getDeepElement(nodeName, null, 0)
- Parameters:
nodeName- the type of element you want to getnameSpaceURI- the namespace to search in !!! NOT USED IN FUCTION !!!iSkip- which element you want to have (order of appearance)- Returns:
- KElement the iSkip element or a new element
-
getChildFromList
@Deprecated public KElement getChildFromList(VString nodeNames, int iSkip)
Deprecated.use getChildFromList(Vector nodeNames, int iSkip, JDFAttributeMap map)- Parameters:
nodeNames-iSkip-- Returns:
- KElement
-
getChildFromList
public KElement getChildFromList(VString nodeNames, int iSkip, JDFAttributeMap map, boolean bDirect)
Get any Child that matches a string defined in nodeNames. The method compares the strings with the element namedefault: getChildFromList(nodeNames, 0, null)
- Parameters:
nodeNames- container for the node name stringiSkip- how many of the found child should be skipedmap- map of attributes to matchbDirect-- Returns:
- KElement a child matching the condition
-
renameElement
public KElement renameElement(java.lang.String newName, java.lang.String nameSpaceURI)
Rename the element with the String newName. Attention. the Java class of the element does not get modified. It is up to the caller to ensure that no inconsistent types get created with renamedefault: renameElement(newName, null)
- Parameters:
newName- the new name of the actual elementnameSpaceURI- the new nameSpace, ignored if null- Returns:
- KElement the renamed child, i.e. this
-
removeExtensions
public void removeExtensions(java.lang.String nsURI)
remove all elements and attributes of a given namespace- Parameters:
nsURI- the ns uri of the extensions to remove
-
moveMe
public KElement moveMe(KElement beforeChild)
moves this to a position before another child, fails if either this or beforechild are document roots- Parameters:
beforeChild- the child to move before, if beforechild is a the document root, do nothing if null, move me to the end of my parent- Returns:
- this after moving, null if failure
-
moveElement
public KElement moveElement(KElement src, KElement beforeChild)
Moves src node (including all attributes and subelements) from its parent node into 'this' and inserts it in front of beforeChild, if it exists. Otherwise appends src to 'this'.
If src isnull, an empty KElement is returned.
src is removed from its parent node. if the actual document owner is the same as the document owner of src, src is appended to 'this' If the documents are different, then src is appended to 'this' in the actual document.default: moveElement(src, null)
- Parameters:
src- node to move.beforeChild- child of 'this' to insert src before. If beforeChild is null, src is appended to 'this'- Returns:
- KElement src element after moving, null if src is null
- Throws:
JDFException- if beforeChild is not a child of 'this'
-
clearTargets
protected void clearTargets()
-
moveElements
@Deprecated public void moveElements(VElement v, KElement beforeChild)
Deprecated.use moveArray- Parameters:
v-beforeChild-
-
moveArray
public void moveArray(java.util.Collection<KElement> v, KElement beforeChild)
move all children in a vector of elements in the order of the vector- Parameters:
v- the vector of elements to append, if null nothing happensbeforeChild- the child before which to append the elements of the vector
-
eraseEmptyNodes
public int eraseEmptyNodes(boolean bTrimWhite)
Erases all empty text nodes in 'this' and its subelements If there any empty text nodes removes them. If bTrimWhite is true, then trims white spaces from both ends of a text node and only then, if it is empty, removes it- Parameters:
bTrimWhite- trims whitespace of text, default = true- Returns:
- int the number of removed nodes
-
copyElement
public KElement copyElement(KElement src, KElement beforeChild)
Copies src node (including all attributes and subelements) and inserts the copy into 'this' in front of beforeChild, if it exists. Otherwise appends src node to 'this'.default: copyElement(src, null)
- Parameters:
src- node to copy.beforeChild- child of 'this' to insert src before. If null, src is appended- Returns:
- KElement the copied element,
nullif src isnull.
-
copyInto
public KElement copyInto(KElement src, boolean bRemove)
copies a node into this, ignoring identical node names i.e. duplicating elements- Parameters:
src-bRemove- if true, remove existing information, else retain and overwrite / merge- Returns:
- this
-
replaceElement
public KElement replaceElement(KElement src)
Replaces 'this' with src.
If the actual document is the same as the src document, 'this' is replaced by src.
If the actual document and the src document are different, src is positioned at the position of 'this' in the current document and removed from the old parent document.- Parameters:
src- node, that 'this' will be replaced with- Returns:
- KElement the replaced element. If src is null or equal 'this', src is returned.
- Since:
- 130103 ReplaceElement works on all elements including the document root
-
getLongAttribute
public long getLongAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, long def)Get a long attribute if presentdefault: getLongAttribute(attrib, null, 0)
- Parameters:
attrib- attribute to parse for an integer attributenameSpaceURI- nameSpaceURI to search indef- the default to return if the value is empty or the attribute is not set- Returns:
- the parsed int. If the attribute was not found,
long defis returned.
-
getIntAttribute
public int getIntAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, int def)Get a integer attribute if presentdefault: getIntAttribute(attrib, null, 0)
- Parameters:
attrib- attribute to parse for an integer attributenameSpaceURI- nameSpaceURI to search indef- the default to return if the value is not set or the attribute does not exists- Returns:
- int the parsed int. If the attribute was not found int def is returned
-
getBoolAttribute
public boolean getBoolAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, boolean def)get a boolean attributedefault: getBoolAttribute(attrib, null, false)
- Parameters:
attrib- attribute to parse for a boolean valuenameSpaceURI- nameSapceURI to search indef- the default to return if value is not set or the attribute does not exists- Returns:
- boolean the boolean value or the def parameter
-
getRealAttribute
public double getRealAttribute(java.lang.String attrib, java.lang.String nameSpaceURI, double def)get a double attributedefault: getRealAttribute(attrib, null, 0.0)
- Parameters:
attrib- attribute to parse for a boolean valuenameSpaceURI- nameSapceURI to search indef- default to return if none value is set or attribute does not exist- Returns:
- double the double value or
def
-
getDeepParentNotName
public KElement getDeepParentNotName(java.lang.String thisNode)
Get the Ancestor node with name other than thisNode- Parameters:
thisNode- serch string- Returns:
- KElement parent node element
-
getDeepParentChild
public KElement getDeepParentChild(java.lang.String parentNode)
Get the first child of parentNode with name parentNode- Parameters:
parentNode- node name to search for- Returns:
- KElement the matching child of the parent element
-
appendXMLComment
@Deprecated public void appendXMLComment(java.lang.String commentText)
Deprecated.use appendXMLComment(commentText, null);append a DOM comment<!-- XMLComment -->The double minus sign '--' is escaped with an underscore '_' in order to ensure valid xml- Parameters:
commentText- the comment to append
-
appendXMLComment
public org.w3c.dom.Node appendXMLComment(java.lang.String commentText, KElement beforeChild)append a DOM comment<!-- XMLComment -->The double minus sign '--' is escaped with an underscore '_' in order to ensure valid xml- Parameters:
commentText- the comment to appendbeforeChild- the child of this that the Comment should be appended before. if null, append the Comment- Returns:
- the newly created xml comment
-
setXMLComment
public void setXMLComment(java.lang.String commentText)
set a DOM comment<!-- XMLComment -->in front ofthisif an xml Comment node already exists directly in front ofthis, the previous comment is removed The double minus sign '--' is escaped with an underscore '_' in order to ensure valid xml- Parameters:
commentText- the comment text to set Convenience - seesetXMLComment(String,boolean)
-
setXMLComment
public void setXMLComment(java.lang.String commentText, boolean single)set a DOM comment<!-- XMLComment -->in front ofthisif an xml Comment node already exists directly in front ofthis, the previous comment is removed The double minus sign '--' is escaped with an underscore '_' in order to ensure valid xml- Parameters:
commentText- the comment text to setsingle- TODO
-
appendCData
public void appendCData(java.lang.String cDataText)
Appends XML CData section<![CDATA[ CData Section ]]>some character data
Appends a new CData section child node to the end of 'this '- Parameters:
cDataText- the text of the XML CData section to append
-
appendCData
public void appendCData(KElement cDataElem)
Appends XML CData section<![CDATA[ CData Section ]]>some character data
Appends a new CData section child node to the end of 'this '- Parameters:
cDataElem- the element of the XML CData section to append
-
appendText
public void appendText(java.lang.String textName)
append some generic text- Parameters:
textName- the text to append
-
appendEntityReference
public void appendEntityReference(java.lang.String refName)
appends a entity reference to the actual element- Parameters:
refName- the name of the entity reference
-
appendTextElement
public KElement appendTextElement(java.lang.String nodeName, java.lang.String text)
append a text element with text included- Parameters:
nodeName- node name of the text elementtext- the text to apend- Returns:
- KElement the appended text element
-
mergeElement
public KElement mergeElement(KElement kElem, boolean bDelete)
merge nodes in a way that no duplicate elements are created
attention !! this kills pools !! since elements in kElem overwrite those in *this- Parameters:
kElem- the node element to merge with the current nodebDelete- if true KElement kElem will be deleted- Returns:
- KElement the merged node element
-
getChildWithAttribute
public KElement getChildWithAttribute(java.lang.String nodeName, java.lang.String attName, java.lang.String nameSpaceURI, java.lang.String attVal, int index, boolean bDirect)
GetChildWithAttribute - Get a child with matching attributesdefault: getChildWithAttribute(nodeName, attName, null,attValue, 0, true)
- Parameters:
nodeName- name of the child node to search forattName- attribute name to search fornameSpaceURI- namespace to search forattVal- the attribute value to search for, Wildcard supported (null)index- if more then one child meets the condition, you can specify the one to return via an indexbDirect- if true, looks only in direct children, else search through all children, grandchildren etc.- Returns:
- KElement the element which matches the above conditions
-
getCreateChildWithAttribute
public KElement getCreateChildWithAttribute(java.lang.String nodeName, java.lang.String attName, java.lang.String nameSpaceURI, java.lang.String attVal, int index)
GetChildWithAttribute - Get a child with matching attributes; craete it if it does not existdefault: getChildWithAttribute(nodeName, attName, null,attValue, 0, true)
- Parameters:
nodeName- name of the child node to search forattName- attribute name to search fornameSpaceURI- namespace to search forattVal- the attribute value to search for, Wildcard supported (null)index- if more then one child meets the condition, you can specify the one to return via an index- Returns:
- KElement the element which matches the above conditions
-
hasChildElement
public boolean hasChildElement(java.lang.String nodeName, java.lang.String nameSpaceURI)Checks whether the current element has a child element NodeNamedefault: hasChildElement(String nodeName, null)
- Parameters:
nodeName- name of the node to check fornameSpaceURI- nameSpaceURI to search in- Returns:
- boolean true if there is a child with nodeName, otherwise false
-
getInheritedElement
public KElement getInheritedElement(java.lang.String elementName, java.lang.String nameSpaceURI, int iSkip)
searches for the first child element occurence in this element or any ancestorsdefault: getInheritedElement(elementName, null, 0)
- Parameters:
elementName- name of the element to be searchednameSpaceURI- XML-namespaceiSkip- leading siblings to be skipped- Returns:
- JDFElement the element found
-
addNameSpace
public boolean addNameSpace(java.lang.String strPrefix, java.lang.String strNameSpaceURI)Adds a NameSpace and maps the prefix to a URI.
Checks all parents, whether such namespace is already defined in an ancestor- Parameters:
strPrefix- the namespace prefix to setstrNameSpaceURI- the namespace URI to set- Returns:
- boolean true if newly set, false if already there and matching
-
sortChildren
public void sortChildren()
sorts all child elements by alphabet
-
sortChildren
public void sortChildren(boolean bRecursive)
sorts all child elements by alphabet
-
sortChild
public void sortChild(KElement e)
sorts/inserts e by alphabet- Parameters:
e-
-
sortChildren
public void sortChildren(java.util.Comparator<KElement> comparator)
sorts all child elements by alphabet- Parameters:
comparator- the comparator object to sort by
-
sortChildren
public void sortChildren(java.util.Comparator<KElement> comparator, boolean bRecursive)
sorts all child elements by alphabet- Parameters:
comparator- the comparator object to sort by
-
sortChild
public void sortChild(KElement e, java.util.Comparator<KElement> comparator)
insert e into this, assuming that this is already sorted- Parameters:
e- the existing element to sortcomparator- the comparator object to sort by
-
toValueString
public java.lang.String toValueString(char sep)
get a concatinated string of all values- Returns:
-
toString
public java.lang.String toString()
this to string, used for debug purpose mostly- Overrides:
toStringin classorg.apache.xerces.dom.NodeImpl- Returns:
- string representativ of this
- See Also:
Object.toString()
-
toXML
public java.lang.String toXML()
serialize this to a string- Returns:
- String the dom element serialized as a string
- Throws:
JDFException- if an error occurs while serializing
-
toXML
public java.lang.String toXML(int indent)
serialize this to a string- Parameters:
indent-- Returns:
- String the dom element serialized as a string
- Throws:
JDFException- if an io exception occurs while serializing
-
toDisplayXML
public java.lang.String toDisplayXML(int indent)
serialize this to a string- Parameters:
indent-- Returns:
- String the dom element serialized as a string
- Throws:
JDFException- if an error occurs while serializing
-
renameAttribute
public void renameAttribute(java.lang.String oldName, java.lang.String newName, java.lang.String nameSpaceURI, java.lang.String newNameSpaceURI)Rename an attribute in this namespace
if oldName does not exist, newName is NOT modifieddefault: renameAttribute(oldName, newName, null, null)
- Parameters:
oldName- attribute name to move fromnewName- attribute name to move tonameSpaceURI- attribute nameSpaceURI to move fromnewNameSpaceURI- attribute nameSpaceURI to move the name to
-
renameAttribute
public void renameAttribute(java.lang.String oldName, java.lang.String newName)Rename an attribute in this namespace
if oldName does not exist, newName is NOT modifieddefault: renameAttribute(oldName, newName, null, null)
- Parameters:
oldName- attribute name to move fromnewName- attribute name to move to
-
getChildAttributeList
public VString getChildAttributeList(java.lang.String nodeName, java.lang.String attName, java.lang.String nameSpaceURI, java.lang.String attValue, boolean bDirect, boolean bUnique)
Get a vector of all value of the attribute attName in the children of this nodedefault: getChildAttributeList(nodeName, attName, null, JDFCoreConstants.WILDCARD, true, true)
- Parameters:
nodeName- element name you are searching forattName- attributes you are looking fornameSpaceURI- nameSpace you are searching forattValue-bDirect- if true return value is a vector of all found elements. Otherwise the returned vector contains only the nodesbUnique- if you want to make sure, the attribute is unique, set this boolean to true. Otherwise attribute attName is added to the returned vector- Returns:
- Vector - vector with attributes
-
insertBefore
public KElement insertBefore(java.lang.String elementName, org.w3c.dom.Node beforeChild, java.lang.String nameSpaceURI)
Inserts the Element elementName before the existing Element node beforeChild. If beforeChild isnull, insert elementName at the end of the list of children. If elementName is a DocumentFragment object, all of its children are inserted, in the same order, before beforeChild. If the elementName is already in the tree, it is removed first.default: insertBefore(elementName, beforeChild, null)
- Parameters:
elementName- The elementName to insert the element itself will be createdbeforeChild- The reference element, i.e., the elemente before which the new element must be insertednameSpaceURI- The namespace to create elementName in- Returns:
- KElement the element being inserted
-
getChildrenFromList
public VElement getChildrenFromList(VString nodeNames, JDFAttributeMap map, boolean bDirect, VElement v)
get a vector of all Children that match the strings defined in nodeNames- Parameters:
nodeNames- list of node names that fit, both local and qualified node names are checkedmap-bDirect-v- the vector to be filled. if null, a new empty vector will be created- Returns:
- VElement the found child elements
-
getChildrenIgnoreList
public VElement getChildrenIgnoreList(VString nodeNames, boolean bDirect, VElement v)
get a vector of all Children that do not match the strings defined in nodeNames- Parameters:
nodeNames- list of node names that fit, both local and qualified node names are checkedbDirect-v- the vector to be filled. if null, a new empty vector will be created- Returns:
- VElement the found child elements
-
appendElementN
public KElement appendElementN(java.lang.String elementName, int maxAllowed, java.lang.String nameSpaceURI)
Appends a new child element to the end of 'this', if it's maximum number of the children with defined name and nameSpace doesn't exceed maxAlloweddefault: AppendElementN(elementName, maxAllowed, null)
- Parameters:
elementName- name of the new child elementmaxAllowed- the maximum number of children with defined name and nameSpace, that are allowed for 'this'nameSpaceURI- nameSpace of the new child element- Returns:
- KElement newly created child element
- Throws:
JDFException- if more elements with name and namespace then maxAllowed already exist
-
buildXPath
@Deprecated public java.lang.String buildXPath()
Deprecated.use buildXPath(null,true);Gets the XPath full tree representation of 'this'- Returns:
- String the XPath representation of 'this' e.g.
/root/parent/element
nullif parent of this is null (e.g. called on rootnode)
-
buildXPath
@Deprecated public java.lang.String buildXPath(java.lang.String relativeTo)
Deprecated.use buildXPath(relativeTo,true);Gets the XPath full tree representation of 'this'- Parameters:
relativeTo- relative path to which to create an xpath- Returns:
- String the XPath representation of 'this' e.g.
/root/parent/element
nullif parent of this is null (e.g. called on rootnode)
-
buildXPath
public java.lang.String buildXPath(java.lang.String relativeTo, int methCountSiblings)Gets the XPath full tree representation of 'this'- Parameters:
relativeTo- relative path to which to create an xpathmethCountSiblings- , if 1 count siblings, i.e. add '[n]' if 0, only specify the path of parents if 2 or 3, add [@ID="id"]- Returns:
- String the XPath representation of 'this' e.g.
/root/parent/element
nullif parent of this is null (e.g. called on rootnode)
-
buildRelativeXPath
public java.lang.String buildRelativeXPath(KElement relativeTo, int methCountSiblings)
Gets the XPath full tree representation of 'this'- Parameters:
relativeTo- parent element to which to create an xpathmethCountSiblings- , if 1 count siblings, i.e. add '[n]' if 0, only specify the path of parents if 2 or 3, add [@ID="id"]- Returns:
- String the XPath representation of 'this' e.g.
/root/parent/element
nullif parent of this is null (e.g. called on rootnode)
-
insertAt
public KElement insertAt(java.lang.String nodeName, int beforePos, java.lang.String beforeNode, java.lang.String nameSpaceURI, java.lang.String beforeNameSpaceURI)
Creates a new child element with defined Name and NameSpace and inserts it in front of the node with a name bForeNode and namespace beforeNameSpaceURI, with index beforePosdefault: InsertAt(nodeName, beforePos, null, null, null)
- Parameters:
nodeName- name of the new ElementbeforePos- index of beforeNode, i.e if beforePos = 0, put it before the first occurrencebeforeNode- name of the node to put it before, default - any name, Wildcard supportednameSpaceURI- nameSpace of the new nodebeforeNameSpaceURI- nameSpace of the node to put it before, default - value of nameSpaceURI- Returns:
- KElement the newly created element
- Throws:
JDFException- if 'this' is a null element and thus nothing can be inserted in it
-
setXPathValue
public void setXPathValue(java.lang.String path, java.lang.String value)Sets an attribute as defined by XPath to value- Parameters:
path- XPath abbreviated syntax representation of the attribute, e.g.:parentElement/thisElement@thisAttparentElement/thisElement[2]/@thisAttparentElement/thisElement[@foo=\"bar\"]/@thisAttvalue- string to be set as attribute value
-
setXPathValues
public void setXPathValues(JDFAttributeMap map)
sets all xpaths to the values provided in map- Parameters:
map- map of XPath / values to set
-
setXPathAttribute
public void setXPathAttribute(java.lang.String path, java.lang.String value)Sets an attribute as defined by XPath to value- Parameters:
path- XPath abbreviated syntax representation of the attribute, e.g.:parentElement/thisElement@thisAttparentElement/thisElement[2]/@thisAttparentElement/thisElement[@foo=\"bar\"]/@thisAttvalue- string to be set as attribute value- Throws:
JDFException- if the defined path is a bad attribute path
-
hasXPathNode
public boolean hasXPathNode(java.lang.String path)
returns true if the element or attribute described by this XPath exists, else false- Parameters:
path- the XPath to test for- Returns:
- true if the element described by path exists
-
getXPathAttribute
public java.lang.String getXPathAttribute(java.lang.String path, java.lang.String def)Gets an attribute value as defined by XPath namespace prefixes are resolved or the node text if an element is specified- Parameters:
path- XPath abbreviated syntax representation of the attribute,parentElement/thisElement/@thisAttparentElement/thisElement[2]/@thisAttparentElement[@a=\"b\"]/thisElement[@foo=\"bar\"]/@thisAttdef- default value if it doesn't exist- Returns:
- String the String value of the attribute or null if the xpath element does not exist
- Throws:
JDFException- if the defined path is a bad attribute path
-
getInheritedXPathAttribute
public java.lang.String getInheritedXPathAttribute(java.lang.String path, java.lang.String def)Gets an attribute value as defined by XPath namespace prefixes are resolved
Attributes are searched for in partitioned resources if appropriate- Parameters:
path- XPath abbreviated syntax representation of the attribute,parentElement/thisElement/@thisAttparentElement/thisElement[2]/@thisAttparentElement[@a=\"b\"]/thisElement[@foo=\"bar\"]/@thisAttdef- default value if it doesn't exist- Returns:
- String the String value of the attribute or null if the xpath element does not exist
- Throws:
JDFException- if the defined path is a bad attribute path
-
getXPathAttributeMap
public JDFAttributeMap getXPathAttributeMap(java.lang.String path)
Gets a map of attribute values as defined by XPath namespace prefixes are resolved- Parameters:
path- XPath abbreviated syntax representation of the attribute,parentElement/thisElement/@thisAttparentElement/thisElement[2]/@thisAttparentElement[@a=\"b\"]/thisElement[@foo=\"bar\"]/@thisAttif null, assume .//@*, i.e. all of this- Returns:
- String the String value of the attribute or null if the xpath element does not exist
- Throws:
JDFException- if the defined path is a bad attribute path
-
getXPathValueMap
public JDFAttributeMap getXPathValueMap()
Gets a map of attribute values as defined by XPath namespace prefixes are resolved- Returns:
- String the String value of the xpath
-
getXPathValueMap
public JDFAttributeMap getXPathValueMap(boolean isRelative)
Gets a map of attribute values as defined by XPath namespace prefixes are resolved- Returns:
- String the String value of the xpath
-
getXPathElement
public KElement getXPathElement(java.lang.String path)
gets an element as defined by XPath to value- Parameters:
path- XPath abbreviated syntax representation of the attribute, e.gparentElement/thisElementparentElement/thisElement[2]parentElement[@a=\"b\"]/thisElement[./foo/@foo=\"bar\"]- Returns:
- KElement the specified element
- Throws:
java.lang.IllegalArgumentException- if path is not supported
-
getXPathElementVector
public VElement getXPathElementVector(java.lang.String path, int maxSize)
gets an vector of elements element as defined by XPath to value- Parameters:
path- XPath abbreviated syntax representation of the attribute, e.gparentElement/thisElementparentElement/thisElement[2]parentElement[@a=\"b\"]/thisElement[@foo=\"bar\"]maxSize-- Returns:
- VElement the vector of matching elements
- Throws:
java.lang.IllegalArgumentException- if path is not supported
-
getCreateXPathElement
public KElement getCreateXPathElement(java.lang.String path)
gets an element as defined by XPath to value and creates it if it does not exist- Parameters:
path- XPath abbreviated syntax representation of the attribute,parentElement/thisElementparentElement/thisElement[2]parentElement[@a=\"b\"]/thisElement[@foo=\"bar\"]- Returns:
- KElement the specified element
-
hasAttributes
public boolean hasAttributes()
checks if the current element has attributes- Specified by:
hasAttributesin interfaceorg.w3c.dom.Node- Overrides:
hasAttributesin classorg.apache.xerces.dom.ElementImpl- Returns:
- boolean true if at least one attribute is present
-
hasChildNodes
protected boolean hasChildNodes(int nodeType)
checks wether this has node childs of the stated node type- Parameters:
nodeType-- 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
- Returns:
- boolean true if there is at least one child of the stated node type, false otherwise
-
-
hasChildElements
public boolean hasChildElements()
checks if the current element has a child element- Returns:
- boolean - true if there is one or more child elements present
-
getTree
public VElement getTree(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd)
Get children from the actual element by the tag name, nameSpaceURI or attribute map.
GetTree only follows direct links, e.g. as in a JDF tree. Hidden nodes that are children of nodes with non-matching names are ignored- Parameters:
nodeName- elementname you are searching fornameSpaceURI- nameSpace you are searching formAttrib- attributes you are looking for. Wildcards in the attribute map are supportedbDirect- if true return value is a vector of all direct elements. Otherwise the returned vector contains nodes of arbitrary depthbAnd- if true, a child is only added if it has all attributes specified in Attributes mAttrib- Returns:
- VElement vector with all found elements
-
getTree
public java.util.List<KElement> getTree(java.lang.String nodeName)
Get children from the actual element by the tag name
GetTree only follows direct links, e.g. as in a JDF tree. Hidden nodes that are children of nodes with non-matching names are ignored- Parameters:
nodeName- elementname you are searching for- Returns:
- VElement vector with all found elements
-
getTreeByClass
public <A extends KElement> java.util.List<A> getTreeByClass(java.lang.Class<A> cl, boolean addself)
-
getTreeElement
public KElement getTreeElement(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd)
Get child from the actual element by the tag name, nameSpaceURI or attribute map. GetTree only follows direct links, e.g. as in a JDF tree. Hidden nodes that are children of non-matching nodes are ignored- Parameters:
nodeName- elementname you are searching for.
Required, no default.nameSpaceURI- nameSpace you are searching for.
Default isnullmAttrib- attributes you are looking for
Wildcards in the attribute map are supported. Default is an empty MapbDirect- if true, return value is a vector of all direct elements.
Otherwise the returned vector contains nodes of arbitrary depth.
Default is false.bAnd- if true, a child is only added if it has all attributes specified in Attributes mAttrib.
Default is true.- Returns:
- KElement the first found element
-
getText
public java.lang.String getText(int i)
gets the i'th text child node of 'this'- Parameters:
i- index of the child text node, you are searching for- Returns:
- String the text if the i'th text node.
nullif the i'th text node does not exists
-
getCData
public java.lang.String getCData(int i)
Gets of 'this' the text of the i'th XML CData section. This section may also contain < and >.- Parameters:
i- index of the CData section child node, you are searching for- Returns:
- String content of the i'th XML CData section
-
getXMLComment
public java.lang.String getXMLComment(int i)
gets of 'this' the text of the i-th child XMLComment.would returnthis is a XMLComment- Parameters:
i- index of the XMLComment child node, you are searching for- Returns:
- String text of the i-th XMLComment, null if i is higher then the number of child nodes
-
copyXPathValue
public java.lang.String copyXPathValue(java.lang.String dstXPath, KElement src, java.lang.String srcXPath)copy attribute values or text from an xpath in src to this- Parameters:
dstXPath- the destination xpath in this elementsrc- the source element, if null; use thissrcXPath- the source xpath, if null same as dstXPath- Returns:
- the copied value; may be null if no value was found in srcXPath
-
copyAttribute
public java.lang.String copyAttribute(java.lang.String attrib, KElement src, java.lang.String srcAttrib, java.lang.String nameSpaceURI, java.lang.String srcNameSpaceURI)copy an attribute from src to this, if null - remove the attributedefault: copyAttribute(attrib, src, null, null, null)
- Parameters:
attrib- the name of the attribute to copy (if source attribute is different only the value will be copied)src- source element where the attribute to be copied residessrcAttrib- attribute to copy, defaults to the value of attribnameSpaceURI- of the attribute in the destinationsrcNameSpaceURI- of the attribute in the source, defaults to the value of nameSpaceURI- Returns:
- the value of the copied attribute
-
copyAttribute
public java.lang.String copyAttribute(java.lang.String attrib, KElement src, java.lang.String srcAttrib, java.lang.String nameSpaceURI, java.lang.String srcNameSpaceURI, boolean overwriteEmpty)copy an attribute from src to this, if null - remove the attributedefault: copyAttribute(attrib, src, null, null, null)
- Parameters:
attrib- the name of the attribute to copy (if source attribute is different only the value will be copied)src- source element where the attribute to be copied residessrcAttrib- attribute to copy, defaults to the value of attribnameSpaceURI- of the attribute in the destinationsrcNameSpaceURI- of the attribute in the source, defaults to the value of nameSpaceURI- Returns:
- the value of the copied attribute
-
copyAttribute
public java.lang.String copyAttribute(java.lang.String attrib, KElement src)copy an attribute from src to this - shorthand if no renaming or namespace handling is necessarydefault: copyAttribute(attrib, src, null, null, null)
- Parameters:
attrib- the name of the attribute to copy (if source attribute is different only the value will be copied)src- source element where the attribute to be copied resides- Returns:
- the value of the copied attribute
-
copyAttribute
public java.lang.String copyAttribute(java.lang.String attrib, KElement src, boolean overwriteEmpty)copy an attribute from src to this - shorthand if no renaming or namespace handling is necessarydefault: copyAttribute(attrib, src, null, null, null)
- Parameters:
attrib- the name of the attribute to copy (if source attribute is different only the value will be copied)src- source element where the attribute to be copied resides- Returns:
- the value of the copied attribute
-
copyChildren
public void copyChildren(java.lang.String elementName, KElement src)- Parameters:
elementName-src-
-
moveAttribute
public void moveAttribute(java.lang.String attrib, KElement src, java.lang.String srcAttrib, java.lang.String nameSpaceURI, java.lang.String srcNameSpaceURI)moves an attribute from src to this, the attribute will be removed from src and moved to this.default: moveAttribute(attrib, src, null, null, null)
- Parameters:
attrib- where to move the attributesrc- element to move fromsrcAttrib- the attribute to move. If empty string, the string attrib is used as source and targetnameSpaceURI- the namespaceURI to setsrcNameSpaceURI-
-
moveAttribute
public void moveAttribute(java.lang.String attrib, KElement src)moves an attribute from src to this, the attribute will be removed from src and moved to this.- Parameters:
attrib- where to move the attributesrc- element to move from
-
hasChildText
public boolean hasChildText()
Tests, whether 'this' contains any text child nodes- Returns:
- boolean true, if there are one or more text child nodes
-
getText
public java.lang.String getText()
gets a concatenated string representing of all direct text child nodes- Returns:
- String the concatenated values of all direct text child nodes empty string if no child nodes exist
-
removeAllText
public void removeAllText()
removes all text children of the current node
-
pushUp
public KElement pushUp(java.lang.String newParentName)
Moves 'this' from parent to grandparent or to the closest ancestor with name newParentName- Parameters:
newParentName- name of the parent to recursively search, defaults to any name- Returns:
- this, null if failed (e.g. no parentNode found)
-
numChildNodes
@Deprecated public int numChildNodes(int nodeType)
Deprecated.use 2-parameter version numChildNodes(nodeType, false);count the number of child nodes of DOM nodeType nodeType (0=count all)- Parameters:
nodeType- DOM nodeType- count all = 0
- 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
- Returns:
- number of child nodes with "nodeType"
-
-
numChildNodes
public int numChildNodes(int nodeType, boolean bRecurse)count the number of child nodes of DOM nodeType nodeType (0=count all)- Parameters:
nodeType- DOM nodeType- count all = 0
- 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
bRecurse - -
removeChildNode
public boolean removeChildNode(int nodeType, int i)removes the i'th child node, that match NodeType- Parameters:
nodeType- the DOM NodeType,if 0 count all nodes- 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
i - index of the child nodes to remove-
cleanup
public void cleanup()
removes everything
-
removeChildText
public void removeChildText(int i)
Removes the i'th text node of 'this'- Parameters:
i- index of the text node to remove. First node has index 0, second 1, etc.
-
removeCData
public void removeCData(int i)
Removes the i'th XML CData section- Parameters:
i- index of the CData section child node to remove
-
removeXMLComment
public void removeXMLComment(int i)
removes the i'th XMLComment node- Parameters:
i- index of the XMLComment node to remove
-
getNumChildNodes
public int getNumChildNodes(int nodeType)
Gets the number of direct child nodes of 'this', that match NodeType- Parameters:
nodeType- the DOM NodeType, if 0 count all nodes- 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
-
getNumChildText
public int getNumChildText()
Gets the number of direct text child nodes- Returns:
- int: the number of direct text child nodes in 'this'
-
getNumCDatas
public int getNumCDatas()
gets the number of direct child CData sections- Returns:
- int: the number of direct child CData sections
-
getNumXMLComments
public int getNumXMLComments()
gets the number of direct XMLComment child nodes of 'this'- Returns:
- int: the number of direct XMLComment child nodes
-
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- 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-
xmlNameSpace
@Deprecated public static java.lang.String xmlNameSpace(java.lang.String s)
Deprecated.use xmlnsPrefix()get the namespace prefix from a qualified name. For example, nodenameexp:myexampleywould returnexp- Parameters:
s- the qualified name- Returns:
- namespace of the qualified name
-
setAttributes
@Deprecated public void setAttributes(java.lang.String[] myAttributes, java.lang.String[] strValues)Deprecated.use setAttributes(JDFAttributeMap)sets multiple attributes at once both arrays need to be of equal length.- Parameters:
myAttributes- array of attributesstrValues- array of values- Throws:
java.lang.ArrayIndexOutOfBoundsException- if the arrays are not of equal length
-
xmlnsLocalName
public static java.lang.String xmlnsLocalName(java.lang.String pc)
used by get localname- Parameters:
pc- the qualifiedname- Returns:
- the local part of the qualified name, null if no local name exists
-
getXMLNSNameSpace
@Deprecated public static java.lang.String getXMLNSNameSpace(java.lang.String pc)
Deprecated.get the namespace of the qualified name *namespace:localname
- Parameters:
pc- the qualified name.- Returns:
- the namespace of the qualified name. An Emptystring if pc is null or no namespace found.
-
setXSIType
public void setXSIType(java.lang.String typ)
- Parameters:
typ-
-
getXSIType
public java.lang.String getXSIType()
returns the xsi:type of this element, null if not present- Returns:
- String the xsi:type of this element, null if not present
-
getXMLNSPrefix
@Deprecated public static java.lang.String getXMLNSPrefix(java.lang.String pc)
Deprecated.use xmlnsPrefixParses pc for it's namespace prefixns:foowill returnns- Parameters:
pc- string to parse- Returns:
- String namespace prefix of pc, emptyspace if no ":" is in pc
-
setText
public void setText(java.lang.String text)
Sets an XML Text
the text contents of this to the value of text- Parameters:
text- XML Text to set- Throws:
JDFException- if 'this' is a null element and thus nothing can be inserted in it
-
removeAttribute
public void removeAttribute(java.lang.String attrib) throws org.w3c.dom.DOMException- Specified by:
removeAttributein interfaceorg.w3c.dom.Element- Overrides:
removeAttributein classorg.apache.xerces.dom.ElementImpl- Throws:
org.w3c.dom.DOMException- See Also:
ElementImpl.removeAttribute(java.lang.String)
-
removeAttributeNS
public void removeAttributeNS(java.lang.String nameSpaceURI, java.lang.String attrib) throws org.w3c.dom.DOMException- Specified by:
removeAttributeNSin interfaceorg.w3c.dom.Element- Overrides:
removeAttributeNSin classorg.apache.xerces.dom.ElementImpl- Throws:
org.w3c.dom.DOMException- See Also:
ElementImpl.removeAttributeNS(java.lang.String, java.lang.String)
-
removeAttributeNode
public org.w3c.dom.Attr removeAttributeNode(org.w3c.dom.Attr arg0) throws org.w3c.dom.DOMException- Specified by:
removeAttributeNodein interfaceorg.w3c.dom.Element- Overrides:
removeAttributeNodein classorg.apache.xerces.dom.ElementImpl- Throws:
org.w3c.dom.DOMException- See Also:
ElementImpl.removeAttributeNode(org.w3c.dom.Attr)
-
setAttributeNode
public org.w3c.dom.Attr setAttributeNode(org.w3c.dom.Attr arg0) throws org.w3c.dom.DOMException- Specified by:
setAttributeNodein interfaceorg.w3c.dom.Element- Overrides:
setAttributeNodein classorg.apache.xerces.dom.ElementImpl- Throws:
org.w3c.dom.DOMException- See Also:
ElementImpl.setAttributeNode(org.w3c.dom.Attr)
-
setAttributeNodeNS
public org.w3c.dom.Attr setAttributeNodeNS(org.w3c.dom.Attr arg0) throws org.w3c.dom.DOMException- Specified by:
setAttributeNodeNSin interfaceorg.w3c.dom.Element- Overrides:
setAttributeNodeNSin classorg.apache.xerces.dom.ElementImpl- Throws:
org.w3c.dom.DOMException- See Also:
ElementImpl.setAttributeNodeNS(org.w3c.dom.Attr)
-
setAttributeNS
public void setAttributeNS(java.lang.String nsURI, java.lang.String arg1, java.lang.String arg2) throws org.w3c.dom.DOMException- Specified by:
setAttributeNSin interfaceorg.w3c.dom.Element- Overrides:
setAttributeNSin classorg.apache.xerces.dom.ElementImpl- Throws:
org.w3c.dom.DOMException- See Also:
ElementImpl.setAttributeNS(java.lang.String, java.lang.String, java.lang.String)
-
normalize
public void normalize()
- Specified by:
normalizein interfaceorg.w3c.dom.Node- Overrides:
normalizein classorg.apache.xerces.dom.ElementImpl- See Also:
ElementImpl.normalize()
-
setNodeValue
public void setNodeValue(java.lang.String arg0) throws org.w3c.dom.DOMException- Specified by:
setNodeValuein interfaceorg.w3c.dom.Node- Overrides:
setNodeValuein classorg.apache.xerces.dom.NodeImpl- Throws:
org.w3c.dom.DOMException- See Also:
NodeImpl.setNodeValue(java.lang.String)
-
setPrefix
public void setPrefix(java.lang.String arg0) throws org.w3c.dom.DOMException- Specified by:
setPrefixin interfaceorg.w3c.dom.Node- Overrides:
setPrefixin classorg.apache.xerces.dom.ElementNSImpl- Throws:
org.w3c.dom.DOMException- See Also:
ElementNSImpl.setPrefix(java.lang.String)
-
setNamespaceURI
public void setNamespaceURI(java.lang.String arg0) throws org.w3c.dom.DOMException- Parameters:
arg0- the ns uri to set- Throws:
org.w3c.dom.DOMException
-
appendChild
public org.w3c.dom.Node appendChild(org.w3c.dom.Node arg0) throws org.w3c.dom.DOMException- Specified by:
appendChildin interfaceorg.w3c.dom.Node- Overrides:
appendChildin classorg.apache.xerces.dom.NodeImpl- Throws:
org.w3c.dom.DOMException- See Also:
NodeImpl.appendChild(org.w3c.dom.Node)
-
removeChild
public org.w3c.dom.Node removeChild(org.w3c.dom.Node arg0) throws org.w3c.dom.DOMException- Specified by:
removeChildin interfaceorg.w3c.dom.Node- Overrides:
removeChildin classorg.apache.xerces.dom.ParentNode- Throws:
org.w3c.dom.DOMException- See Also:
ParentNode.removeChild(org.w3c.dom.Node)
-
insertBefore
public org.w3c.dom.Node insertBefore(org.w3c.dom.Node arg0, org.w3c.dom.Node arg1) throws org.w3c.dom.DOMException- Specified by:
insertBeforein interfaceorg.w3c.dom.Node- Overrides:
insertBeforein classorg.apache.xerces.dom.ParentNode- Throws:
org.w3c.dom.DOMException- See Also:
ParentNode.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
-
replaceChild
public org.w3c.dom.Node replaceChild(org.w3c.dom.Node arg0, org.w3c.dom.Node arg1) throws org.w3c.dom.DOMException- Specified by:
replaceChildin interfaceorg.w3c.dom.Node- Overrides:
replaceChildin classorg.apache.xerces.dom.ParentNode- Throws:
org.w3c.dom.DOMException- See Also:
ParentNode.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
-
removeXPathAttribute
public void removeXPathAttribute(java.lang.String path)
remove an attribute or text that is described by the xpath path quietly returns if the attribute or text does not exist- Parameters:
path- the XPath to the attribute that is to be removed- Throws:
JDFException- if the XPath is corrupt
-
removeXPathElement
public void removeXPathElement(java.lang.String path)
remove an attribute or element that is described by the xpath path quietly returns if the element does not exist- Parameters:
path- the XPath to the attribute that is to be removed- Throws:
JDFException- if the XPath is corrupt
-
matchesPath
@Deprecated public boolean matchesPath(java.lang.String path)
Deprecated.use matchesPath(String path, boolean bFollowRefs)check whether this matches a simple xpath- Parameters:
path-- Returns:
- boolean
-
matchesPath
public boolean matchesPath(java.lang.String path, boolean bFollowRefs)check whether this element matches a simple xpath- Parameters:
path- xpath to match may include syntaxe[i]ore[@a="b"]bFollowRefs-- Returns:
- boolean true, if this matches the given xpath
-
matchesPathName
protected boolean matchesPathName(java.lang.String pathAt)
-
fillHashSet
public final java.util.HashSet<java.lang.String> fillHashSet(java.lang.String attName, java.lang.String attNS)fills a HashSet with all values of the attribute in all child elements- Parameters:
attName- the attribute to searchattNS- the namespace of the attribute- Returns:
-
clone
public KElement clone()
the clone is the same document- Overrides:
clonein classjava.lang.Object- Returns:
- See Also:
Object.clone()
-
cloneNewDoc
public KElement cloneNewDoc()
same as @see clone but the clone is in a new document
the document gets copies of context sensitive stuff like zip, mime, filename...- Returns:
- See Also:
Object.clone()
-
appendAnchor
public java.lang.String appendAnchor(java.lang.String newID)
create and append a unique id, keep the existing one if it already exists- Parameters:
newID- the new id. if null, then a reasonably unique id is generated- Returns:
- String - the value of the ID attribute after setting
-
getID
public java.lang.String getID()
gets attribute ID- Returns:
- the attribute value
-
generateDotID
public java.lang.String generateDotID(java.lang.String key, java.lang.String nameSpaceURI)generate a unique id in the syntax newID=oldID.nn
nn is a unique number, that is generated as the first integer higher than the number of sibling elements with the same name.
Note that it is the responsibilty of the caller not to provide multiple siblings that use the same base IDs.- Parameters:
key- the attribute that is to be set to this ID, e.g. jobpartidnameSpaceURI- the attribute namespace that is to be set to this ID, e.g. jobpartid- Returns:
- String - the newly generated ID in the syntax parentID.nn
-
getIDPrefix
protected java.lang.String getIDPrefix()
getIDPrefix- Returns:
- the default ID prefix of non-overwritten JDF elements
-
setID
public void setID(java.lang.String id)
gets attribute ID- Parameters:
id-
-
setLongID
public static void setLongID(boolean bLong)
set the ID generation algorithm to include a date- Parameters:
bLong- if true (default), the date and time is used to generate long IDs
-
uniqueID
public static java.lang.String uniqueID(int id)
UniqueID - create a unique id based on date and time + a counter - 6 digits are taken from id Normally this should only be used internally, @see JDFElement.appendAnchor() for details.- Parameters:
id- the starting id of the ID - should normally be 0 in order to increment- Returns:
- the ID string value
-
uniqueID
public static java.lang.String uniqueID(int id, boolean bDate)- Parameters:
id-bDate-- Returns:
-
createRoot
public static KElement createRoot(java.lang.String nodename, java.lang.String namespaceURI)
create a new root document- Parameters:
nodename-namespaceURI-- Returns:
-
createRoot
public static KElement createRoot(java.lang.String nodename)
create a new root document- Parameters:
nodename-namespaceURI-- Returns:
-
numSiblingElements
public int numSiblingElements(java.lang.String elementName, java.lang.String nameSpaceURI)get the number of sibling elements- Parameters:
elementName- , if null any and all at the same levelnameSpaceURI-- Returns:
-
write2Stream
public boolean write2Stream(java.io.OutputStream stream)
write myself to an output stream- Parameters:
stream-- Returns:
-
writeStream
public void writeStream(java.io.OutputStream stream)
Description copied from interface:IStreamWriterwrite myself to a stream- Specified by:
writeStreamin interfaceIStreamWriter- Parameters:
stream- the output stream
-
write2File
public boolean write2File(java.io.File file)
write myself to a file- Parameters:
file-- Returns:
-
write2File
public boolean write2File(java.lang.String filename)
write myself to a file- Parameters:
filename-- Returns:
-
setNonEmpty
public void setNonEmpty(java.lang.String key, java.lang.String val)convenience setter same as setAttribute but never sets ""- Parameters:
key-val-
-
parseStream
public static KElement parseStream(java.io.InputStream s)
- Parameters:
s-- Returns:
-
parseString
public static KElement parseString(java.lang.String string)
- Parameters:
string-- Returns:
-
parseFile
public static KElement parseFile(java.lang.String filename)
- Parameters:
filename-- Returns:
-
clearNSMap
public void clearNSMap()
cleanup all namespace stuff