Was this page helpful?

XDoc Class

    Table of contents
    1. 1. Members
      1. 1.1. Constructors
      2. 1.2. Fields
      3. 1.3. Properties
      4. 1.4. Methods
    Table of Contents
    public class XDoc
    Namespace: MindTouch.Xml
    Assembly: mindtouch.dream
    Type Hierarchy:
    Implements:
    • IEnumerable<XDoc>
    • IEnumerable
    • ICloneable
    A fluent interface-style Document Object Model for building, manipulating and ingesting Xml.

    Members

    Constructors

    Visibility Description
    Public XDoc(string tag) Creates a new XDoc instance with the given root tag.
    Public XDoc(string tag, string ns) Creates a new XDoc instance with the given root tag and the given implicit namespace.
    Public XDoc(string prefix, string tag, string ns) Creates a new XDoc instance with the given root tag and the given implicit namespace.
    Public XDoc(XmlDocument doc) Creates a new XDoc instance from an existing XmlDocument instance.
    Public XDoc(XDoc doc) Creates a new XDoc instance from an existing, non-empty XDoc instance.
    Protected XDoc(XmlDocument doc, XmlNode[] list, int index, XmlNode root, XmlNamespaceManager nsManager) Protected constructor for XDoc inheritors for creating a new instance with the state of the old instance.

    Fields

    Visibility Description
    Public Empty An Empty XDoc instance.
    Public XmlNameTable Xml Name Table shared by MindTouch.Xml.XDoc instances
    Public RFC_DATETIME_FORMAT RFC DateTime format used by MindTouch.Xml.XDoc
    Public NS_DSIG Namespace for XDoc digital signatures generated by XDoc.Sign(RSACryptoServiceProvider rsa).
    Public NS_XMLNS XmlNs namespace Uri.
    Public NS_XML Xml namespace Uri.

    Properties

    Visibility Description
    Public XhtmlDocType Returns the DOCTYPE string to mark an XML document as being XHTML 1.0 Strict compliant.
    Public this[int index] Returns the XDoc at the given index of the root XDoc or an empty instance if the index is out of bounds.
    Public this[string path] Returns a new rooted XDoc instance based on the supplied XPath. The selection starts at the first result.
    Public this[XmlNode node] Returns a new rooted XDoc instance representing the given XmlNode instance. The XmlNode instance must belong to the same XmlDocument instance as the XDoc instance.
    Public Doc Returns the XDoc instance representing the root element of XmlDocument instance.
    Public Root Returns the root XDoc instance, which is either the XmlDocument element or the original node returned by an XPath expression.
    Public ListLength Returns the number of items in the XDoc set.
    Public Contents Returns the textual contents of the XDoc instance, including text and inner XML nodes.
    Public Elements Returns an XDoc selection that includes all child elements.
    Public First Returns the first XDoc instance of the selection.
    Public Next Returns the next XDoc instance in the selection.
    Public IsEmpty Returns true if the XDoc instance is empty.
    Public IsText Returns true if the XDoc instance is an XmlText node.
    Public Name Returns the element or attribute name of the current XDoc instance.
    Public NamespaceURI Returns the element or attribute namespace URI of the current XDoc instance.
    Public Prefix Returns the element or attribute prefix of the current XDoc instance.
    Public QualifiedName Returns the element or attribute qualified name containing the namespace URI, prefix, and name of the current XDoc instance.
    Public AsXmlNode Return the XmlNode wrappter by the XDoc instance. Use with caution and only if absolutely nessecary.
    Public AsText Returns the value of all contained text nodes that are immediate children.
    Public AsInnerText Returns the value of all contained text nodes including nested ones.
    Public AsBool Returns the contents as boolean or null if contents could not be converted.
    Public AsByte Returns the contents as byte or null if contents could not be converted.
    Public AsSByte Returns the contents as signed byte or null if contents could not be converted.
    Public AsShort Returns the contents as short integer or null if contents could not be converted.
    Public AsUShort Returns the contents as unsigned short integer or null if contents could not be converted.
    Public AsInt Returns the contents as integer or null if contents could not be converted.
    Public AsUInt Returns the contents as unsigned integer or null if contents could not be converted.
    Public AsLong Returns the contents as long integer or null if contents could not be converted.
    Public AsULong Returns the contents as unsigned long integer or null if contents could not be converted.
    Public AsFloat Returns the contents as floating-point number or null if contents could not be converted.
    Public AsDouble Returns the contents as double floating-point number or null if contents could not be converted.
    Public AsDecimal Returns the contents as decimal number or null if contents could not be converted.
    Public AsDate Returns the contents as date/time or null if contents could not be converted.
    Public AsUri Returns the contents as uri or null if contents could not be converted.
    Public AsBytes Returns the contents as byte array or null if contents could not be converted.
    Public Parent Returns the parent XDoc instance or Empty if none exists.
    Public Language Gets/sets the value of the xml:lang attribute. Returns null if no such attribute exists. Set null to clear out the attribute.
    Public EmptyNamespaceUri Gets the namespace URI associated with the empty prefix

    Methods

    Visibility Description
    Public Value(Byte[] value) Adds a text node.
    Public Value(XUri value) Adds a text node.
    Public Value(object value) Adds a text node.
    Public ReplaceValue(bool value) Replaces the text node with a new text node.
    Public ReplaceValue(Byte[] value) Replaces the text node with a new text node.
    Public ReplaceValue(DateTime value) Replaces the text node with a new text node.
    Public ReplaceValue(object value) Replaces the text node with a new text node.
    Public ReplaceValue(XUri value) Replaces the text node with a new text node.
    Public ReplaceValue(string value) Replaces the text node with a new text node.
    Public InsertValueAt(string xpath, string value) Inserts a text or attribute node at the given XPath expression, creating elements as needed.
    Public CDataSection(string value) Adds a CDATA section.
    Public Comment(string value) Adds an XML comment node.
    Public ConditionalComment(string condition, XDoc contents) Adds a conditional XML comment node.
    Public End() Ends a child element. (e.g. </foo>)
    Public EndAll() Ends all child elements until the root XDoc instance is reached.
    Public Remove() Removes this XDoc instance from the containing document.
    Public RemoveAttr(string name) Removes an attriute.
    Public RemoveAll() Removes all XDoc instances in current selection.
    Public RemoveNodes() Removes all child nodes.
    Public Replace(XDoc doc) Replaces this XDoc instance with another one.
    Public ReplaceWithNodes(XDoc doc) Replaces this XDoc instance with the child nodes of another one.
    Public Replace(string value) Replaces this XDoc instance with a text node.
    Public Replace(DateTime value) Replaces this XDoc instance with a text node.
    Public Replace(Byte[] value) Replaces this XDoc instance with a text node.
    Public Replace(object value) Replaces this XDoc instance with a text node.
    Public Rename(string name) Change the name of the current element node.
    Public AddNodesInFront(XDoc doc) Prepend child nodes from another XDoc instance.
    Public AddNodesBefore(XDoc doc) Add child nodes from another XDoc instance before this one.
    Public AddNodesAfter(XDoc doc) Add child nodes from another XDoc instance after this one.
    Public AddNodes(XDoc doc) Adds child nodes from another XDoc instance.
    Public Add(XDoc doc) Adds an XDoc instance.
    Public AddAfter(string value) Adds a value after this XDoc instance.
    Public AddAfter(DateTime value) Adds a value after this XDoc instance.
    Public AddAfter(bool value) Adds a value after this XDoc instance.
    Public AddAfter(Byte[] value) Adds a value after this XDoc instance.
    Public AddAfter(XUri value) Adds a value after this XDoc instance.
    Public AddAfter(object value) Adds a value after this XDoc instance.
    Public AddAfter(XDoc doc) Adds an XDoc instance after this one.
    Public AddBefore(string value) Adds a value before this XDoc instance.
    Public AddBefore(DateTime value) Adds a value before this XDoc instance.
    Public AddBefore(bool value) Adds a value before this XDoc instance.
    Public AddBefore(Byte[] value) Adds a value before this XDoc instance.
    Public AddBefore(XUri value) Adds a value before this XDoc instance.
    Public AddBefore(object value) Adds a value before this XDoc instance.
    Public AddBefore(XDoc doc) Adds an XDoc instance before this one.
    Public AddAll(XDoc doc) Adds all XDoc instances in selection to this one.
    Public AddAllBefore(XDoc doc) Adds all XDoc instances in selection before this one.
    Public AddAllAfter(XDoc doc) Adds all XDoc instances in selection after this one.
    Public AddAll(IEnumerable<XDoc> collection) Adds all XDoc instances in collection to this one.
    Public GetContentsAsStrings() Returns the contents text for each XDoc instance in the selection.
    Public ForEach(Action<XDoc> call) Invokes the given method for each XDoc instance in the selection.
    Public Sort(Comparison<XDoc> comparer) Sorts the child elements using the given comparer.
    Public Filter(Predicate<XDoc> filter) Filters the child nodes using the given filter.
    Public UsePrefix(string prefix, string namespace) Adds prefix-namespace combination to the XML namespace manager.
    Public WithXslTransform(string href) Adds an XML stylesheet processing node.
    Public TransformAsText(XslCompiledTransform xslt) Converts this XDoc instance into a string using the given XSLT.
    Public TransformAsXml(XslCompiledTransform xslt) Converts this XDoc instance into a new XDoc instances using the givne XSLT.
    Public Save(string filename) Stores this XDoc instance into a file.
    Public ToXml() Creates a copy as an XmlDocument instance.
    Public ToXHtml() Renders the XDoc instance using XHTML entities.
    Public ToInnerXHtml() Renders the XDoc instance using XHTML entities, but omitting the outermost element.
    Public ToObject(XmlSerializer serializer) Converts the XDoc instance into an object instance using the given XmlSerializer instance.
    Public ToString() (Override) Renders the XDoc instance as an XML document using UTF-8 encoding.
    Public ToString(Encoding encoding) Renders the XDoc instance as an XML document using the given encoding.
    Public ToString(Encoding encoding, bool declaration) Renders the XDoc instance as an XML document using the given encoding.
    Public WriteTo(Stream stream) Renders the XDoc instance as an XML document using UTF-8 encoding.
    Public WriteTo(Stream stream, Encoding encoding) Renders the XDoc instance as an XML document using the given encoding.
    Public WriteTo(Stream stream, Encoding encoding, bool declaration) Renders the XDoc instance as an XML document using the given encoding.
    Public ToPrettyString() Renders the XDoc instance as an indented XML document using UTF-8 encoding.
    Public ToList() Converts the XDoc selection into a list of XDoc instances.
    Public ToBytes() Converts the XDoc instance into a byte array using UTF-8 encoding.
    Public ToBytes(Encoding encoding) Converts the XDoc instance into a byte array using the given encoding.
    Public ToKeyValuePairs() Converts the XDoc instance into an array of XPath expressions and text values.
    Public Equals(object other) (Override) Compares this XDoc instance to another one.
    Public GetHashCode() (Override) Computes the hashcode.
    Public Sign(RSACryptoServiceProvider rsa) Append XML digital signature to XDoc instance.
    Public HasValidSignature(RSACryptoServiceProvider rsa) Check if XDoc instance has an XML digital signature.
    Public Unsign() Remove XML digital signature from XDoc instance.
    Public ReverseList() Return a new selection in reverse order.
    Protected Initialize(XmlDocument doc, XmlNode[] list, int index, XmlNode root, XmlNamespaceManager nsManager) Protected initializer for XDoc inheritors for setting the state of an existing instance.
    Public RemoveAll(ICollection<XDoc> items) Removes a collection of XDoc instances from their respective containers.
    Public NewListXmlNode(XmlNodeList list) Converts an XmlNodeList instace into an XmlNode array.
    Public AtPath(string path, XmlNamespaceManager namespaces) Returns a new rooted XDoc instance based on the supplied XPath. The selection starts at the given index position.
    Public As() Returns XDoc contents converted into given type.
    Public HasName(string name) Check the element/attribute name of the current XDoc.
    Public HasName(string name, string namespaceUri) Check the element/attribute name of the current XDoc.
    Public Clone() Returns a deep clone of the XDoc instance starting at the root XDoc instance.
    Public MarkExclusive() Mark the current XDoc instance as exclusive. This will skip the next Clone() operation when it occurs.
    Public Copy() Returns a shallow copy of current XDoc instance.
    Public AtPosition(int index) Returns the XDoc instance at the index position in the selection.
    Public Attr(string tag, string value) Add an attribute to the XDoc instance.
    Public Attr(string tag, string namespaceUri, string value) Add an attribute to the XDoc instance.
    Public Attr(string tag, XUri value) Add an attribute to the XDoc instance.
    Public Attr(string tag, int value) Add an attribute to the XDoc instance.
    Public Attr(string tag, uint value) Add an attribute to the XDoc instance.
    Public Attr(string tag, long value) Add an attribute to the XDoc instance.
    Public Attr(string tag, ulong value) Add an attribute to the XDoc instance.
    Public Attr(string tag, float value) Add an attribute to the XDoc instance.
    Public Attr(string tag, double value) Add an attribute to the XDoc instance.
    Public Attr(string tag, DateTime value) Add an attribute to the XDoc instance.
    Public Attr(string tag, bool value) Add an attribute to the XDoc instance.
    Public Start(string tag) Starts a new child element. (e.g. <foo>)
    Public Start(string tag, string namespaceUri) Starts a new child element. (e.g. <foo>)
    Public Elem(string tag) Adds a complete child element.
    Public Elem(string tag, string value) Adds a complete child element.
    Public Elem(string tag, DateTime value) Adds a complete child element.
    Public Elem(string tag, Byte[] value) Adds a complete child element.
    Public Elem(string tag, XUri value) Adds a complete child element.
    Public Elem(string tag, object value) Adds a complete child.
    Public Value(string value) Adds a text node.
    Public Value(DateTime value) Adds a text node.
    Public Value(bool value) Adds a text node.
    Public GetType() (Inherited from Object)
    Protected MemberwiseClone() (Inherited from Object)
    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by