Class XMLUtils

java.lang.Object
com.jme3.export.xml.XMLUtils

public class XMLUtils extends Object
Utilities for reading and writing XML files.
  • Field Details

    • PREFIX

      public static final String PREFIX
      Prefix for every jme xml attribute for format versions 3 and up.

      This prefix should be appended at the beginning of every xml attribute name. For format versions 3 and up, every name to access an attribute must append this prefix first.

      See Also:
  • Method Details

    • setAttribute

      public static void setAttribute(Element element, String name, String attribute)
      Sets the attribute in the element under the name.

      Automatically appends PREFIX to the beginning of the name before assigning the attribute to the element.

      Parameters:
      element - element to set the attribute in
      name - name of the attribute (without prefix)
      attribute - attribute to save
    • getAttribute

      public static String getAttribute(int version, Element element, String name)
      Fetches the named attribute from the element.

      Automatically appends PREFIX to the beginning of the name before looking up the attribute for format versions 3 and up.

      Parameters:
      version - format version of the xml
      element - XML element to get the attribute from
      name - name of the attribute (without prefix)
      Returns:
      named attribute
    • hasAttribute

      public static boolean hasAttribute(int version, Element element, String name)
      Tests if the element contains the named attribute.

      Automatically appends PREFIX to the beginning of the name before looking up the attribute for format versions 3 and up.

      Parameters:
      version - format version of the xml
      element - element to test
      name - name of the attribute (without prefix)
      Returns:
      true if the element has the named attribute