Class DomXmlAttribute


  • public class DomXmlAttribute
    extends SpinXmlAttribute
    Wrapper of a xml dom attribute.
    Author:
    Sebastian Menski
    • Constructor Summary

      Constructors 
      Constructor Description
      DomXmlAttribute​(org.w3c.dom.Attr attributeNode, DomXmlDataFormat dataFormat)
      Create a new wrapper.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getDataFormatName()
      Provides the name of the dataformat used by this spin.
      boolean hasNamespace​(java.lang.String namespace)
      Checks if the node has a given namespace.
      boolean hasPrefix​(java.lang.String prefix)
      Checks if the node has a given prefix.
      <C> C mapTo​(java.lang.Class<C> javaClass)
      Maps XML into specific class
      <C> C mapTo​(java.lang.String javaClass)
      Maps Xml into specific class
      java.lang.String name()
      Returns the local name of the node without namespace or prefix.
      java.lang.String namespace()
      Returns the namespace uri of the node and not the prefix.
      java.lang.String prefix()
      Returns the prefix of the node and not the namespace uri.
      SpinXmlElement remove()
      Removes the attribute.
      java.lang.String toString()
      Returns the wrapped XML attribute value as string representation.
      org.w3c.dom.Attr unwrap()
      Return the wrapped object.
      java.lang.String value()
      Returns the value of the attribute as String.
      SpinXmlAttribute value​(java.lang.String value)
      Sets the value of the attribute.
      void writeToWriter​(java.io.Writer writer)
      Writes the wrapped XML attribute value to an existing writer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • attributeNode

        protected final org.w3c.dom.Attr attributeNode
    • Constructor Detail

      • DomXmlAttribute

        public DomXmlAttribute​(org.w3c.dom.Attr attributeNode,
                               DomXmlDataFormat dataFormat)
        Create a new wrapper.
        Parameters:
        attributeNode - the dom xml attribute to wrap
        dataFormat - the xml dom data format
    • Method Detail

      • getDataFormatName

        public java.lang.String getDataFormatName()
        Description copied from class: Spin
        Provides the name of the dataformat used by this spin.
        Specified by:
        getDataFormatName in class Spin<SpinXmlAttribute>
        Returns:
        the name of the dataformat used by this Spin.
      • unwrap

        public org.w3c.dom.Attr unwrap()
        Description copied from class: Spin
        Return the wrapped object. The return type of this method depends on the concrete data format.
        Specified by:
        unwrap in class Spin<SpinXmlAttribute>
        Returns:
        the object wrapped by this wrapper.
      • name

        public java.lang.String name()
        Description copied from class: SpinXmlNode
        Returns the local name of the node without namespace or prefix.
        Specified by:
        name in class SpinXmlNode<SpinXmlAttribute>
        Returns:
        the name of the node
      • namespace

        public java.lang.String namespace()
        Description copied from class: SpinXmlNode
        Returns the namespace uri of the node and not the prefix.
        Specified by:
        namespace in class SpinXmlNode<SpinXmlAttribute>
        Returns:
        the namespace of the node
      • prefix

        public java.lang.String prefix()
        Description copied from class: SpinXmlNode
        Returns the prefix of the node and not the namespace uri.
        Specified by:
        prefix in class SpinXmlNode<SpinXmlAttribute>
        Returns:
        the prefix of the node
      • hasPrefix

        public boolean hasPrefix​(java.lang.String prefix)
        Description copied from class: SpinXmlNode
        Checks if the node has a given prefix.
        Specified by:
        hasPrefix in class SpinXmlNode<SpinXmlAttribute>
        Parameters:
        prefix - the prefix to check
        Returns:
        true if the name has the same prefix
      • hasNamespace

        public boolean hasNamespace​(java.lang.String namespace)
        Description copied from class: SpinXmlNode
        Checks if the node has a given namespace.
        Specified by:
        hasNamespace in class SpinXmlNode<SpinXmlAttribute>
        Parameters:
        namespace - the namespace to check
        Returns:
        true if the node has the same namespace
      • value

        public java.lang.String value()
        Description copied from class: SpinXmlAttribute
        Returns the value of the attribute as String.
        Specified by:
        value in class SpinXmlAttribute
        Returns:
        the string value of the attribute
      • value

        public SpinXmlAttribute value​(java.lang.String value)
        Description copied from class: SpinXmlAttribute
        Sets the value of the attribute.
        Specified by:
        value in class SpinXmlAttribute
        Parameters:
        value - the value to set
        Returns:
        the wrapped xml dom attribute
      • toString

        public java.lang.String toString()
        Description copied from class: SpinXmlAttribute
        Returns the wrapped XML attribute value as string representation.
        Specified by:
        toString in class SpinXmlAttribute
        Returns:
        the string representation
      • writeToWriter

        public void writeToWriter​(java.io.Writer writer)
        Description copied from class: SpinXmlAttribute
        Writes the wrapped XML attribute value to an existing writer.
        Specified by:
        writeToWriter in class SpinXmlAttribute
        Parameters:
        writer - the writer to write to
      • mapTo

        public <C> C mapTo​(java.lang.Class<C> javaClass)
        Description copied from class: SpinXmlNode
        Maps XML into specific class
        Specified by:
        mapTo in class SpinXmlNode<SpinXmlAttribute>
        Parameters:
        javaClass - Class to which the Xml should be mapped
        Returns:
        mapped Class
      • mapTo

        public <C> C mapTo​(java.lang.String javaClass)
        Description copied from class: SpinXmlNode
        Maps Xml into specific class
        Specified by:
        mapTo in class SpinXmlNode<SpinXmlAttribute>
        Parameters:
        javaClass - canonical name of the class
        Returns:
        mapped class