Interface XmlDocument

All Superinterfaces:
Serializable, XmlElement, XmlValue
All Known Implementing Classes:
SimpleDocument

public interface XmlDocument extends XmlElement
An interface for XML document access. The XmlDocumnet interface represents the document as both the root element (through the underlying XmlElement interface) and the properties specific to a document, such as DOCTYPE.
Author:
cp 2001.07.11
  • Method Details

    • getDtdUri

      String getDtdUri()
      Get the URI of the DTD (DOCTYPE) for the document. This is referred to as the System Identifier by the XML specification. For example: http://java.sun.com/j2ee/dtds/web-app_2_2.dtd
      Returns:
      the document type URI
    • setDtdUri

      void setDtdUri(String sUri)
      Set the URI of the DTD (DOCTYPE) for the document. This is referred to as the System Identifier by the XML specification.
      Parameters:
      sUri - the document type URI
    • getDtdName

      String getDtdName()
      Get the public identifier of the DTD (DOCTYPE) for the document. For example: -//Sun Microsystems, Inc.//DTD Web Application 1.2//EN
      Returns:
      the DTD public identifier
    • setDtdName

      void setDtdName(String sName)
      Set the public identifier of the DTD (DOCTYPE) for the document.
      Parameters:
      sName - the DTD public identifier
    • getEncoding

      String getEncoding()
      Get the encoding string for the XML document. Documents that are parsed may or may not have the encoding string from the persistent form of the document.
      Returns:
      the encoding set for the document
    • setEncoding

      void setEncoding(String sEncoding)
      Set the encoding string for the XML document.
      Parameters:
      sEncoding - the encoding that the document will use
    • getDocumentComment

      String getDocumentComment()
      Get the XML comment that appears outside of the root element. This differs from the Comment property of this object, which refers to the comment within the root element.
      Returns:
      the document comment
    • setDocumentComment

      void setDocumentComment(String sComment)
      Set the XML comment that appears outside of the root element. This differs from the Comment property of this object, which refers to the comment within the root element.
      Parameters:
      sComment - the document comment
    • writeXml

      void writeXml(PrintWriter out, boolean fPretty)
      Write the XML document, including an XML header and DOCTYPE if one exists. This overrides the contract of the XmlElement super interface.
      Specified by:
      writeXml in interface XmlElement
      Parameters:
      out - a PrintWriter object to use to write to
      fPretty - true to specify that the output is intended to be as human readable as possible
    • toString

      String toString()
      Format the XML document and all its contained information into a String in a display format. Note that this overrides the contract of the toString method in the super interface XmlElement.
      Specified by:
      toString in interface XmlElement
      Specified by:
      toString in interface XmlValue
      Overrides:
      toString in class Object
      Returns:
      a String representation of the XML document
    • hashCode

      int hashCode()
      Provide a hash value for this XML document and all of its contained information. Note that this overrides the contract of the hashCode method in the super interface XmlElement. The hash value is defined as a xor of the following:
      • the hashCode from the root element
      • the hashCode from the document type
      Specified by:
      hashCode in interface XmlElement
      Specified by:
      hashCode in interface XmlValue
      Overrides:
      hashCode in class Object
      Returns:
      the hash value for this XML document
    • equals

      boolean equals(Object o)
      Compare this XML document and all of its contained information with another XML document for equality. Note that this overrides the contract of the equals method in the super interface XmlElement.
      Specified by:
      equals in interface XmlElement
      Specified by:
      equals in interface XmlValue
      Overrides:
      equals in class Object
      Returns:
      true if the documents are equal, false otherwise
    • clone

      Object clone()
      Creates and returns a copy of this XmlDocument.
      Specified by:
      clone in interface XmlElement
      Specified by:
      clone in interface XmlValue
      Returns:
      a clone of this instance.