org.cip4.jdflib.core
Class KElement

java.lang.Object
  extended by org.apache.xerces.dom.NodeImpl
      extended by org.apache.xerces.dom.ChildNode
          extended by org.apache.xerces.dom.ParentNode
              extended by org.apache.xerces.dom.ElementImpl
                  extended by org.apache.xerces.dom.ElementNSImpl
                      extended by org.cip4.jdflib.core.KElement
All Implemented Interfaces:
Serializable, Cloneable, Element, EventTarget, Node, NodeList, TypeInfo
Direct Known Subclasses:
JDFElement

public class KElement
extends org.apache.xerces.dom.ElementNSImpl
implements Element

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

Author:
CIP4
See Also:
for the first element class that is aware of JDF, Serialized Form

Nested Class Summary
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
KElement(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, String qualifiedName)
          Constructor for KElement
KElement(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, String myNamespaceURI, String qualifiedName)
          Constructor for KElement
KElement(org.apache.xerces.dom.CoreDocumentImpl myOwnerDocument, String myNamespaceURI, String qualifiedName, String myLocalName)
          Constructor for KElement
 
Method Summary
 double addAttribute(String key, double inc, String nameSpaceURI)
          increments or decrements a numeric attribute by inc
 int addAttribute(String key, int inc, String nameSpaceURI)
          increments or decrements a numeric attribute by inc
 boolean addNameSpace(String strPrefix, String strNameSpaceURI)
          Adds a NameSpace and maps the prefix to a URI.
 int ancestorDistance(KElement child)
          distance to ancestor (0=this)
 String appendAnchor(String newID)
          create and append a unique id, keep the existing one if it already exists
 String appendAttribute(String key, String value, String nameSpaceURI, String sep, boolean bUnique)
          Append the contents of value to the existing attribute key.
 void appendCData(KElement cDataElem)
          Appends XML CData section <!
 void appendCData(String cDataText)
          Appends XML CData section <!
 Node appendChild(Node arg0)
           
 KElement appendElement(String elementName)
          append a DOM element.
 KElement appendElement(String elementName, String nameSpaceURI)
           
 KElement appendElementN(String elementName, int maxAllowed, 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)
 KElement appendElementRaw(String elementName, String nameSpaceURI)
          appends an element without any namespace validity checks or initialization Faster but not sa safe...
 void appendEntityReference(String refName)
          appends a entity reference to the actual element
 void appendText(String textName)
          append some generic text
 KElement appendTextElement(String nodeName, String text)
          append a text element with text included
 void appendXMLComment(String commentText)
          Deprecated. use appendXMLComment(commentText, null);
 Node appendXMLComment(String commentText, KElement beforeChild)
          append a DOM comment <!
 String buildXPath()
          Deprecated. use buildXPath(null,true);
 String buildXPath(String relativeTo)
          Deprecated. use buildXPath(relativeTo,true);
 String buildXPath(String relativeTo, int methCountSiblings)
          Gets the XPath full tree representation of 'this'
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...
 void copyAttribute(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)
 void copyAttribute(String attrib, KElement src, String srcAttrib, String nameSpaceURI, String srcNameSpaceURI)
          copy an attribute from src to this default: copyAttribute(attrib, src, null, null, null)
 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. duplicating elements
 String copyXPathValue(String dstXPath, KElement src, String srcXPath)
          copy attribute values or text from an xpath in src to this
static KElement createRoot(String nodename, String namespaceURI)
          create a new root document
 KElement deleteNode()
          Deletes itself from its parent
 void eraseEmptyAttributes(boolean bRecurse)
          remove all empty attributes from this (e.g. att="")
 int eraseEmptyNodes(boolean bTrimWhite)
          Erases all empty text nodes in 'this' and its subelements If there any empty text nodes removes them.
 HashSet<String> fillHashSet(String attName, String attNS)
          fills a HashSet with all values of the attribute in all child elements
