Class XmlWriter

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

public class XmlWriter extends Object
A class for creating XML files.
  • 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