Class XmlWriter


  • public class XmlWriter
    extends java.lang.Object
    A class for creating XML files.
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlWriter​(java.io.File file, java.lang.String dtdName)
      Constructs a new XML writer.
      XmlWriter​(java.io.OutputStream out, java.lang.String dtdName)
      Constructs a new XML writer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes this XML writer.
      void endElement​(java.lang.String name)
      Writes the specified end element.
      ghidra.util.xml.Counter getCounter()
      Returns the XML summary string.
      void startElement​(java.lang.String name)
      Writes the specified start element.
      void startElement​(java.lang.String name, XmlAttributes attrs)
      Writes the specified start element with the attributes.
      void writeDTD​(java.lang.String dtdName)
      Writes the specified DTD into the file.
      void writeElement​(java.lang.String name, XmlAttributes attrs)
      Writes the specified element with the attributes.
      void writeElement​(java.lang.String name, XmlAttributes attrs, java.lang.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 Detail

      • XmlWriter

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

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

      • 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​(java.lang.String dtdName)
                      throws java.io.IOException
        Writes the specified DTD into the file.
        Parameters:
        dtdName - the name of the DTD
        Throws:
        java.io.IOException - if an i/o error occurs
      • startElement

        public void startElement​(java.lang.String name)
        Writes the specified start element.
        Parameters:
        name - the name of the start element
      • startElement

        public void startElement​(java.lang.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​(java.lang.String name)
        Writes the specified end element.
        Parameters:
        name - the name of the end element
      • writeElement

        public void writeElement​(java.lang.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​(java.lang.String name,
                                 XmlAttributes attrs,
                                 java.lang.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