Class 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
    See Also:
    for the first element class that is aware of JDF, Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  KElement.MultiAttributeComparator
      sorts according to the value of one attribute
      if the attribute is numeric, compare numerically, else lexical comparison is done
      static class  KElement.SimpleElementNameComparator
      sorts according to the lexical string representation of the xml objects
      static class  KElement.SimpleNodeComparator
      sorts according to the lexical string representation of the xml objects
      static class  KElement.SingleAttributeComparator
      sorts according to the value of one attribute
      if the attribute is numeric, compare numerically, else lexical comparison is done
      static class  KElement.SingleXPathComparator
      sorts 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.ElementNSImpl

        localName, namespaceURI
      • Fields inherited from class org.apache.xerces.dom.ElementImpl

        attributes, name
      • Fields inherited from class org.apache.xerces.dom.ParentNode

        firstChild, fNodeListCache, ownerDocument
      • Fields inherited from class org.apache.xerces.dom.ChildNode

        nextSibling, previousSibling
      • 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
      • Fields inherited from interface org.w3c.dom.TypeInfo

        DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION
    • Constructor Summary

      Constructors 
      Constructor Description
      KElement​(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, java.lang.String qualifiedName)
      Constructor for KElement
      KElement​(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, java.lang.String myNamespaceURI, java.lang.String qualifiedName)
      Constructor for KElement
      KElement​(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
      double addAttribute​(java.lang.String key, double inc, java.lang.String nameSpaceURI)
      increments or decrements a numeric attribute by inc
      int addAttribute​(java.lang.String key, int inc, java.lang.String nameSpaceURI)
      increments or decrements a numeric attribute by inc
      boolean addNameSpace​(java.lang.String strPrefix, java.lang.String strNameSpaceURI)
      Adds a NameSpace and maps the prefix to a URI.
      int ancestorDistance​(KElement child)
      distance to ancestor (0=this)
      java.lang.String appendAnchor​(java.lang.String newID)
      create and append a unique id, keep the existing one if it already exists
      java.lang.String appendAttribute​(java.lang.String key, java.lang.String value, boolean unique)
      convenience
      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.
      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.
      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 '
      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 '
      org.w3c.dom.Node appendChild​(org.w3c.dom.Node arg0)  
      KElement appendElement​(java.lang.String elementName)
      append a DOM element.
      KElement appendElement​(java.lang.String elementName, java.lang.String nameSpaceURI)  
      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 maxAllowed
      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...
      void appendEntityReference​(java.lang.String refName)
      appends a entity reference to the actual element
      void appendText​(java.lang.String textName)
      append some generic text
      KElement appendTextElement​(java.lang.String nodeName, java.lang.String text)
      append a text element with text included
      void appendXMLComment​(java.lang.String commentText)
      Deprecated.
      use appendXMLComment(commentText, null);
      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
      java.lang.String buildRelativeXPath​(KElement relativeTo, int methCountSiblings)
      Gets the XPath full tree representation of 'this'
      java.lang.String buildXPath()
      Deprecated.
      use buildXPath(null,true);
      java.lang.String buildXPath​(java.lang.String relativeTo)
      Deprecated.
      use buildXPath(relativeTo,true);
      java.lang.String buildXPath​(java.lang.String relativeTo, int methCountSiblings)
      Gets the XPath full tree representation of 'this'
      void cleanup()
      removes everything
      void clearNSMap()
      cleanup all namespace stuff
      protected void clearTargets()  
      KElement clone()
      the clone is the same document
      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...
      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 necessary
      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 necessary
      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 attribute
      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 attribute
      void copyChildren​(java.lang.String elementName, KElement src)  
      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.
      void copyElements​(VElement v, KElement beforeChild)
      append all children in a vector of elements in the order of the vector
      KElement copyInto​(KElement src, boolean bRemove)
      copies a node into this, ignoring identical node names i.e.
      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
      static KElement createRoot​(java.lang.String nodename)
      create a new root document
      static KElement createRoot​(java.lang.String nodename, java.lang.String namespaceURI)
      create a new root document
      KElement deleteNode()
      Deletes itself from its parent
      java.lang.String ensureCase​(java.lang.String key)
      ensure the correct case of n attribute, if present
      void eraseEmptyAttributes​(boolean bRecurse)
      remove all empty attributes from this (e.g.
      int eraseEmptyNodes​(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 elements
      boolean fitsName​(java.lang.String nodeName, java.lang.String nameSpaceURI)
      Tests whether the specified nodename and namespace fits the nodename and namespace of 'this'
      protected boolean fitsName_KElement​(java.lang.String nodeName, java.lang.String nameSpaceURI)  
      boolean flush()
      Flush - remove all attributes, elements and text, leaving only a stub tag
      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.
      java.lang.String getAttribute​(java.lang.String strLocalName)
      Mother of all attribute getters
      Gets an attribute value out of an element
      <T extends java.lang.Enum<T>>
      T
      getAttribute​(java.lang.String key, java.lang.Class<T> c)
      no namespace variant
      java.lang.String getAttribute​(java.lang.String attrib, java.lang.String nameSpaceURI, java.lang.String def)
      mother of all attribute getters.
      java.lang.String getAttribute_KElement​(java.lang.String strLocalName)
      Mother of all attribute getters
      Gets an attribute value out of an element
      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.
      java.util.List<java.lang.String> getAttributeArray_KElement()
      Gets all attribute keys of 'this' as a vector of strings
      java.lang.String getAttributeIgnoreCase​(java.lang.String key)
      Gets an atrribute if the local name
      JDFAttributeMap getAttributeMap()
      Get the Attribute Map of the actual element
      JDFAttributeMap getAttributeMap_KElement()
      Get the Attribute Map of the actual element
      java.lang.String getAttributeRaw​(java.lang.String qualifiedName)
      getAttribute with no pardon for namespaces or anything
      VString getAttributeVector()
      Gets all attribute keys of 'this' as a vector of strings
      VString getAttributeVector_KElement()
      Gets all attribute keys of 'this' as a vector of strings
      boolean getBoolAttribute​(java.lang.String attrib, java.lang.String nameSpaceURI, boolean def)
      get a boolean attribute
      java.lang.String getCData​(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 null
      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 node
      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.
      KElement[] getChildElementArray()
      gets an array of the direct children of the current element
      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)
      VElement getChildElementVector​(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib, boolean bAnd, int maxSize)
      Deprecated.
      060302 - use 6 parameter version
      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
      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
      KElement getChildFromList​(VString nodeNames, int iSkip)
      Deprecated.
      use getChildFromList(Vector nodeNames, int iSkip, JDFAttributeMap map)
      KElement getChildFromList​(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 kids
      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)
      protected org.w3c.dom.Node getChildNode​(int nodeType, int iPos)
      gets the n'th child node of nodetype nodeType with n = iPos
      VElement getChildNodes_KElement()
      Deprecated.
      use getChildElementVector(null, null, null, true, 0)
      java.util.Vector getChildNodeVector​(int maxSize)
      Deprecated. 
      <A extends KElement>
      java.util.Vector<A>
      getChildrenByClass​(java.lang.Class<A> clazz, boolean bRecurse, int nMax)
      Deprecated.
      use getChildArrayByClass
      VElement getChildrenByTagName​(java.lang.String elementName)
      convenience helper
      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
      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
      VElement getChildrenFromList​(VString nodeNames, JDFAttributeMap map, boolean bDirect, VElement v)
      get a vector of all Children that match the strings defined in nodeNames
      VElement getChildrenIgnoreList​(VString nodeNames, boolean bDirect, VElement v)
      get a vector of all Children that do not match the strings defined in nodeNames
      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);
      <A extends KElement>
      A
      getChildWithAttribute​(java.lang.Class<A> clazz, java.lang.String attName, java.lang.String attVal)  
      <A extends KElement>
      A
      getChildWithAttribute​(java.lang.Class<A> clazz, java.lang.String attName, java.lang.String attVal, boolean recurse)  
      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 attributes
      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 exist
      KElement getCreateElement​(java.lang.String nodeName)
      Get the actual element, create if not there
      KElement getCreateElement​(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)
      Get the actual element, create if not there
      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.
      KElement getCreateXPathElement​(java.lang.String path)
      gets an element as defined by XPath to value and creates it if it does not exist
      KElement getDeepElement​(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)
      Deprecated.
      use getChildByTagName(nodeName, nameSpaceURI, iSkip, null, false, true);
      KElement getDeepParent​(java.lang.String parentNode, int depth)
      Get the n'th Ancestor node with name parentNode
      KElement getDeepParent​(java.util.Vector vParentElement, int depth)
      Deprecated.
      - loop over the single node method
      KElement getDeepParentChild​(java.lang.String parentNode)
      Get the first child of parentNode with name parentNode
      KElement getDeepParentNotName​(java.lang.String thisNode)
      Get the Ancestor node with name other than thisNode
      KElement getDocRoot()
      Gets the root element of the current document
      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.
      KElement getElement​(java.lang.String nodeName)
      Get the actual element - utility routine.
      KElement getElement​(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)
      Gets an existing iSkip-th child node with matching nodeName and nameSpaceURI
      KElement getElement_KElement​(java.lang.String nodeName, java.lang.String nameSpaceURI, int iSkip)
      getElement - Get the actual element
      <A extends KElement>
      A
      getElementByClass​(java.lang.Class<A> clazz, int iSkip, boolean bRecurse)
      getElement - Get the actual element by java class
      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.
      VString getElementNameVector()
      Returns a vector which contains the childs of the actual element.
      VElement getElementsByTagName_KElement​(java.lang.String s, java.lang.String nameSpaceURI)
      wrappers of DOM routines that dont bang on null nodes
      KElement getFirstChildElement()
      get the first child element
      <a extends KElement>
      a
      getFirstChildElement​(java.lang.Class<a> clazz)
      Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.
      KElement getFirstChildElement​(java.lang.String nodeName, java.lang.String nameSpaceURI)
      Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.
      static org.w3c.dom.Element getFirstElementNode​(org.w3c.dom.Element parent)
      Deprecated.
      use elem.getFirstChildElement
      java.lang.String getID()
      gets attribute ID
      protected java.lang.String getIDPrefix()
      getIDPrefix
      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
      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
      java.lang.String getInheritedAttribute​(java.lang.String attrib, java.lang.String nameSpaceURI, java.lang.String def)
      searches for the first attribute occurrence in this element or any ancestors
      KElement getInheritedElement​(java.lang.String elementName, java.lang.String nameSpaceURI, int iSkip)
      searches for the first child element occurence in this element or any ancestors
      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
      int getIntAttribute​(java.lang.String attrib, java.lang.String nameSpaceURI, int def)
      Get a integer attribute if present
      static java.lang.String getLocalNameStatic​(KElement kElem)
      Deprecated.
      use getLocalName
      long getLongAttribute​(java.lang.String attrib, java.lang.String nameSpaceURI, long def)
      Get a long attribute if present
      VString getMultipleIDs​(java.lang.String attName)
      Get a vector of all IDs that occur multiple times
      java.lang.String getNamespaceURI()
      Get the NameSpaceURI
      java.lang.String getNamespaceURIFromPrefix​(java.lang.String prefix)
      Gets the NameSpaceURI corresponding to a given prefix, returns null if no namespace is defined
      static org.w3c.dom.Element getNextElementNode​(org.w3c.dom.Element elem)
      Deprecated.
      - use elem.getNextSiblingElement();
      KElement getNextSiblingElement()
      get the next sibling element
      <a extends KElement>
      a
      getNextSiblingElement​(java.lang.Class<a> clazz)
      Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.
      KElement getNextSiblingElement​(java.lang.String nodeName, java.lang.String nameSpaceURI)
      Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.
      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
      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
      int getNumCDatas()
      gets the number of direct child CData sections
      int getNumChildNodes​(int nodeType)
      Gets the number of direct child nodes of 'this', that match NodeType
      int getNumChildText()
      Gets the number of direct text child nodes
      int getNumXMLComments()
      gets the number of direct XMLComment child nodes of 'this'
      XMLDoc getOwnerDocument_KElement()
      Get the document object that owns this
      KElement getParentNode_KElement()
      get the parent node of this
      KElement getPreviousSiblingElement()
      get the previous sibling element
      KElement getPreviousSiblingElement​(java.lang.String nodeName, java.lang.String nameSpaceURI)
      Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.
      double getRealAttribute​(java.lang.String attrib, java.lang.String nameSpaceURI, double def)
      get a double attribute
      KElement getTarget​(java.lang.String id, java.lang.String attrib)
      looking for a specified target with an id, e.g.
      KElement getTarget_KElement​(java.lang.String id, java.lang.String attrib)
      Gets the target of link.
      java.lang.String getText()
      gets a concatenated string representing of all direct text child nodes
      java.lang.String getText​(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.
      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.
      <A extends KElement>
      java.util.List<A>
      getTreeByClass​(java.lang.Class<A> cl, boolean addself)  
      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.
      java.lang.String getXMLComment​(int i)
      gets of 'this' the text of the i-th child XMLComment.
      static java.lang.String getXMLNSNameSpace​(java.lang.String pc)
      Deprecated. 
      static java.lang.String getXMLNSPrefix​(java.lang.String pc)
      Deprecated.
      use xmlnsPrefix
      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
      JDFAttributeMap getXPathAttributeMap​(java.lang.String path)
      Gets a map of attribute values as defined by XPath namespace prefixes are resolved
      KElement getXPathElement​(java.lang.String path)
      gets an element as defined by XPath to value
      VElement getXPathElementVector​(java.lang.String path, int maxSize)
      gets an vector of elements element as defined by XPath to value
      JDFAttributeMap getXPathValueMap()
      Gets a map of attribute values as defined by XPath namespace prefixes are resolved
      JDFAttributeMap getXPathValueMap​(boolean isRelative)
      Gets a map of attribute values as defined by XPath namespace prefixes are resolved
      java.lang.String getXSIType()
      returns the xsi:type of this element, null if not present
      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()
      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
      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
      boolean hasAttributes()
      checks if the current element has attributes
      boolean hasChildElement​(java.lang.String nodeName, java.lang.String nameSpaceURI)
      Checks whether the current element has a child element NodeName
      boolean hasChildElements()
      checks if the current element has a child element
      protected boolean hasChildNodes​(int nodeType)
      checks wether this has node childs of the stated node type
      boolean hasChildText()
      Tests, whether 'this' contains any text child nodes
      boolean hasNonEmpty​(java.lang.String strLocalName)
      similar to hasAttribute but returns false for all empty strings Gets an attribute value out of an element
      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
      boolean hasXPathNode​(java.lang.String path)
      returns true if the element or attribute described by this XPath exists, else false
      boolean includesAttribute​(java.lang.String attName, java.lang.String attValue)
      Check if an attribute is present.
      boolean includesAttributes​(JDFAttributeMap aMap, boolean bAnd)
      Checks if the actual element contains the attributes given in aMap
      boolean init()
      Method init.
      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 beforePos
      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.
      org.w3c.dom.Node insertBefore​(org.w3c.dom.Node arg0, org.w3c.dom.Node arg1)  
      boolean isAncestor​(KElement child)
      checks if KElement child is ancestor or not
      boolean isDirty()
      Get the dirty status of this element
      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
      static boolean isEqual​(KElement e1, KElement e2)
      null safe test whether the elements e1 and e2 are equal
      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
      boolean matchesPath​(java.lang.String path)
      Deprecated.
      use matchesPath(String path, boolean bFollowRefs)
      boolean matchesPath​(java.lang.String path, boolean bFollowRefs)
      check whether this element matches a simple xpath
      protected boolean matchesPathName​(java.lang.String pathAt)  
      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
      void moveArray​(java.util.Collection<KElement> v, KElement beforeChild)
      move all children in a vector of elements in the order of the vector
      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.
      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.
      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.
      void moveElements​(VElement v, KElement beforeChild)
      Deprecated.
      use moveArray
      KElement moveMe​(KElement beforeChild)
      moves this to a position before another child, fails if either this or beforechild are document roots
      void normalize()  
      int numChildElements​(java.lang.String node, java.lang.String nameSpaceURI)
      Get the number of child elements.
      int numChildElements_KElement​(java.lang.String node, java.lang.String nameSpaceURI)
      Get the number of child elements.
      int numChildNodes​(int nodeType)
      Deprecated.
      use 2-parameter version numChildNodes(nodeType, false);
      int numChildNodes​(int nodeType, boolean bRecurse)
      count the number of child nodes of DOM nodeType nodeType (0=count all)
      int numChildrenByClass​(java.lang.Class<?> clazz, boolean bRecurse)
      Get the number of child elements of a certain class
      int numSiblingElements​(java.lang.String elementName, java.lang.String nameSpaceURI)
      get the number of sibling elements
      static KElement parseFile​(java.io.File file)  
      static KElement parseFile​(java.lang.String filename)  
      static KElement parseStream​(java.io.InputStream s)  
      static KElement parseString​(java.lang.String string)  
      KElement pushUp​(java.lang.String newParentName)
      Moves 'this' from parent to grandparent or to the closest ancestor with name newParentName
      void removeAllText()
      removes all text children of the current node
      void removeAttribute​(java.lang.String attrib)  
      void removeAttribute​(java.lang.String attrib, java.lang.String nameSpaceURI)
      Remove an attribute from the current element
      void removeAttribute_KElement​(java.lang.String attrib, java.lang.String nameSpaceURI)
      Remove a attribute from the current element
      org.w3c.dom.Attr removeAttributeNode​(org.w3c.dom.Attr arg0)  
      void removeAttributeNS​(java.lang.String nameSpaceURI, java.lang.String attrib)  
      void removeAttributes​(java.util.Collection<java.lang.String> attribs)
      Removes all attributes spezified in attribs.
      void removeCData​(int i)
      Removes the i'th XML CData section
      KElement removeChild​(java.lang.String node, java.lang.String nameSpaceURI, int n)
      Removes the n'th child node that matches 'nodeName' and 'nameSpaceURI'
      org.w3c.dom.Node removeChild​(org.w3c.dom.Node arg0)  
      boolean removeChildNode​(int nodeType, int i)
      removes the i'th child node, that match NodeType
      void removeChildren​(java.lang.String nodeName, java.lang.String nameSpaceURI)
      Remove children that match nodeName and nameSpaceURI
      void removeChildren​(java.lang.String nodeName, java.lang.String nameSpaceURI, JDFAttributeMap mAttrib)
      Removes the children named nodeName in the namespace nameSpaceURI from the parent element
      void removeChildrenByClass​(java.lang.Class<? extends org.w3c.dom.Node> clazz)  
      void removeChildText​(int i)
      Removes the i'th text node of 'this'
      void removeExtensions​(java.lang.String nsURI)
      remove all elements and attributes of a given namespace
      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.
      void removeIgnoreCase​(java.lang.String key)  
      void removeIgnoreCase_KElement​(java.lang.String key)  
      void removeXMLComment​(int i)
      removes the i'th XMLComment node
      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
      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
      void renameAttribute​(java.lang.String oldName, java.lang.String newName)
      Rename an attribute in this namespace
      if oldName does not exist, newName is NOT modified
      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 modified
      KElement renameElement​(java.lang.String newName, java.lang.String nameSpaceURI)
      Rename the element with the String newName.
      org.w3c.dom.Node replaceChild​(org.w3c.dom.Node arg0, org.w3c.dom.Node arg1)  
      KElement replaceElement​(KElement src)
      Replaces 'this' with src.
      void setAttribute​(java.lang.String key, boolean b, java.lang.String nameSpaceURI)
      SetAttribute - Sets an element attribute
      void setAttribute​(java.lang.String key, double value, java.lang.String nameSpaceURI)
      Sets an element attribute
      void setAttribute​(java.lang.String key, double value, java.lang.String nameSpaceURI, int precision)
      Sets an element attribute
      void setAttribute​(java.lang.String key, int value, java.lang.String nameSpaceURI)
      Sets an element attribute
      void setAttribute​(java.lang.String key, long value, java.lang.String nameSpaceURI)
      Sets an element attribute
      void setAttribute​(java.lang.String key, java.lang.Enum<?> value, java.lang.String ns)
      no namespace variant
      void setAttribute​(java.lang.String key, java.lang.String value)
      no namespace variant
      void setAttribute​(java.lang.String key, java.lang.String value, java.lang.String nameSpaceURI)
      Mother of all Attribute setters
      Sets a new attribute.
      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
      void setAttribute​(java.lang.String key, org.apache.commons.lang.enums.ValuedEnum value, java.lang.String nameSpaceURI)
      Sets an element attribute
      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
      void setAttribute​(java.lang.String key, JDFNumList value, int precision)  
      void setAttribute​(java.lang.String key, JDFDate value, java.lang.String nameSpaceURI)  
      org.w3c.dom.Attr setAttributeNode​(org.w3c.dom.Attr arg0)  
      org.w3c.dom.Attr setAttributeNodeNS​(org.w3c.dom.Attr arg0)  
      void setAttributeNS​(java.lang.String nsURI, java.lang.String arg1, java.lang.String arg2)  
      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
      void setAttributeRaw​(java.lang.String key, java.lang.String value)
      fastest setAttribute - use only if you know exactly what you are doing
      void setAttributes​(java.lang.String[] myAttributes, java.lang.String[] strValues)
      Deprecated.
      use setAttributes(JDFAttributeMap)
      int setAttributes​(KElement kElem)
      Sets the attributes from the curent element to the attributes from kElem.
      int setAttributes​(KElement kElem, VString ignoreList)
      Sets the attributes from the curent element to the attributes from kElem.
      int setAttributes​(JDFAttributeMap map)
      Sets the attributes from the curent element.
      void setAttributesRaw​(KElement kElem)
      Sets the attributes from the current element to the attributes from kElem.
      void setBoolAttribute​(java.lang.String key, boolean b, java.lang.String nameSpaceURI)
      Deprecated.
      use setAttribute instead
      void setDirty()
      Set this element as dirty
      void setDirty​(boolean bAttribute)
      Set this element as dirty
      void setID​(java.lang.String id)
      gets attribute ID
      void setIntAttribute​(java.lang.String key, int value, java.lang.String nameSpaceURI)
      Deprecated.
      use setAttribute instead
      static void setLongID​(boolean bLong)
      set the ID generation algorithm to include a date
      void setNamespaceURI​(java.lang.String arg0)  
      void setNodeValue​(java.lang.String arg0)  
      void setNonEmpty​(java.lang.String key, java.lang.String val)
      convenience setter same as setAttribute but never sets ""
      void setPrefix​(java.lang.String arg0)  
      void setRealAttribute​(java.lang.String key, double value, java.lang.String nameSpaceURI)
      Deprecated.
      use setAttribute instead
      void setText​(java.lang.String text)
      Sets an XML Text
      the text contents of this to the value of text
      void setvStringAttribute​(java.lang.String key, VString value, java.lang.String nameSpaceURI)
      Deprecated.
      use setAttribute instead
      void setXMLComment​(java.lang.String commentText)
      set a DOM comment <!-- XMLComment --> in front of this if an xml Comment node already exists directly in front of this, the previous comment is removed The double minus sign '--' is escaped with an underscore '_' in order to ensure valid xml
      void setXMLComment​(java.lang.String commentText, boolean single)
      set a DOM comment <!-- XMLComment --> in front of this if an xml Comment node already exists directly in front of this, the previous comment is removed The double minus sign '--' is escaped with an underscore '_' in order to ensure valid xml
      void setXPathAttribute​(java.lang.String path, java.lang.String value)
      Sets an attribute as defined by XPath to value
      void setXPathValue​(java.lang.String path, java.lang.String value)
      Sets an attribute as defined by XPath to value
      void setXPathValues​(JDFAttributeMap map)
      sets all xpaths to the values provided in map
      void setXSIType​(java.lang.String typ)  
      void sortChild​(KElement e)
      sorts/inserts e by alphabet
      void sortChild​(KElement e, java.util.Comparator<KElement> comparator)
      insert e into this, assuming that this is already sorted
      void sortChildren()
      sorts all child elements by alphabet
      void sortChildren​(boolean bRecursive)
      sorts all child elements by alphabet
      void sortChildren​(java.util.Comparator<KElement> comparator)
      sorts all child elements by alphabet
      void sortChildren​(java.util.Comparator<KElement> comparator, boolean bRecursive)
      sorts all child elements by alphabet
      java.lang.String toDisplayXML​(int indent)
      serialize this to a string
      java.lang.String toString()
      this to string, used for debug purpose mostly
      java.lang.String toValueString​(char sep)
      get a concatinated string of all values
      java.lang.String toXML()
      serialize this to a string
      java.lang.String toXML​(int indent)
      serialize this to a string
      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.
      static java.lang.String uniqueID​(int id, boolean bDate)  
      boolean write2File​(java.io.File file)
      write myself to a file
      boolean write2File​(java.lang.String filename)
      write myself to a file
      boolean write2Stream​(java.io.OutputStream stream)
      write myself to an output stream
      void writeStream​(java.io.OutputStream stream)
      write myself to a stream
      static java.lang.String xmlNameSpace​(java.lang.String s)
      Deprecated.
      use xmlnsPrefix()
      static java.lang.String xmlnsLocalName​(java.lang.String pc)
      used by get localname
      static java.lang.String xmlnsPrefix​(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 element
        qualifiedName - 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 element
        myNamespaceURI - the namespace of the new element
        qualifiedName - 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 element
        myNamespaceURI - the namespace of the new element
        qualifiedName - the qualified name of the element
        myLocalName - 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 occurrence in this element or any ancestors
        Parameters:
        attrib - the attribute name
        nameSpaceURI - the XML-namespace
        def - 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 have
        nameSpaceURI - namespace of key
        def - 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 have
        nameSpaceURI - namespace of key
        def - 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:
        getAttribute in interface org.w3c.dom.Element
        Overrides:
        getAttribute in class org.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 instead
        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 set
        value - the values for the attribute key
        nameSpaceURI - 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 set
        value - the values for the attribute key
        nameSpaceURI - 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 set
        value - the values for the attribute key
        nameSpaceURI - 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 Name
        nameSpaceURI - then namespaceURI, defaults to the local namespace
        bInherit - 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 removed
        nameSpaceURI - 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:
        setAttribute in interface org.w3c.dom.Element
        Overrides:
        setAttribute in class org.apache.xerces.dom.ElementImpl
        Parameters:
        key - name of the attribute to set
        value - value of the attribute
      • setAttribute

        public void setAttribute​(java.lang.String key,
                                 java.lang.Enum<?> value,
                                 java.lang.String ns)
        no namespace variant
        Parameters:
        key - name of the attribute to set
        value - value of the attribute
      • getAttribute

        public <T extends java.lang.Enum<T>> T getAttribute​(java.lang.String key,
                                                            java.lang.Class<T> c)
        no namespace variant
        Parameters:
        key - name of the attribute to set
        value - 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 set
        value - 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 uri
        key - name of the attribute to set
        value - value of the attribute
      • setIntAttribute

        @Deprecated
        public void setIntAttribute​(java.lang.String key,
                                    int value,
                                    java.lang.String nameSpaceURI)
        Deprecated.
        use setAttribute instead
        Sets an element attribute
        Parameters:
        key - the name of the attribute to set
        value - the value for the attribute
        nameSpaceURI - 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 set
        value - the value for the attribute
        nameSpaceURI - 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 set
        value - the value for the attribute
        nameSpaceURI - 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 set
        value - the long value for the attribute
        nameSpaceURI - the namespace the element is in
      • setRealAttribute

        @Deprecated
        public void setRealAttribute​(java.lang.String key,
                                     double value,
                                     java.lang.String nameSpaceURI)
        Deprecated.
        use setAttribute instead
        Sets an element attribute
        Parameters:
        key - the name of the attribute to set
        value - the value for the attribute
        nameSpaceURI - 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 set
        value - the value for the attribute
        nameSpaceURI - 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 set
        value - the value for the attribute
        nameSpaceURI - the namespace the element is in
        precision -
      • setBoolAttribute

        @Deprecated
        public void setBoolAttribute​(java.lang.String key,
                                     boolean b,
                                     java.lang.String nameSpaceURI)
        Deprecated.
        use setAttribute instead
        SetAttribute - Sets an element attribute
        Parameters:
        key - the name of the attribute to set
        b - 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 set
        b - 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 set
        inc - the value to increment or decrement by
        nameSpaceURI - 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 set
        inc - the value to increment or decrement by
        nameSpaceURI - 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 remove
        nameSpaceURI - 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 remove
        nameSpaceURI - 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:
        hasAttribute in interface org.w3c.dom.Element
        Overrides:
        hasAttribute in class org.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 for
        nameSpaceURI - the nameSpace to look in
        bInherit - 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 for
        nameSpaceURI - the nameSpace to look in
        bInherit - 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 key
        value - 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 key
        value - string to be appended
        nameSpaceURI - namespace of key
        sep - separator between the original attribute value and value, defaults to " " if null
        bUnique - 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 to results 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 key
        value - string to be appended
        nameSpaceURI - namespace of key
        sep - separator between the original attribute value and value, defaults to " " if null
        bUnique - 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 to results 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
      • 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 qualified
        nameSpaceURI - 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:
        getNamespaceURI in interface org.w3c.dom.Node
        Overrides:
        getNamespaceURI in class org.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 getLocalName
        Gets 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 source
        ignoreList -
        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 name
        nameSpaceURI - 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 happens
        beforeChild - 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 version
        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 for
        nameSpaceURI - nameSpace you are searching for
        mAttrib - attributes you are lokking for
        bAnd - if true, a child is only added if it has all attributes specified in Attributes mAttrib
        maxSize - 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 for
        nameSpaceURI - nameSpace you are searching for
        mAttrib - attributes you are lokking for
        bAnd - if true, a child is only added if it has all attributes specified in Attributes mAttrib
        maxSize - 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 for
        nameSpaceURI - 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 for
        nameSpaceURI - 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 for
        nameSpaceURI - 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 for
        nameSpaceURI - nameSpace you are searching for
        mAttrib - attributes you are lokking for
        bAnd - if true, a child is only added if it has all attributes specified in Attributes mAttrib
        maxSize - 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 for
        nameSpaceURI - nameSpace you are searching for
        mAttrib - attributes you are lokking for
        bAnd - if true, a child is only added if it has all attributes specified in Attributes mAttrib
        maxSize - 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:
      • 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 sibling
        nameSpaceURI - 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 sibling
        nameSpaceURI - 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 sibling
        nameSpaceURI - 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 check
        bAnd - 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 attribute
        attValue - 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 for
        nameSpaceURI - nameSpace you are searching for
        mAttrib - map of attributes you are looking for
        Wildcards in the attribute map are supported
        bDirect - if true, return value is a vector only of all direct child elements.
        Otherwise the returned vector contains nodes of arbitrary depth
        bAnd - if true, a child is only added, if it includes all attributes, specified in mAttrib
        maxSize - 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 for
        nameSpaceURI - nameSpace you are searching for
        mAttrib - map of attributes you are looking for
        Wildcards in the attribute map are supported
        bDirect - if true, return value is a vector only of all direct child elements.
        Otherwise the returned vector contains nodes of arbitrary depth
        bAnd - if true, a child is only added, if it includes all attributes, specified in mAttrib
        maxSize - 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 on
        nameSpaceURI - 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 for
        attName - attributes you are looking for
        nameSpaceURI - nameSpace you are searching for
        attVal - value of the attribute you are searching for
        bDirect - 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 element
        nameSpaceURI - the name of the namespaceURI
        iSkip - 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 get
        nameSpaceURI - namespace to search for
        iSkip - 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 get
        nameSpaceURI - namespace to search for
        iSkip - 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 null
        elementNS - the namespace URI of the elements, any if null
        attName - 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 node
        nameSpaceURI - Name of the namespaceURI to search in
        iSkip - 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 element
        iSkip - 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 for
        depth - 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 method
        Get the ancestor which may have one of the node names defined in parentNode
        Parameters:
        vParentElement - vector with node names to search for
        depth - 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 search
        attrib - 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 search
        attrib - 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.getFirstChildElement
        get 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 count
        nameSpaceURI - 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 class
        bRecurse - 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 count
        nameSpaceURI - 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 element
        nameSpaceURI - namespace to search in
        n - 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 for
        nameSpaceURI - nameSpace you are searching for
        index - if more then one child match the condition you can specify which one you want to have via the index
        mAttrib - attributes you are lokking for
        bDirect - 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 match nodeName and nameSpaceURI

        default: removeChildren(nodeName, nameSpaceURI, null)

        Parameters:
        nodeName - name of the child node to get, if empty or null remove all
        nameSpaceURI - namespace to search in
      • removeChildren

        public void removeChildren​(java.lang.String nodeName,
                                   java.lang.String nameSpaceURI,
                                   JDFAttributeMap mAttrib)
        Removes the children named nodeName in the namespace nameSpaceURI from the parent element

        default: removeChildren(null,null,null)

        Parameters:
        nodeName - name of the element typ to remove
        nameSpaceURI - namespace in which the elements are to be removed
        mAttrib - 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 to results in
        Parameters:
        key - attribute key
        token - string to remove
        nameSpaceURI - namespace of attribute key
        sep - separator between the values
        nMax - 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 get
        nameSpaceURI - 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 name

        default: getChildFromList(nodeNames, 0, null)

        Parameters:
        nodeNames - container for the node name string
        iSkip - how many of the found child should be skiped
        map - map of attributes to match
        bDirect -
        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 rename

        default: renameElement(newName, null)

        Parameters:
        newName - the new name of the actual element
        nameSpaceURI - 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 is null, 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 happens
        beforeChild - 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, null if src is null.
      • 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 present

        default: getLongAttribute(attrib, null, 0)

        Parameters:
        attrib - attribute to parse for an integer attribute
        nameSpaceURI - nameSpaceURI to search in
        def - 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 def is returned.
      • getIntAttribute

        public int getIntAttribute​(java.lang.String attrib,
                                   java.lang.String nameSpaceURI,
                                   int def)
        Get a integer attribute if present

        default: getIntAttribute(attrib, null, 0)

        Parameters:
        attrib - attribute to parse for an integer attribute
        nameSpaceURI - nameSpaceURI to search in
        def - 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 attribute

        default: getBoolAttribute(attrib, null, false)

        Parameters:
        attrib - attribute to parse for a boolean value
        nameSpaceURI - nameSapceURI to search in
        def - 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 attribute

        default: getRealAttribute(attrib, null, 0.0)

        Parameters:
        attrib - attribute to parse for a boolean value
        nameSpaceURI - nameSapceURI to search in
        def - 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 append
        beforeChild - 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 of this if an xml Comment node already exists directly in front of this, 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 - see setXMLComment(String,boolean)
      • setXMLComment

        public void setXMLComment​(java.lang.String commentText,
                                  boolean single)
        set a DOM comment <!-- XMLComment --> in front of this if an xml Comment node already exists directly in front of this, 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
        single - 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 element
        text - 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 node
        bDelete - 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 attributes

        default: getChildWithAttribute(nodeName, attName, null,attValue, 0, true)

        Parameters:
        nodeName - name of the child node to search for
        attName - attribute name to search for
        nameSpaceURI - namespace to search for
        attVal - 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
        bDirect - 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 exist

        default: getChildWithAttribute(nodeName, attName, null,attValue, 0, true)

        Parameters:
        nodeName - name of the child node to search for
        attName - attribute name to search for
        nameSpaceURI - namespace to search for
        attVal - 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 NodeName

        default: hasChildElement(String nodeName, null)

        Parameters:
        nodeName - name of the node to check for
        nameSpaceURI - 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 ancestors

        default: getInheritedElement(elementName, null, 0)

        Parameters:
        elementName - name of the element to be searched
        nameSpaceURI - XML-namespace
        iSkip - 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 set
        strNameSpaceURI - 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 sort
        comparator - 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:
        toString in class org.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 modified

        default: renameAttribute(oldName, newName, null, null)

        Parameters:
        oldName - attribute name to move from
        newName - attribute name to move to
        nameSpaceURI - attribute nameSpaceURI to move from
        newNameSpaceURI - 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 modified

        default: renameAttribute(oldName, newName, null, null)

        Parameters:
        oldName - attribute name to move from
        newName - 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 node

        default: getChildAttributeList(nodeName, attName, null, JDFCoreConstants.WILDCARD, true, true)

        Parameters:
        nodeName - element name you are searching for
        attName - attributes you are looking for
        nameSpaceURI - nameSpace you are searching for
        attValue -
        bDirect - if true return value is a vector of all found elements. Otherwise the returned vector contains only the nodes
        bUnique - 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 is null , 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 created
        beforeChild - The reference element, i.e., the elemente before which the new element must be inserted
        nameSpaceURI - 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 checked
        map -
        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 checked
        bDirect -
        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 maxAllowed

        default: AppendElementN(elementName, maxAllowed, null)

        Parameters:
        elementName - name of the new child element
        maxAllowed - 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
        null if 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
        null if 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 xpath
        methCountSiblings - , 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
        null if 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 xpath
        methCountSiblings - , 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
        null if 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 beforePos

        default: InsertAt(nodeName, beforePos, null, null, null)

        Parameters:
        nodeName - name of the new Element
        beforePos - index of beforeNode, i.e if beforePos = 0, put it before the first occurrence
        beforeNode - name of the node to put it before, default - any name, Wildcard supported
        nameSpaceURI - nameSpace of the new node
        beforeNameSpaceURI - 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@thisAtt parentElement/thisElement[2]/@thisAtt parentElement/thisElement[@foo=\"bar\"]/@thisAtt
        value - 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@thisAtt parentElement/thisElement[2]/@thisAtt parentElement/thisElement[@foo=\"bar\"]/@thisAtt
        value - 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/@thisAtt parentElement/thisElement[2]/@thisAtt parentElement[@a=\"b\"]/thisElement[@foo=\"bar\"]/@thisAtt
        def - 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/@thisAtt parentElement/thisElement[2]/@thisAtt parentElement[@a=\"b\"]/thisElement[@foo=\"bar\"]/@thisAtt
        def - 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/@thisAtt parentElement/thisElement[2]/@thisAtt parentElement[@a=\"b\"]/thisElement[@foo=\"bar\"]/@thisAtt if 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.g parentElement/thisElement parentElement/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.g parentElement/thisElement parentElement/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/thisElement parentElement/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:
        hasAttributes in interface org.w3c.dom.Node
        Overrides:
        hasAttributes in class org.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 for
      nameSpaceURI - nameSpace you are searching for
      mAttrib - attributes you are looking for. Wildcards in the attribute map are supported
      bDirect - if true return value is a vector of all direct elements. Otherwise the returned vector contains nodes of arbitrary depth
      bAnd - 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 is null
      mAttrib - attributes you are looking for
      Wildcards in the attribute map are supported. Default is an empty Map
      bDirect - 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. null if 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 return this 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 element
      src - the source element, if null; use this
      srcXPath - 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 attribute

      default: 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
      srcAttrib - attribute to copy, defaults to the value of attrib
      nameSpaceURI - of the attribute in the destination
      srcNameSpaceURI - 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 attribute

      default: 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
      srcAttrib - attribute to copy, defaults to the value of attrib
      nameSpaceURI - of the attribute in the destination
      srcNameSpaceURI - 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 necessary

      default: 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 necessary

      default: 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 attribute
      src - element to move from
      srcAttrib - the attribute to move. If empty string, the string attrib is used as source and target
      nameSpaceURI - the namespaceURI to set
      srcNameSpaceURI -
    • 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 attribute
      src - 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 -
Returns:
number of child nodes with "nodeType"
  • 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
Returns:
true if success, false if failed (no i'th node of nodeType found)
  • 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
Returns:
int: the counted number of direct child nodes, that match NodeType
  • 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 nodetype nodeType with 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
Returns:
KElement: a node that matches the filter, null if iPos is higher then the number of child nodes
  • 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, nodename exp:myexampley would return exp
    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 attributes
    strValues - 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 xmlnsPrefix
    Parses pc for it's namespace prefix

    ns:foo will return ns
    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:
    removeAttribute in interface org.w3c.dom.Element
    Overrides:
    removeAttribute in class org.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:
    removeAttributeNS in interface org.w3c.dom.Element
    Overrides:
    removeAttributeNS in class org.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:
    removeAttributeNode in interface org.w3c.dom.Element
    Overrides:
    removeAttributeNode in class org.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:
    setAttributeNode in interface org.w3c.dom.Element
    Overrides:
    setAttributeNode in class org.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:
    setAttributeNodeNS in interface org.w3c.dom.Element
    Overrides:
    setAttributeNodeNS in class org.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:
    setAttributeNS in interface org.w3c.dom.Element
    Overrides:
    setAttributeNS in class org.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:
    normalize in interface org.w3c.dom.Node
    Overrides:
    normalize in class org.apache.xerces.dom.ElementImpl
    See Also:
    ElementImpl.normalize()
  • setNodeValue

    public void setNodeValue​(java.lang.String arg0)
                      throws org.w3c.dom.DOMException
    Specified by:
    setNodeValue in interface org.w3c.dom.Node
    Overrides:
    setNodeValue in class org.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:
    setPrefix in interface org.w3c.dom.Node
    Overrides:
    setPrefix in class org.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:
    appendChild in interface org.w3c.dom.Node
    Overrides:
    appendChild in class org.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:
    removeChild in interface org.w3c.dom.Node
    Overrides:
    removeChild in class org.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:
    insertBefore in interface org.w3c.dom.Node
    Overrides:
    insertBefore in class org.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:
    replaceChild in interface org.w3c.dom.Node
    Overrides:
    replaceChild in class org.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 syntax e[i] or e[@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 search
    attNS - the namespace of the attribute
    Returns:
  • clone

    public KElement clone()
    the clone is the same document
    Overrides:
    clone in class java.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. jobpartid
    nameSpaceURI - 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 level
    nameSpaceURI -
    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: IStreamWriter
    write myself to a stream
    Specified by:
    writeStream in interface IStreamWriter
    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:
  • parseFile

    public static KElement parseFile​(java.io.File file)
    Parameters:
    filename -
    Returns:
  • clearNSMap

    public void clearNSMap()
    cleanup all namespace stuff