madkit.util

## Class XMLUtilities

- java.lang.Object
- - madkit.util.XMLUtilities

-     public class XMLUtilities
      extends java.lang.Object

  XML shortcuts as static methods
  Since:
    MadKit 5.0.2
  Version:
    0.9
  Author:
    Fabien Michel

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `AGENT` The name of a node containing a launch configuration: "Agent"
    `static java.lang.String` | `ATTRIBUTES` The name of the child node of `AGENT` containing attributes that have to be set on the agent: "Attributes"
    `static java.lang.String` | `BUCKET_MODE` Valid attribute of an agent node determining if the launch should be done using the bucket mode.
    `static java.lang.String` | `BUCKET_MODE_ROLE` The name of the child node of `AGENT` containing the roles which should be set when using the bucket mode.
    `static java.lang.String` | `CLASS` Valid attribute of an agent node determining the agent class to launch, value is "class"
    `static java.lang.String` | `GUI` Valid attribute of an agent node : "GUI" in a MDK xml config file
    `static java.lang.String` | `LOG_LEVEL` Valid attribute of an agent node determining the agent log level to be set, the name of the attribute is "logLevel"
    `static java.lang.String` | `MADKIT_PROPERTIES` The name of a node containing properties for MaDKit : "MadkitProperties"
    `static java.lang.String` | `MDK` Name of the root node of MaDKit xml fles, value is "MDK"
    `static java.lang.String` | `NB_OF_INSTANCES` Valid attribute of an agent node : "nbOfInstances" in a MDK xml config file

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLUtilities()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static org.w3c.dom.Document` | `getDOM(java.lang.String xmlFile)` return the DOM from an xml file.
    `static java.lang.String` | `nodeToString(org.w3c.dom.Node node)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### NB_OF_INSTANCES

          public static final java.lang.String NB_OF_INSTANCES

      Valid attribute of an agent node : "nbOfInstances" in a MDK xml config file
      See Also:
        Constant Field Values

    - #### GUI

          public static final java.lang.String GUI

      Valid attribute of an agent node : "GUI" in a MDK xml config file
      See Also:
        Constant Field Values

    - #### ATTRIBUTES

          public static final java.lang.String ATTRIBUTES

      The name of the child node of `AGENT` containing attributes that have to be set on the agent: "Attributes"
      See Also:
        Constant Field Values

    - #### CLASS

          public static final java.lang.String CLASS

      Valid attribute of an agent node determining the agent class to launch, value is "class"
      See Also:
        Constant Field Values

    - #### AGENT

          public static final java.lang.String AGENT

      The name of a node containing a launch configuration: "Agent"
      See Also:
        Constant Field Values

    - #### MADKIT_PROPERTIES

          public static final java.lang.String MADKIT_PROPERTIES

      The name of a node containing properties for MaDKit : "MadkitProperties"
      See Also:
        `Madkit.Option`, `Madkit.LevelOption`, `Madkit.BooleanOption`, Constant Field Values

    - #### LOG_LEVEL

          public static final java.lang.String LOG_LEVEL

      Valid attribute of an agent node determining the agent log level to be set, the name of the attribute is "logLevel"
      See Also:
        Constant Field Values

    - #### MDK

          public static final java.lang.String MDK

      Name of the root node of MaDKit xml fles, value is "MDK"
      See Also:
        Constant Field Values

    - #### BUCKET_MODE

          public static final java.lang.String BUCKET_MODE

      Valid attribute of an agent node determining if the launch should be done using the bucket mode. For instance :

              	<Agent class="madkit.xml.XMLBenchTestAgent" nbOfInstances="100000" bucketMode="true">
           		<Attributes speed="3" i="5" s="blabla"/>
           </Agent>

           If the BUCKET_MODE_ROLE tag is used, bucketMode is automatically
           added and set to true.

      see `AbstractAgent.launchAgentBucket(java.util.List, int, String...)`
      See Also:
        Constant Field Values

    - #### BUCKET_MODE_ROLE

          public static final java.lang.String BUCKET_MODE_ROLE

      The name of the child node of `AGENT` containing the roles which should be set when using the bucket mode. e.g.

              	<Agent class="madkit.xml.XMLBenchTestAgent" nbOfInstances="100000" bucketMode="true">

           		<Attributes speed="3" i="5" s="blabla"/>

           		<bucketModeRole community="Tcommunity" group="Tgroup" role="Trole"/>
           </Agent>

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### XMLUtilities

          public XMLUtilities()

  - ### Method Detail

    - #### getDOM

          public static org.w3c.dom.Document getDOM(java.lang.String xmlFile)
                                             throws org.xml.sax.SAXException,
                                                    java.io.IOException,
                                                    javax.xml.parsers.ParserConfigurationException

      return the DOM from an xml file.
      Parameters:
        `xmlFile` -
      Returns:
        the DOM from an xml file or `null` if not found or invalid
      Throws:
        `org.xml.sax.SAXException`
        `java.io.IOException`
        `javax.xml.parsers.ParserConfigurationException`

    - #### nodeToString

          public static java.lang.String nodeToString(org.w3c.dom.Node node)

Fabien Michel, Olivier Gutknecht, Jacques Ferber - September 9 2019