Class YXmlElement<T>


public class YXmlElement<T> extends YXmlFragment<T>
  • Constructor Details

    • YXmlElement

      public YXmlElement()
      Constructor for YXmlElement.
    • YXmlElement

      public YXmlElement(String nodeName)
      Constructor for YXmlElement.
      Parameters:
      nodeName - The name of the XML node. Defaults to 'UNDEFINED'.
  • Method Details

    • getNodeName

      public String getNodeName()
    • setNodeName

      public void setNodeName(String nodeName)
    • getPrelimAttrs

      public Map<String,Object> getPrelimAttrs()
    • getNextSibling

      public AbstractType getNextSibling()
      Returns:
      YXmlElement or YXmlText|null - The next sibling.
    • getPrevSibling

      public AbstractType getPrevSibling()
      Returns:
      YXmlElement or YXmlText|null - The previous sibling.
    • integrate

      public void integrate(Doc y, Item item)
      Integrate this type into the Yjs instance.
      Overrides:
      integrate in class YXmlFragment<T>
      Parameters:
      y - The Yjs instance.
      item - The item to integrate.
    • copy

      public YXmlElement copy()
      Creates an Item with the same effect as this Item (without position effect).
      Overrides:
      copy in class YXmlFragment<T>
      Returns:
      YXmlElement
    • clone

      public YXmlElement clone()
      Makes a copy of this data type that can be included somewhere else.

      Note that the content is only readable _after_ it has been included somewhere in the Ydoc.

      Overrides:
      clone in class YXmlFragment<T>
      Returns:
      YXmlElement
    • toString

      public String toString()
      Returns the XML serialization of this YXmlElement. The attributes are ordered by attribute-name, so you can easily use this method to compare YXmlElements.
      Overrides:
      toString in class YXmlFragment<T>
      Returns:
      String The string representation of this type.
    • removeAttribute

      public void removeAttribute(String attributeName)
      Removes an attribute from this YXmlElement.
      Parameters:
      attributeName - The attribute name that is to be removed.
    • setAttribute

      public <T> void setAttribute(String attributeName, T attributeValue)
      Sets or updates an attribute.
      Parameters:
      attributeName - The attribute name that is to be set.
      attributeValue - The attribute value that is to be set.
    • getAttribute

      public Object getAttribute(String attributeName)
      Returns an attribute value that belongs to the attribute name.
      Parameters:
      attributeName - The attribute name that identifies the queried value.
      Returns:
      The queried attribute value.
    • hasAttribute

      public boolean hasAttribute(String attributeName)
      Returns whether an attribute exists.
      Parameters:
      attributeName - The attribute name to check for existence.
      Returns:
      boolean - Whether the attribute exists.
    • getAttributes

      public Map<String,Object> getAttributes()
      Returns all attribute name/value pairs in a JSON Object.
      Returns:
      A JSON Object (Map) that describes the attributes.
    • getAttributes

      public Map<String,Object> getAttributes(Snapshot snapshot)
      Returns all attribute name/value pairs in a JSON Object.
      Parameters:
      snapshot - Optional snapshot parameter.
      Returns:
      A JSON Object (Map) that describes the attributes.
    • write

      public void write(UpdateEncoder encoder)
      Transform the properties of this type to binary and write it to a BinaryEncoder.

      This is called when this Item is sent to a remote peer.

      Overrides:
      write in class YXmlFragment<T>
      Parameters:
      encoder - The encoder to write data to.
    • readYXmlElement

      public static YXmlElement readYXmlElement(UpdateDecoder decoder)
      Static method to read a YXmlElement from a decoder.
      Parameters:
      decoder - The decoder to read data from.
      Returns:
      A new YXmlElement instance.