Class XmlNode

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected XmlNode​(XmlElement parent, org.w3c.dom.Node node)
      Creates a new XML comment fragment artifact.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(IArtifactVisitor visitor)
      Visits this artifact (and dependent on the visitor also contained artifacts and fragments) using the given visitor.
      void artifactChanged​(java.lang.Object cause)
      Is called when the artifact was changed, e.g., to trigger a reanalysis of substructures.
      protected void checkRoot()
      Checks if this object represents the Root element.
      protected void checkValidity()
      Checks the validity of this object.
      void delete()
      Deletes this artifact.
      (package private) abstract void deleteChild​(XmlNode child)
      Removes a child from this Element.
      Binary getBinary()
      Returns the binary representation of the contents of this artifact for manipulation.
      Text getCdata()
      Returns the cdata of the element.
      protected Text getCdataDirect()
      Returns the text object for cdata regardless whether it is null.
      (package private) XmlNode getChild​(int index)
      Returns the child at the given index.
      (package private) int getChildCount()
      Returns the number of children.
      (package private) XmlFileArtifact getFile()
      Returns the parent XML file artifact.
      (package private) java.lang.String getNameSafe()
      Returns the name of this attribute without potential exception.
      protected org.w3c.dom.Node getNode()
      Returns the represented XML node.
      XmlElement getParent()
      Returns the parent of this fragment.
      Text getText()
      Returns the textual representation of the contents of this artifact for manipulation.
      protected Text getTextDirect()
      Returns the text object even if it is null.
      protected void notifyChange()
      Notifies the containing file about a change through this object.
      (package private) void notifyChange​(java.lang.Object cause)
      Notifies the containing file about a change.
      void setCdata​(java.lang.String cdata)
      Sets the cdata of the element.
      protected void setNode​(org.w3c.dom.Node node)
      Changes the representing XML node.
      (package private) void sortAttributes​(org.xml.sax.Attributes att)
      Sorts the attribute sequence of this element according to the given SAX attribute set.
      (package private) void synchronizeAttributeSequence()
      Synchronizes the attribute sequence.
      void update()
      Called if the underlying real artifact may have been updated, e.g., by overriding it by another file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface net.ssehub.easy.instantiation.core.model.artifactModel.IArtifact

        getName, rename
    • Field Detail

      • cdata

        private Text cdata
      • text

        private Text text
      • node

        private org.w3c.dom.Node node
    • Constructor Detail

      • XmlNode

        protected XmlNode​(XmlElement parent,
                          org.w3c.dom.Node node)
        Creates a new XML comment fragment artifact.
        Parameters:
        parent - the parent artifact
        node - the node that is represented by this XmlElement
    • Method Detail

      • getParent

        public XmlElement getParent()
        Returns the parent of this fragment.
        Returns:
        the parent of this fragment
      • getNode

        protected org.w3c.dom.Node getNode()
        Returns the represented XML node.
        Returns:
        the node (may be null)
      • setNode

        protected void setNode​(org.w3c.dom.Node node)
        Changes the representing XML node.
        Parameters:
        node - the new representing XML node
      • checkValidity

        protected void checkValidity()
                              throws VilException
        Checks the validity of this object.
        Throws:
        VilException - in case that this object is invalid
      • checkRoot

        protected void checkRoot()
                          throws VilException
        Checks if this object represents the Root element. Root elements can not be changed.
        Throws:
        VilException - in case that this object is the root element.
      • deleteChild

        abstract void deleteChild​(XmlNode child)
        Removes a child from this Element.
        Parameters:
        child - the child that is to be removed.
      • delete

        public void delete()
                    throws VilException
        Description copied from interface: IArtifact
        Deletes this artifact.
        Specified by:
        delete in interface IArtifact
        Throws:
        VilException - in case of serious problems so that this operation cannot continue
      • setCdata

        public void setCdata​(java.lang.String cdata)
                      throws VilException
        Sets the cdata of the element.
        Parameters:
        cdata - String of the cdata to store
        Throws:
        VilException - in case that reading fails for some reason
      • getBinary

        public Binary getBinary()
                         throws VilException
        Description copied from interface: IArtifact
        Returns the binary representation of the contents of this artifact for manipulation.
        Specified by:
        getBinary in interface IArtifact
        Returns:
        the binary representation of the contents
        Throws:
        VilException - in case of obtaining the representation causes serious problems
      • getText

        public Text getText()
                     throws VilException
        Description copied from interface: IArtifact
        Returns the textual representation of the contents of this artifact for manipulation. In case of binary artifacts, the returned object may be empty.
        Specified by:
        getText in interface IArtifact
        Returns:
        the textual representation of the contents
        Throws:
        VilException - in case of obtaining the representation causes serious problems
      • getTextDirect

        protected Text getTextDirect()
        Returns the text object even if it is null.
        Returns:
        the text object
      • getCdata

        public Text getCdata()
                      throws VilException
        Returns the cdata of the element.
        Returns:
        the cdata information of this element. Null if there is no cdata
        Throws:
        VilException - if element is invalid.
      • getCdataDirect

        protected Text getCdataDirect()
        Returns the text object for cdata regardless whether it is null.
        Returns:
        the text object for cdata, may be null
      • getFile

        XmlFileArtifact getFile()
        Returns the parent XML file artifact.
        Returns:
        the parent file artifact, may be null
      • notifyChange

        protected void notifyChange()
        Notifies the containing file about a change through this object.
      • notifyChange

        void notifyChange​(java.lang.Object cause)
        Notifies the containing file about a change.
        Parameters:
        cause - the causing object
      • artifactChanged

        public void artifactChanged​(java.lang.Object cause)
                             throws VilException
        Description copied from interface: IArtifactChangedListener
        Is called when the artifact was changed, e.g., to trigger a reanalysis of substructures.
        Specified by:
        artifactChanged in interface IArtifactChangedListener
        Parameters:
        cause - the cause for the change, e.g., an artifact representation
        Throws:
        VilException - in case that the required operations fail for some reason
      • accept

        public void accept​(IArtifactVisitor visitor)
        Description copied from interface: IArtifact
        Visits this artifact (and dependent on the visitor also contained artifacts and fragments) using the given visitor.
        Specified by:
        accept in interface IArtifact
        Parameters:
        visitor - the visitor used for visiting this artifact
      • update

        public void update()
                    throws VilException
        Description copied from interface: IArtifact
        Called if the underlying real artifact may have been updated, e.g., by overriding it by another file.
        Specified by:
        update in interface IArtifact
        Throws:
        VilException - in case that updating fails
      • getChildCount

        int getChildCount()
        Returns the number of children.
        Returns:
        the number of children
      • getChild

        XmlNode getChild​(int index)
        Returns the child at the given index.
        Parameters:
        index - the 0-based index of the child to return
        Returns:
        the child
        Throws:
        java.lang.IndexOutOfBoundsException - if index < 0 || index >=getChildCount()
      • getNameSafe

        java.lang.String getNameSafe()
        Returns the name of this attribute without potential exception.
        Returns:
        the name
      • synchronizeAttributeSequence

        void synchronizeAttributeSequence()
        Synchronizes the attribute sequence.
      • sortAttributes

        void sortAttributes​(org.xml.sax.Attributes att)
        Sorts the attribute sequence of this element according to the given SAX attribute set.
        Parameters:
        att - the SAX attributes