Class DataNode

All Implemented Interfaces:
Element.DualDomNode, Peer

public final class DataNode extends Element implements Element.DualDomNode
DataNode is a class that combines what used to be two classes in the C++ code base: XFADataGroup and XFADataValue. Because of the revised DOM structure we're using in Java, we can't tell when an element is first created whether it's a dataGroup or dataValue. The easiest answer is to not differentiate. We'll set the classId after we load and rely on it to tell the difference.
  • Constructor Details

    • DataNode

      public DataNode(Element parent, Node prevSibling, String uri, String localName, String qName, Attributes attributes)
      Constructor for DataGroups and DataNodes
    • DataNode

      public DataNode(Element parent, Node prevSibling)
    • DataNode

      public DataNode(Element parent, Node prevSibling, String value)
      Constructor for (text-only) DataValues. Note the empty localName.
  • Method Details

    • appendChild

      public void appendChild(Node oChild, boolean bValidate)
      Description copied from class: Element
      Appends the given child to this element.
      Overrides:
      appendChild in class Element
      Parameters:
      oChild - the child node being appended.
      bValidate - when true, ensures the given child is valid per the model's schema and throws an ExFull if not.
    • clearNull

      public void clearNull()
    • clone

      public Element clone(Element parent, boolean deep)
      Overrides:
      clone in class Element
    • createChild

      public Node createChild(boolean bIsLeaf, String aName)
      create a new child that is appended to this node.
    • getContains

      public String getContains()
      Determine if a DataValue participates in its parent's value or is an attribute of the parent. The value returned is "data" or "metaData".
      Returns:
      String that determines if this data value should be included in its parent's value result or as an attribute of the parent.
    • getContentType

      public String getContentType()
      Determine the content type for a DataValue, e.g., text/html.
      Returns:
      String that determines the content type.
    • getDataDescription

      public DataNode getDataDescription()
    • getIsDDPlaceholder

      public boolean getIsDDPlaceholder()
    • getIsNull

      public boolean getIsNull()
      Description copied from class: Element
      Determine if this node contains a null value.
      Overrides:
      getIsNull in class Element
      Returns:
      true if this node contains a null value, false otherwise.
      See Also:
    • getName

      public String getName()
      Overrides:
      getName in class Element
      Returns:
      the name of the element.
    • getLocalName

      public String getLocalName()
      Overrides:
      getLocalName in class Element
      Returns:
      the local name as an interned string.
    • setLocalName

      public void setLocalName(String name)
      Overrides:
      setLocalName in class Element
      Parameters:
      name - the new local name.
    • getXMLName

      public String getXMLName()
      Overrides:
      getXMLName in class Element
      Returns:
      the qualified name as an interned string.
    • setXMLName

      public void setXMLName(String name)
      Overrides:
      setXMLName in class Element
    • getNS

      public String getNS()
      Overrides:
      getNS in class Element
      Returns:
      the namespace URI.
    • getData

      public String getData()
      Description copied from class: Node
      Gets this node's data.
      Overrides:
      getData in class Node
      Returns:
      the data appropriate for the various node types.
    • getFirstXFAChild

      public Node getFirstXFAChild()
      Gets this data element's first XFA child. Text nodes in the data model can't be exposed to counting, scripting, etc...
      Overrides:
      getFirstXFAChild in class Element
      Returns:
      the first XFA child.
    • getNextXFASibling

      public Node getNextXFASibling()
      Gets this data element's next XFA sibling. Text nodes in the data model can't be exposed to counting, scripting, etc...
      Overrides:
      getNextXFASibling in class Node
      Returns:
      the next XFA sibling.
    • getScriptTable

      public ScriptTable getScriptTable()
      Overrides:
      getScriptTable in class Element
    • getValue

      public String getValue()
      Get the value of the node.
      Returns:
      The string value of this node.
    • getValue

      public String getValue(boolean bUseNull)
      Get the value of the node.
      Returns:
      The string value of this node.
    • isAttribute

      public boolean isAttribute()
      Does this data node correspond to an XML Attribute?
      Returns:
      true if this node corresponds to an XML Attribute.
    • getWeight

      public int getWeight()
    • insertChild

      public void insertChild(Node oChild, Node refChild, boolean bValidate)
      Description copied from class: Element
      Inserts a child before a specific child in the child list.
      Overrides:
      insertChild in class Element
      Parameters:
      oChild - the child to be inserted
      refChild - the child to insert before
      bValidate - if true, validate the insertion
    • isContainer

      public boolean isContainer()
      Description copied from class: Node
      Check to see if this is a container object. A container is defined as something that is not a leaf node not properties ( [0..1] occurrences ). It does NOT indicate whether this node derives from XFAContainer
      Overrides:
      isContainer in class Element
      Returns:
      true if this node is a container, false otherwise
    • isValidAttr

      public boolean isValidAttr(int eTag, boolean bReport, String value)
      Description copied from class: Element
      Determine if a specified attribute tag is valid for this node.
      Overrides:
      isValidAttr in class Element
      Parameters:
      eTag - the XFA tag to check
      Returns:
      true if valid.
      See Also:
    • isValidChild

      public boolean isValidChild(int eTag, int nResId, boolean bBeforeInsert, boolean bOccurrenceErrorOnly)
      Overrides:
      isValidChild in class Element
      Parameters:
      eTag - the class tag of the node that will be or has been appended
      nResId -
      bBeforeInsert - if true, then the child has not yet been inserted into the child list of this element.
      bOccurrenceErrorOnly -
      Returns:
      true if eTag is a valid child.
      See Also:
    • isValidElement

      public boolean isValidElement(int eTag, boolean bReport)
      Overrides:
      isValidElement in class Element
      See Also:
    • makeNonDefault

      public void makeNonDefault(boolean bRecursive)
      Description copied from class: Node
      Mark this element to indicate it is not a default property
      Overrides:
      makeNonDefault in class Element
      See Also:
    • processTextChildrenDuringParse

      public boolean processTextChildrenDuringParse()
      Text children of data cannot be processed at parse time. This processing is deferred to postLoad processing.
      Overrides:
      processTextChildrenDuringParse in class Element
      Returns:
      true if child text nodes should be processed at parse time.
    • preSave

      public void preSave(boolean bSaveXMLScript)
      Overrides:
      preSave in class Element
      See Also:
    • remove

      public void remove()
      Removes this node fron its parent.
      Overrides:
      remove in class Node
    • resetPostLoadXML

      public void resetPostLoadXML()
      Overrides:
      resetPostLoadXML in class Element
    • saveXML

      public void saveXML(OutputStream sOutFile, DOMSaveOptions options)
      Description copied from class: Element
      Serializes this element (and all its children) to an output stream.
      Overrides:
      saveXML in class Element
      Parameters:
      sOutFile - an output stream.
      options - the XML save options
      See Also:
    • serialize

      public void serialize(OutputStream outStream, DOMSaveOptions options, int level, Node prevSibling) throws IOException
      Description copied from class: Node
      The helper function used by saveXML()
      Overrides:
      serialize in class Element
      Parameters:
      outStream - Streamfile to write to
      options - save options
      level - the indent level
      prevSibling - our previous sibling -- needed for some markup options.
      Throws:
      IOException
      See Also:
    • setContentType

      public void setContentType(String contentType)
    • setDataDescription

      public void setDataDescription(DataNode dataDescription)
    • setIsDDPlaceholder

      public void setIsDDPlaceholder(boolean bIsDDPlaceholder)
    • setIsNull

      public void setIsNull(boolean bNull, boolean bNotify)
      Set the null status for this node
      Parameters:
      bNull -
      bNotify -
    • setName

      public void setName(String sName)
      Description copied from class: Element
      Sets this element's name attribute.
      Overrides:
      setName in class Element
      Parameters:
      sName - the name attribute value.
    • setPictureFormat

      public void setPictureFormat(String sFormat, String sLocale, boolean bIsTextNode)
      Proprietary: set the data picture format for this data value Applicable to dataValue nodes
      Parameters:
      sFormat -
      sLocale -
      bIsTextNode -
    • setPrivateName

      public void setPrivateName(String sName)
      Description copied from class: Node
      used when resolving protos
      Overrides:
      setPrivateName in class Node
    • setValue

      public void setValue(String sValue, boolean bNotify)
      Set the value of the node. Note! if a DataValue has child DataValues, setting the value will delete all children.
      Parameters:
      sValue - - the new value for this node.
    • setWeight

      public int setWeight(int nWeight)
    • isTransient

      public final boolean isTransient()
      Determine if this node is transient or not. Transient nodes are not saved when the DOM is written out.
      Overrides:
      isTransient in class Node
      Returns:
      boolean transient status.
    • connectPeerToDocument

      public void connectPeerToDocument()
      Description copied from class: Element
      connectPeerToDocument() is used to rearrange the DOM tree when inserting or appending a node. It is provided here as a utility function for derived classes that could be adding child nodes, when peered against an orphan node. In particular, this happens with xfa:datasets and xfa:data, both of which may be created during the load process. On the C++ side, this method is only used by the data model. Due to the differences between the relationship of Documents and AppModels in Java, on the Java side it is also called when creating a DOM from scratch, from any ModelFactory's createDOM method. In the DataModel context at least, it should only be called if the DOM peer is an orphan. It takes that orphan and connects it to the document, and then moves the original peer of this node to be a child of the node that previously was orphaned.
      Overrides:
      connectPeerToDocument in class Element
    • setXmlPeer

      public void setXmlPeer(Node peer)
      Specified by:
      setXmlPeer in interface Element.DualDomNode
    • getXmlPeer

      public Node getXmlPeer()
      Specified by:
      getXmlPeer in interface Element.DualDomNode