protected  boolean fitsName_KElement(String nodeName, String nameSpaceURI)
           
 boolean fitsName(String nodeName, String nameSpaceURI)
          Tests whether the specified nodename and namespace fits the nodename and namespace of 'this'
 boolean flush()
          Flush - remove all attributes, elements and text, leaving only a stub tag
 String generateDotID(String key, 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.
 String getAttribute_KElement(String strLocalName)
          Mother of all attribute getters
Gets an attribute value out of an element
 String getAttribute_KElement(String attrib, String nameSpaceURI, String def)
          Because getAttribute is overwritten in various classes this method can be called directly to get only KElement Attribute.
 String getAttribute(String strLocalName)
          Mother of all attribute getters
Gets an attribute value out of an element
 String getAttribute(String attrib, String nameSpaceURI, String def)
          mother of all attribute getters.
 JDFAttributeMap getAttributeMap()
          Get the Attribute Map of the actual element
 VString getAttributeVector_KElement()
          Gets all attribute keys of 'this' as a vector of strings
 VString getAttributeVector()
          Gets all attribute keys of 'this' as a vector of strings
 boolean getBoolAttribute(String attrib, String nameSpaceURI, boolean def)
          get a boolean attribute default: getBoolAttribute(attrib, null, false)
 String getCData(int i)
          Gets of 'this' the text of the i'th XML CData section.
 VString getChildAttributeList(String nodeName, String attName, String nameSpaceURI, 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)
 KElement getChildByTagName(String s, 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_KElement(String nodeName, 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
 VElement getChildElementVector(String nodeName, String nameSpaceURI)
          Get all children from the actual element matching the given conditions
convenience for getChildElementVector(nodeName, nameSpaceURI, null, true, 0, true)
 VElement getChildElementVector(String nodeName, String nameSpaceURI, JDFAttributeMap mAttrib, boolean bAnd, int maxSize)
          Deprecated. 060302 - use 6 parameter version
 VElement getChildElementVector(String nodeName, 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
 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.
protected  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)
 Vector getChildNodeVector(int maxSize)
          Deprecated.  
<a extends KElement>
Vector<a>
getChildrenByClass(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
 VElement getChildrenByTagName_KElement(String elementName, 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.
 VElement getChildrenByTagName(String elementName, 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.
 VElement getChildrenFromList(VString nodeNames, JDFAttributeMap map, boolean bDirect, VElement v)
          get a vector of all Children that match the strings defined in nodeNames
 VElement getChildrenWithAttribute(String nodeName, String attName, String nameSpaceURI, String attVal, boolean bDirect)
          Deprecated. use getChildrenByTagName(nodeName, nameSpaceURI, new JDFAttributeMap(attName, attVal), bDirect, true, 0);
 KElement getChildWithAttribute(String nodeName, String attName, String nameSpaceURI, String attVal, int index, boolean bDirect)
          GetChildWithAttribute - Get a child with matching attributes default: getChildWithAttribute(nodeName, attName, null,attValue, 0, true)
 KElement getCreateElement_KElement(String nodeName, String nameSpaceURI, int iSkip)
          Gets the iSkip-th child node with matching nodeName and nameSpaceURI, optionally creates it if it doesn't exist.
 KElement getCreateElement(String nodeName)
          Get the actual element, create if not there
 KElement getCreateElement(String nodeName, String nameSpaceURI, int iSkip)
          Get the actual element, create if not there
 KElement getCreateXPathElement(String path)
          gets an element as defined by XPath to value and creates it if it does not exist
 KElement getDeepElement(String nodeName, String nameSpaceURI, int iSkip)
          Deprecated. use getChildByTagName(nodeName, nameSpaceURI, iSkip, null, false, true);
 KElement getDeepParent(String parentNode, int depth)
          Get the n'th Ancestor node with name parentNode
 KElement getDeepParent(Vector vParentElement, int depth)
          Deprecated. - loop over the single node method
 KElement getDeepParentChild(String parentNode)
          Get the first child of parentNode with name parentNode
 KElement getDeepParentNotName(String thisNode)
          Get the Ancestor node with name other than thisNode
 KElement getDocRoot()
          Gets the root element of the current document
 Attr getDOMAttr(String attrib, 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
 KElement getElement_KElement(String nodeName, String nameSpaceURI, int iSkip)
          getElement - Get the actual element
 KElement getElement(String nodeName)
          Get the actual element - utility routine.
 KElement getElement(String nodeName, String nameSpaceURI, int iSkip)
          Gets an existing iSkip-th child node with matching nodeName and nameSpaceURI
<a extends KElement>
a
getElementByClass(Class<a> clazz, int iSkip, boolean bRecurse)
          getElement - Get the actual element by java class
 HashMap<String,KElement> getElementHashMap(String elementName, String elementNS, String JDFCoreConstants)
          performance enhanced function to access multiple elements e.g. by ID get a HashMap of key= attribute value, object=element
 VString getElementNameVector()
          Returns a vector which contains the childs of the actual element.
 VElement getElementsByTagName_KElement(String s, String nameSpaceURI)
          wrappers of DOM routines that dont bang on null nodes
 KElement getFirstChildElement()
          get the first child element
<a extends KElement>
a
getFirstChildElement(Class<a> clazz)
          Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.
 KElement getFirstChildElement(String nodeName, String nameSpaceURI)
          Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.
static Element getFirstElementNode(Element parent)
          Deprecated. use elem.getFirstChildElement
 String getID()
          gets attribute ID
protected  String getIDPrefix()
          getIDPrefix
 String getInheritedAttribute(String attrib, String nameSpaceURI, String def)
          searches for the first attribute occurence in this element or any ancestors
 KElement getInheritedElement(String elementName, String nameSpaceURI, int iSkip)
          searches for the first child element occurence in this element or any ancestors default: getInheritedElement(elementName, null, 0)
 String getInheritedXPathAttribute(String path, 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(String attrib, String nameSpaceURI, int def)
          Get a integer attribute if present default: getIntAttribute(attrib, null, 0)
static String getLocalNameStatic(KElement kElem)
          Deprecated. use getLocalName
 long getLongAttribute(String attrib, String nameSpaceURI, long def)
          Get a long attribute if present default: getLongAttribute(attrib, null, 0)
 VString getMultipleIDs(String JDFCoreConstants)
          Get a vector of all IDs that occur multiple times
 String getNamespaceURI()
          Get the NameSpaceURI
 String getNamespaceURIFromPrefix(String prefix)
          Gets the NameSpaceURI corresponding to a given prefix, returns null if no namespace is defined
static Element getNextElementNode(Element elem)
          Deprecated. - use elem.getNextSiblingElement();
 KElement getNextSiblingElement()
          get the next sibling element
<a extends KElement>
a
getNextSiblingElement(Class<a> clazz)
          Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.
 KElement getNextSiblingElement(String nodeName, String nameSpaceURI)
          Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.
 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(String nodeName, String nameSpaceURI)
          Gets the previous sibling named nodename from the namespace nameSpaceURI of 'this'.
 double getRealAttribute(String attrib, String nameSpaceURI, double def)
          get a double attribute default: getRealAttribute(attrib, null, 0.0)
 KElement getTarget_KElement(String id, String attrib)
          Gets the target of link.
 KElement getTarget(String id, String attrib)
          looking for a specified target with an id, e.g. resource.
 String getText()
          gets a concatenated string representing of all direct text child nodes
 String getText(int i)
          gets the i'th text child node of 'this'
 VElement getTree(String nodeName, String nameSpaceURI, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd)
          Get children from the actual element by the tag name, nameSpaceURI or attribute map.
 KElement getTreeElement(String nodeName, String nameSpaceURI, JDFAttributeMap mAttrib, boolean bDirect, boolean bAnd)
          Get child from the actual element by the tag name, nameSpaceURI or attribute map.
 String getXMLComment(int i)
          gets of 'this' the text of the i-th child XMLComment.
static String getXMLNSNameSpace(String pc)
          Deprecated.  
static String getXMLNSPrefix(String pc)
          Deprecated. use xmlnsPrefix
 String getXPathAttribute(String path, 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(String path)
          Gets a map of attribute values as defined by XPath namespace prefixes are resolved
 KElement getXPathElement(String path)
          gets an element as defined by XPath to value
 VElement getXPathElementVector(String path, int maxSize)
          gets an vector of elements element as defined by XPath to value
 String getXSIType()
          returns the xsi:type of this element, null if not present
 boolean hasAttribute_KElement(String attrib, String nameSpaceURI, boolean bInherit)
          Checks if the actual element has a specific attribute
this version checks within the exact xml element
 boolean hasAttribute(String attrib)
          Checks if the actual element has a specific attribute
this version checks within the resource and its partitioned parent xml elements
 boolean hasAttribute(String attrib, 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(String nodeName, String nameSpaceURI)
          Checks whether the current element has a child element NodeName default: hasChildElement(String nodeName, null)
 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 hasXPathNode(String path)
          returns true if the element or attribute described by this XPath exists, else false
 boolean includesAttribute(String attName, 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(String nodeName, int beforePos, String beforeNode, String nameSpaceURI, 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)
 Node insertBefore(Node arg0, Node arg1)
           
 KElement insertBefore(String elementName, Node beforeChild, String nameSpaceURI)
          Inserts the Element elementName before the existing Element node beforeChild.
 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 isWildCard(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(String path)
          Deprecated. use matchesPath(String path, boolean bFollowRefs)
 boolean matchesPath(String path, boolean bFollowRefs)
          check whether this element matches a simple xpath
protected  boolean matchesPathName(String pathAt)
           
 KElement mergeElement(KElement kElem, boolean bDelete)
          merge nodes in a way that no duplicate elements are created
attention !!
 void moveAttribute(String attrib, KElement src)
          moves an attribute from src to this, the attribute will be removed from src and moved to this.
 void moveAttribute(String attrib, KElement src, String srcAttrib, String nameSpaceURI, 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)
          move all children in a vector of elements in the order of the vector
 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_KElement(String node, String nameSpaceURI)
          Get the number of child elements.
 int numChildElements(String node, String nameSpaceURI)
          Get the number of child elements.
 int numChildNodes(int nodeType)
          count the number of child nodes of DOM nodeType nodeType (0=count all)
 int numSiblingElements(String elementName, String nameSpaceURI)
          get the number of sibling elements
 KElement pushUp(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_KElement(String attrib, String nameSpaceURI)
          Remove a attribute from the current element
 void removeAttribute(String attrib)
           
 void removeAttribute(String attrib, String nameSpaceURI)
          Remove an attribute from the current element
 Attr removeAttributeNode(Attr arg0)
           
 void removeAttributeNS(String nameSpaceURI, String attrib)
           
 void removeAttributes(VString attribs)
          Removes all attributes spezified in attribs.
 void removeCData(int i)
          Removes the i'th XML CData section
 Node removeChild(Node arg0)
           
 KElement removeChild(String node, String nameSpaceURI, int n)
          Removes the n'th child node that matches 'nodeName' and 'nameSpaceURI'
 boolean removeChildNode(int nodeType, int i)
          removes the i'th child node, that match NodeType
 void removeChildren(String nodeName, String nameSpaceURI)
          Deprecated. use three parameter version removeChildren(nodeName, nameSpaceURI, null);
 void removeChildren(String nodeName, String nameSpaceURI, JDFAttributeMap mAttrib)
          Removes the children named nodeName in the namespace nameSpaceURI from the parent element default: removeChildren(null,null,null)
 void removeChildText(int i)
          Removes the i'th text node of 'this'
 void removeExtensions(String nsURI)
          remove all elements and attributes of a given namespace
 int removeFromAttribute(String key, String token, String nameSpaceURI, String sep, int nMax)
          Removes the attribute value from its value list
Removes the contents of value from the existing attribute key.
 void removeXMLComment(int i)
          removes the i'th XMLComment node
 void removeXPathAttribute(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(String path)
          remove an attribute or element that is described by the xpath path quietly returns if the element does not exist
 void renameAttribute(String oldName, String newName, String nameSpaceURI, String newNameSpaceURI)
          Rename an attribute in this namespace
if oldName does not exist, newName is NOT modified default: renameAttribute(oldName, newName, null, null)
 KElement renameElement(String newName, String nameSpaceURI)
          Rename the element with the String newName.
 Node replaceChild(Node arg0, Node arg1)
           
 KElement replaceElement(KElement src)
          Replaces 'this' with src.
 void setAttribute(String key, boolean b, String nameSpaceURI)
          SetAttribute - Sets an element attribute
 void setAttribute(String key, double value, String nameSpaceURI)
          Sets an element attribute
 void setAttribute(String key, double value, String nameSpaceURI, int precision)
          Sets an element attribute
 void setAttribute(String key, int value, String nameSpaceURI)
          Sets an element attribute
 void setAttribute(String key, long value, String nameSpaceURI)
          Sets an element attribute
 void setAttribute(String key, String value)
          no namespace variant
 void setAttribute(String key, String value, String nameSpaceURI)
          Mother of all Attribute setters
Sets a new attribute.
 void setAttribute(String key, VString value, String nameSpaceURI)
          Sets an NMTOKENS attribute to all elements from parameter value will be concatenate with blanks to the resulting NMTOKEN
 Attr setAttributeNode(Attr arg0)
           
 Attr setAttributeNodeNS(Attr arg0)
           
 void setAttributeNS(String nsURI, String arg1, String arg2)
           
 void setAttributeNSRaw(String ns, String key, String value)
          fastest setAttribute with namespace- use only if you know exactly what you are doing
 void setAttributeRaw(String key, String value)
          fastest setAttribute - use only if you know exactly what you are doing
 int setAttributes(JDFAttributeMap map)
          Sets the attributes from the curent element.
 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.
 void setAttributes(String[] myAttributes, String[] strValues)
          Deprecated. use setAttributes(JDFAttributeMap)
 void setAttributesRaw(KElement kElem)
          Sets the attributes from the current element to the attributes from kElem.
 void setBoolAttribute(String key, boolean b, String nameSpaceURI)
          Deprecated. use setAttribute instead
 void setDirty()
          Deprecated. use setDirty (bAttribute)
 void setDirty(boolean bAttribute)
          Set this element as dirty
 void setID(String id)
          gets attribute ID
 void setIntAttribute(String key, int value, String nameSpaceURI)
          Deprecated. use setAttribute instead
static void setLongID(boolean bLong)
          set the ID generation algorithm to include a date
 void setNamespaceURI(String arg0)
           
 void setNodeValue(String arg0)
           
 void setPrefix(String arg0)
           
 void setRealAttribute(String key, double value, String nameSpaceURI)
          Deprecated. use setAttribute instead
 void setText(String text)
          Sets an XML Text
the text contents of this to the value of text
 void setvStringAttribute(String key, VString value, String nameSpaceURI)
          Deprecated. use setAttribute instead
 void setXMLComment(String commentText)
          set a DOM comment <!
 void setXPathAttribute(String path, String value)
          Sets an attribute as defined by XPath to value
 void setXPathValue(String path, 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(String typ)
           
 void sortChild(KElement e)
          sorts/inserts e by alphabet
 void sortChild(KElement e, Comparator<KElement> comparator)
          insert e into this, assuming that this is already sorted
 void sortChildren()
          sorts all child elements by alphabet
 void sortChildren(Comparator<KElement> comparator)
          sorts all child elements by alphabet
 String toDisplayXML(int indent)
          serialize this to a string
 String toString()
          this to string, used for debug purpose mostly
 String toXML()
          serialize this to a string
 String toXML(int indent)
          serialize this to a string
static 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.
 boolean write2File(File file)
          write myself to a file
 boolean write2File(String filename)
          write myself to a file
 boolean write2Stream(OutputStream stream)
          write myself to an output stream
static String xmlNameSpace(String s)
          Deprecated. use xmlnsPrefix()
static String xmlnsLocalName(String pc)
          used by get localname
static String xmlnsPrefix(String nodeName)
          Parses pc for it's namespace prefix
 
Methods inherited from class org.apache.xerces.dom.ElementNSImpl
getBaseURI, getLocalName, getPrefix, getTypeName, getTypeNamespace, isDerivedFrom, setType, setValues
 
Methods inherited from class org.apache.xerces.dom.ElementImpl
cloneNode, getAttributeNode, getAttributeNodeNS, getAttributeNS, getAttributes, getDefaultAttributes, getElementsByTagName, getElementsByTagNameNS, getNodeName, getNodeType, 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,
                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,
                String myNamespaceURI,
                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,
                String myNamespaceURI,
                String qualifiedName,
                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

@Deprecated
public void setDirty()
Deprecated. use setDirty (bAttribute)

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 String getInheritedAttribute(String attrib,
                                    String nameSpaceURI,
                                    String def)
searches for the first attribute occurence 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 String getAttribute(String attrib,
                           String nameSpaceURI,
                           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 String getAttribute_KElement(String attrib,
                                    String nameSpaceURI,
                                    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 String getAttribute(String strLocalName)
Mother of all attribute getters
Gets an attribute value out of an element

Specified by:
getAttribute in interface 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

getAttribute_KElement

public String getAttribute_KElement(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(String key,
                                           VString value,
                                           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(String key,
                         VString value,
                         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

getDOMAttr

public Attr getDOMAttr(String attrib,
                       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(String key,
                         String value,
                         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(String key,
                         String value)
no namespace variant

Specified by:
setAttribute in interface Element
Overrides:
setAttribute in class org.apache.xerces.dom.ElementImpl
Parameters:
key - name of the attribute to set
value - value of the attribute

setAttributeRaw

public void setAttributeRaw(String key,
                            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(String ns,
                              String key,
                              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(String key,
                                       int value,
                                       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(String key,
                         int value,
                         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(String key,
                         long value,
                         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(String key,
                                        double value,
                                        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(String key,
                         double value,
                         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(String key,
                         double value,
                         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(String key,
                                        boolean b,
                                        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(String key,
                         boolean b,
                         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(String key,
                           double inc,
                           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(String key,
                        int inc,
                        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(String attrib,
                            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(String attrib,
                                     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(String attrib)
Checks if the actual element has a specific attribute
this version checks within the resource and its partitioned parent xml elements

Specified by:
hasAttribute in interface 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(String attrib,
                            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(String attrib,
                                     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 String appendAttribute(String key,
                              String value,
                              String nameSpaceURI,
                              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

isWildCard

public static boolean isWildCard(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(String nodeName,
                        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(String nodeName,
                                    String nameSpaceURI)

getNamespaceURIFromPrefix

public String getNamespaceURIFromPrefix(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 String getNamespaceURI()
Get the NameSpaceURI

Specified by:
getNamespaceURI in interface Node
Overrides:
getNamespaceURI in class org.apache.xerces.dom.ElementNSImpl
Returns:
String The nameSpaceURI

xmlnsPrefix

public static String xmlnsPrefix(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 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

init

public boolean init()
Method init. Superclass of all inits

Returns:
boolean true always

appendElement

public KElement appendElement(String elementName,
                              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(String elementName,
                                 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(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

getChildElementVector

@Deprecated
public VElement getChildElementVector(String nodeName,
                                                 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(String nodeName,
                                      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(String nodeName,
                                      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(String nodeName,
                                               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)

getChildrenByClass

public <a extends KElement> Vector<a> getChildrenByClass(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

Type Parameters:
a -
Parameters:
clazz -
bRecurse - if true recurse through all children, grandchildren etc.
nMax - maximum number to search - if 0 or negative, search all
Returns:
Vector vector with all found elements
See Also:
getChildElementVector(java.lang.String, java.lang.String, org.cip4.jdflib.datatypes.JDFAttributeMap, boolean, int)

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(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(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(String nodeName,
                                      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(String nodeName,
                                     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(String nodeName,
                                          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(String attName,
                                 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(String elementName,
                                     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(String elementName,
                                              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(String s,
                                              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(String nodeName,
                                                    String attName,
                                                    String nameSpaceURI,
                                                    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(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(String JDFCoreConstants)
Get a vector of all IDs that occur multiple times

Parameters:
JDFCoreConstants - 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(String nodeName,
                                 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(String nodeName,
                                          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(String nodeName)
Get the actual element - utility routine.

Parameters:
nodeName - Name of the node
Returns:
KElement - the child node

getElement

public KElement getElement(String nodeName,
                           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 HashMap<String,KElement> getElementHashMap(String elementName,
                                                  String elementNS,
                                                  String JDFCoreConstants)
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
JDFCoreConstants - the attribute name - MUST not be null
Returns:
a hashmap of the matching elements

getElement_KElement

public KElement getElement_KElement(String nodeName,
                                    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(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(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(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'

getTarget

public KElement getTarget(String id,
                          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(String id,
                                   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 Element getFirstElementNode(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 Element getNextElementNode(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(String node,
                            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

numChildElements_KElement

public int numChildElements_KElement(String node,
                                     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(String node,
                            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(String s,
                                  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

@Deprecated
public void removeChildren(String nodeName,
                                      String nameSpaceURI)
Deprecated. use three parameter version removeChildren(nodeName, nameSpaceURI, null);

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(String nodeName,
                           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(String key,
                               String token,
                               String nameSpaceURI,
                               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 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(VString attribs)
Removes all attributes spezified in attribs. If attribs is empty, all attributes are removed

Parameters:
attribs - list of attributes to remove, if empty, 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(String nodeName,
                                          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(String newName,
                              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(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

public void moveElements(VElement 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(String attrib,
                             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(String attrib,
                           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(String attrib,
                                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(String attrib,
                               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(String thisNode)
Get the Ancestor node with name other than thisNode

Parameters:
thisNode - serch string
Returns:
KElement parent node element

getDeepParentChild

public KElement getDeepParentChild(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(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 Node appendXMLComment(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(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

appendCData

public void appendCData(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(String textName)
append some generic text

Parameters:
textName - the text to append

appendEntityReference

public void appendEntityReference(String refName)
appends a entity reference to the actual element

Parameters:
refName - the name of the entity reference

appendTextElement

public KElement appendTextElement(String nodeName,
                                  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(String nodeName,
                                      String attName,
                                      String nameSpaceURI,
                                      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

hasChildElement

public boolean hasChildElement(String nodeName,
                               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(String elementName,
                                    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(String strPrefix,
                            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


sortChild

public void sortChild(KElement e)
sorts/inserts e by alphabet

Parameters:
e -

sortChildren

public void sortChildren(Comparator<KElement> comparator)
sorts all child elements by alphabet

Parameters:
comparator - the comparator object to sort by

sortChild

public void sortChild(KElement e,
                      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

toString

public 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 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 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 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(String oldName,
                            String newName,
                            String nameSpaceURI,
                            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

getChildAttributeList

public VString getChildAttributeList(String nodeName,
                                     String attName,
                                     String nameSpaceURI,
                                     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(String elementName,
                             Node beforeChild,
                             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 -
Returns:
VElement the found child elements

appendElementN

public KElement appendElementN(String elementName,
                               int maxAllowed,
                               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 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 String buildXPath(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 String buildXPath(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)

insertAt

public KElement insertAt(String nodeName,
                         int beforePos,
                         String beforeNode,
                         String nameSpaceURI,
                         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(String path,
                          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(String path,
                              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(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 String getXPathAttribute(String path,
                                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 String getInheritedXPathAttribute(String path,
                                         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(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

getXPathElement

public KElement getXPathElement(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:
IllegalArgumentException - if path is not supported

getXPathElementVector

public VElement getXPathElementVector(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:
IllegalArgumentException - if path is not supported

getCreateXPathElement

public KElement getCreateXPathElement(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 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(String nodeName,
                        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

getTreeElement

public KElement getTreeElement(String nodeName,
                               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 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 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 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 String copyXPathValue(String dstXPath,
                             KElement src,
                             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 void copyAttribute(String attrib,
                          KElement src,
                          String srcAttrib,
                          String nameSpaceURI,
                          String srcNameSpaceURI)
copy an attribute from src to this

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

copyAttribute

public void copyAttribute(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

moveAttribute

public void moveAttribute(String attrib,
                          KElement src,
                          String srcAttrib,
                          String nameSpaceURI,
                          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 search in
srcNameSpaceURI -

moveAttribute

public void moveAttribute(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 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(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

public int numChildNodes(int nodeType)
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"

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)

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 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 String xmlNameSpace(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(String[] myAttributes,
                                     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:
ArrayIndexOutOfBoundsException - if the arrays are not of equal length

xmlnsLocalName

public static String xmlnsLocalName(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 String getXMLNSNameSpace(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(String typ)
Parameters:
typ -

getXSIType

public 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 String getXMLNSPrefix(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(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(String attrib)
                     throws DOMException
Specified by:
removeAttribute in interface Element
Overrides:
removeAttribute in class org.apache.xerces.dom.ElementImpl
Throws:
DOMException
See Also:
ElementImpl.removeAttribute(java.lang.String)

removeAttributeNS

public void removeAttributeNS(String nameSpaceURI,
                              String attrib)
                       throws DOMException
Specified by:
removeAttributeNS in interface Element
Overrides:
removeAttributeNS in class org.apache.xerces.dom.ElementImpl
Throws:
DOMException
See Also:
ElementImpl.removeAttributeNS(java.lang.String, java.lang.String)

removeAttributeNode

public Attr removeAttributeNode(Attr arg0)
                         throws DOMException
Specified by:
removeAttributeNode in interface Element
Overrides:
removeAttributeNode in class org.apache.xerces.dom.ElementImpl
Throws:
DOMException
See Also:
ElementImpl.removeAttributeNode(org.w3c.dom.Attr)

setAttributeNode

public Attr setAttributeNode(Attr arg0)
                      throws DOMException
Specified by:
setAttributeNode in interface Element
Overrides:
setAttributeNode in class org.apache.xerces.dom.ElementImpl
Throws:
DOMException
See Also:
ElementImpl.setAttributeNode(org.w3c.dom.Attr)

setAttributeNodeNS

public Attr setAttributeNodeNS(Attr arg0)
                        throws DOMException
Specified by:
setAttributeNodeNS in interface Element
Overrides:
setAttributeNodeNS in class org.apache.xerces.dom.ElementImpl
Throws:
DOMException
See Also:
ElementImpl.setAttributeNodeNS(org.w3c.dom.Attr)

setAttributeNS

public void setAttributeNS(String nsURI,
                           String arg1,
                           String arg2)
                    throws DOMException
Specified by:
setAttributeNS in interface Element
Overrides:
setAttributeNS in class org.apache.xerces.dom.ElementImpl
Throws:
DOMException
See Also:
ElementImpl.setAttributeNS(java.lang.String, java.lang.String, java.lang.String)

normalize

public void normalize()
Specified by:
normalize in interface Node
Overrides:
normalize in class org.apache.xerces.dom.ElementImpl
See Also:
ElementImpl.normalize()

setNodeValue

public void setNodeValue(String arg0)
                  throws DOMException
Specified by:
setNodeValue in interface Node
Overrides:
setNodeValue in class org.apache.xerces.dom.NodeImpl
Throws:
DOMException
See Also:
NodeImpl.setNodeValue(java.lang.String)

setPrefix

public void setPrefix(String arg0)
               throws DOMException
Specified by:
setPrefix in interface Node
Overrides:
setPrefix in class org.apache.xerces.dom.ElementNSImpl
Throws:
DOMException
See Also:
ElementNSImpl.setPrefix(java.lang.String)

setNamespaceURI

public void setNamespaceURI(String arg0)
                     throws DOMException
Parameters:
arg0 - the ns uri to set
Throws:
DOMException

appendChild

public Node appendChild(Node arg0)
                 throws DOMException
Specified by:
appendChild in interface Node
Overrides:
appendChild in class org.apache.xerces.dom.NodeImpl
Throws:
DOMException
See Also:
NodeImpl.appendChild(org.w3c.dom.Node)

removeChild

public Node removeChild(Node arg0)
                 throws DOMException
Specified by:
removeChild in interface Node
Overrides:
removeChild in class org.apache.xerces.dom.ParentNode
Throws:
DOMException
See Also:
ParentNode.removeChild(org.w3c.dom.Node)

insertBefore

public Node insertBefore(Node arg0,
                         Node arg1)
                  throws DOMException
Specified by:
insertBefore in interface Node
Overrides:
insertBefore in class org.apache.xerces.dom.ParentNode
Throws:
DOMException
See Also:
ParentNode.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)

replaceChild

public Node replaceChild(Node arg0,
                         Node arg1)
                  throws DOMException
Specified by:
replaceChild in interface Node
Overrides:
replaceChild in class org.apache.xerces.dom.ParentNode
Throws:
DOMException
See Also:
ParentNode.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)

removeXPathAttribute

public void removeXPathAttribute(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(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(String path)
Deprecated. use matchesPath(String path, boolean bFollowRefs)

check whether this matches a simple xpath

Parameters:
path -
Returns:
boolean

matchesPath

public boolean matchesPath(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(String pathAt)

fillHashSet

public final HashSet<String> fillHashSet(String attName,
                                         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 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 String appendAnchor(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 String getID()
gets attribute ID

Returns:
the attribute value

generateDotID

public String generateDotID(String key,
                            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 String getIDPrefix()
getIDPrefix

Returns:
the default ID prefix of non-overwritten JDF elements

setID

public void setID(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 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

createRoot

public static KElement createRoot(String nodename,
                                  String namespaceURI)
create a new root document

Parameters:
nodename -
namespaceURI -
Returns:

numSiblingElements

public int numSiblingElements(String elementName,
                              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(OutputStream stream)
write myself to an output stream

Parameters:
stream -
Returns:

write2File

public boolean write2File(File file)
write myself to a file

Parameters:
file -
Returns:

write2File

public boolean write2File(String filename)
write myself to a file

Parameters:
filename -
Returns:


Copyright © 2013. All Rights Reserved.