org.apache.hadoop.hdfs.util

## Class XMLUtils.Stanza

- java.lang.Object
- - org.apache.hadoop.hdfs.util.XMLUtils.Stanza

- Enclosing class:
    org.apache.hadoop.hdfs.util.XMLUtils

      public static class XMLUtils.Stanza
      extends Object

  Represents a bag of key-value pairs encountered during parsing an XML file.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Stanza()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChild(String name, XMLUtils.Stanza child)` Add an entry to a stanza.
    `List<XMLUtils.Stanza>` | `getChildren(String name)` Pull an entry from a stanza.
    `String` | `getValue()`
    `String` | `getValue(String name)` Pull a string entry from a stanza.
    `String` | `getValueOrNull(String name)` Pull a string entry from a stanza, or null.
    `boolean` | `hasChildren(String name)` Discover if a stanza has a given entry.
    `void` | `setValue(String value)`
    `String` | `toString()` Convert a stanza to a human-readable string.

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

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

- - ### Constructor Detail

    - #### Stanza

          public Stanza()

  - ### Method Detail

    - #### setValue

          public void setValue(String value)

    - #### getValue

          public String getValue()

    - #### hasChildren

          public boolean hasChildren(String name)

      Discover if a stanza has a given entry.
      Parameters:
        `name` - entry to look for
      Returns:
        true if the entry was found

    - #### getChildren

          public List<XMLUtils.Stanza> getChildren(String name)
                                            throws XMLUtils.InvalidXmlException

      Pull an entry from a stanza.
      Parameters:
        `name` - entry to look for
      Returns:
        the entry
      Throws:
        `XMLUtils.InvalidXmlException`

    - #### getValue

          public String getValue(String name)
                          throws XMLUtils.InvalidXmlException

      Pull a string entry from a stanza.
      Parameters:
        `name` - entry to look for
      Returns:
        the entry
      Throws:
        `XMLUtils.InvalidXmlException`

    - #### getValueOrNull

          public String getValueOrNull(String name)
                                throws XMLUtils.InvalidXmlException

      Pull a string entry from a stanza, or null.
      Parameters:
        `name` - entry to look for
      Returns:
        the entry, or null if it was not found.
      Throws:
        `XMLUtils.InvalidXmlException`

    - #### addChild

          public void addChild(String name,
                               XMLUtils.Stanza child)

      Add an entry to a stanza.
      Parameters:
        `name` - name of the entry to add
        `child` - the entry to add

    - #### toString

          public String toString()

      Convert a stanza to a human-readable string.
      Overrides:
        `toString` in class `Object`

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.