Interface Element

    • Method Detail

      • setTagName

        void setTagName​(String value)
        Sets the value of the 'Tag Name' attribute.
        Parameters:
        value - the new value of the 'Tag Name' attribute.
        See Also:
        getTagName()
      • getAttribute

        String getAttribute​(String name)
        Returns the value of the attribute matching the specified name.
        Parameters:
        name - the attribute name.
        Returns:
        the value of the attribute matching the specified name, null if none.
      • getAttribute

        String getAttribute​(String name,
                            String defaultValue)
        Returns the value of the attribute matching the specified name, using a default value if not found.
        Parameters:
        name - the attribute name.
        defaultValue - the default value to return if the attribute is not defined.
        Returns:
        the value of the attribute matching the specified name, the specified default value if none.
      • getAttribute

        boolean getAttribute​(String name,
                             boolean defaultValue)
        Returns the boolean value of the attribute matching the specified name, using a default value if not found.
        Parameters:
        name - the attribute name.
        defaultValue - the default value to return if the attribute is not defined.
        Returns:
        the value of the attribute matching the specified name, the specified default value if none.
      • setAttribute

        void setAttribute​(String name,
                          String value)
        Update the value of the attribute matching the specified name. An attribute is added if one does not yet exist.
        Parameters:
        name - the attribute name.
        value - the attribute value.
      • setAttributes

        void setAttributes​(Map<String,​String> nameAndValues)
        Update the values of the attributes matching the specified names. An attribute is added if one does not yet exist.
        Parameters:
        nameAndValues - pairs of attribute name/value.
      • getElement

        Element getElement​(String name)
        Returns the first direct child element whose tag matches the specified name.
        Parameters:
        name - the name of the element.
        Returns:
        the first direct child element whose tag matches the specified name, null if none.
      • getElements

        MDWList<Element> getElements​(String name)
        Returns the list of direct child elements whose tag matches the specified name.
        Parameters:
        name - the name of the element.
        Returns:
        the list of direct child elements whose tag matches the specified name.
      • createElement

        Element createElement​(String name)
        Creates a new child element with the specified tag name.
        Parameters:
        name - the element tag name.
        Returns:
        the created element.
      • createElement

        Element createElement​(String name,
                              Map<String,​String> nameAndValues)
        Creates a new child element with the specified tag name and attributes.
        Parameters:
        name - the element tag name.
        nameAndValues - pairs of attribute name/value to assign on the created element.
        Returns:
        the created element.
        See Also:
        setAttributes(Map)
      • createTextElement

        Element createTextElement​(String name,
                                  String text)
        Creates a new child element with the specified tag name and text content.
        Parameters:
        name - the element tag name.
        text - the text content to assign.
        Returns:
        the created element, which has a Text content.
        See Also:
        createText(String)
      • createComment

        Comment createComment​(String comment)
        Creates a comment, owned by this element.
        Parameters:
        comment - the comment text.
        Returns:
        the created comment.
      • createText

        Text createText​(String text)
        Creates a text content, owned by this element.
        Parameters:
        text - the text content.
        Returns:
        the created text element.