Package ghidra.util.xml

# Class XmlWriter

java.lang.Object
ghidra.util.xml.XmlWriter

public class XmlWriter extends Object
A class for creating XML files.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `XmlWriter(File file, String dtdName)`
  Constructs a new XML writer.
  `XmlWriter(OutputStream out, String dtdName)`
  Constructs a new XML writer.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Closes this XML writer.
  `void`
  `endElement(String name)`
  Writes the specified end element.
  `ghidra.util.xml.Counter`
  `getCounter()`
  Returns the XML summary string.
  `void`
  `startElement(String name)`
  Writes the specified start element.
  `void`
  `startElement(String name, XmlAttributes attrs)`
  Writes the specified start element with the attributes.
  `void`
  `writeDTD(String dtdName)`
  Writes the specified DTD into the file.
  `void`
  `writeElement(String name, XmlAttributes attrs)`
  Writes the specified element with the attributes.
  `void`
  `writeElement(String name, XmlAttributes attrs, String text)`
  Writes the specified element with the attributes and text.

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

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

- ## Constructor Details

  - ### XmlWriter

    public XmlWriter(File file, String dtdName) throws IOException
    Constructs a new XML writer.
    Parameters:
      `file` - the name of the output XML file
      `dtdName` - the name of the DTD
    Throws:
      `IOException` - if an i/o error occurs

  - ### XmlWriter

    public XmlWriter(OutputStream out, String dtdName) throws IOException
    Constructs a new XML writer.
    Parameters:
      `out` - the output stream
      `dtdName` - the name of the DTD
    Throws:
      `IOException` - if an i/o error occurs

- ## Method Details

  - ### getCounter

    public ghidra.util.xml.Counter getCounter()
    Returns the XML summary string.
    Returns:
      the XML summary string

  - ### close

    public void close()
    Closes this XML writer.

  - ### writeDTD

    public void writeDTD(String dtdName) throws IOException
    Writes the specified DTD into the file.
    Parameters:
      `dtdName` - the name of the DTD
    Throws:
      `IOException` - if an i/o error occurs

  - ### startElement

    public void startElement(String name)
    Writes the specified start element.
    Parameters:
      `name` - the name of the start element

  - ### startElement

    public void startElement(String name, XmlAttributes attrs)
    Writes the specified start element with the attributes.
    Parameters:
      `name` - the name of the start element
      `attrs` - the attributes of the start element

  - ### endElement

    public void endElement(String name)
    Writes the specified end element.
    Parameters:
      `name` - the name of the end element

  - ### writeElement

    public void writeElement(String name, XmlAttributes attrs)
    Writes the specified element with the attributes.
    Parameters:
      `name` - the name of the start element
      `attrs` - the attributes of the start element

  - ### writeElement

    public void writeElement(String name, XmlAttributes attrs, String text)
    Writes the specified element with the attributes and text.
    Parameters:
      `name` - the name of the element
      `attrs` - the attributes of the element
      `text` - the text of the element