Class SimpleDocument
A simple implementation of the IXmlDocument interface.
Inherited Members
Namespace: Tangosol.Run.Xml
Assembly: Coherence.dll
Syntax
public class SimpleDocument : SimpleElement, IPortableObject, IXmlDocument, IXmlElement, IXmlValue, ICloneable
Remarks
Protected methods are provided to support inheriting classes.
Constructors
SimpleDocument()
Construct an empty SimpleDocument.
Declaration
public SimpleDocument()
SimpleDocument(string)
Construct a SimpleDocument.
Declaration
public SimpleDocument(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the root element. |
SimpleDocument(string, string, string)
Construct a SimpleDocument.
Declaration
public SimpleDocument(string name, string dtdUri, string dtdName)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the root element. |
string | dtdUri | The URI of the DTD (system identifier). |
string | dtdName | The name of the DTD (public identifier); may be |
Properties
DocumentComment
Get or set the XML comment that appears outside of the root element.
Declaration
public virtual string DocumentComment { get; set; }
Property Value
Type | Description |
---|---|
string | The document comment. |
Remarks
This differs from the Comment property of this object, which refers to the comment within the root element.
DtdName
Get or set the public identifier of the DTD (DOCTYPE) for the document.
Declaration
public virtual string DtdName { get; set; }
Property Value
Type | Description |
---|---|
string | The DTD public identifier. |
Examples
-//Sun Microsystems, Inc.//DTD Web Application 1.2//EN
DtdUri
Get or set the URI of the DTD (DOCTYPE) for the document.
Declaration
public virtual string DtdUri { get; set; }
Property Value
Type | Description |
---|---|
string | The document type URI. |
Remarks
This is referred to as the System Identifier by the XML specification.
Examples
http://java.sun.com/j2ee/dtds/web-app_2_2.dtd
Encoding
Get or set the encoding string for the XML document.
Declaration
public virtual string Encoding { get; set; }
Property Value
Type | Description |
---|---|
string | The encoding set for the document. |
Remarks
Documents that are parsed may or may not have the encoding string from the persistent form of the document.
Methods
CheckMutable()
Validates that the element is mutable, otherwise throws an InvalidOperationException.
Declaration
protected override void CheckMutable()
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException |
Equals(object)
Compare this XML document and all of its contained information with another XML document for equality.
Declaration
public override bool Equals(object o)
Parameters
Type | Name | Description |
---|---|---|
object | o | The object to compare to. |
Returns
Type | Description |
---|---|
bool | true if the documents are equal, false otherwise. |
Overrides
Remarks
Note that this overrides the contract of the Equals() method in the super interface IXmlElement.
GetHashCode()
Provide a hash value for this XML document and all of its contained information.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | The hash value for this XML value. |
Overrides
Remarks
Note that this overrides the contract of the GetHashCode() method in the super interface IXmlElement. The hash value is defined as a xor of the following:
- the GetHashCode() from the root element
- the GetHashCode() from the document type (uri and optional name)
ReadExternal(IPofReader)
Restore the contents of a user type instance by reading its state using the specified IPofReader object.
Declaration
public override void ReadExternal(IPofReader reader)
Parameters
Type | Name | Description |
---|---|---|
IPofReader | reader | The IPofReader from which to read the object's state. |
Overrides
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |
WriteExternal(IPofWriter)
Save the contents of a POF user type instance by writing its state using the specified IPofWriter object.
Declaration
public override void WriteExternal(IPofWriter writer)
Parameters
Type | Name | Description |
---|---|---|
IPofWriter | writer | The IPofWriter to which to write the object's state. |
Overrides
Exceptions
Type | Condition |
---|---|
IOException | If an I/O error occurs. |
WriteXml(TextWriter, bool)
Write the XML document, including an XML header and DOCTYPE if one exists.
Declaration
public override void WriteXml(TextWriter writer, bool isPretty)
Parameters
Type | Name | Description |
---|---|---|
TextWriter | writer | A TextWriter object to use to write to. |
bool | isPretty | true to specify that the output is intended to be as human readable as possible. |
Overrides
Remarks
This overrides the contract of the IXmlElement super interface.