NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

XmlNode.Xml

The XML text representation of this node.

[Visual Basic]
Public Property Xml As String
[C#]
public string Xml {get; set;}
[C++]
public: __property String* get_Xml();
public: __property void set_Xml(String*);
[JScript]
public function get Xml() : String;
public function set Xml(String);

Remarks

The following example:

XmlDocument doc = new XmlDocument("quote");
  doc.Root["ticker"].Text = "EFOO";
  doc.Root["price"].Attributes["currency"] = "USD";
  doc.Root["price"].Text = "37.75";
  Console.WriteLine(doc.Root["ticker"].Xml);
  Console.WriteLine(doc.Root["price"].Xml);
  Console.WriteLine(doc.Xml);

produces the output:

<ticker>EFOO</ticker>
  <price currency="USD">37.75</price>
  <quote><ticker>EFOO</ticker><price currency="USD">37.75</price></quote>

When assigning to the Xml property, the text string must form an XML node of the same type as this node. For example, this is permitted:

XmlDocument doc = new XmlDocument("quote");
  doc.Root["ticker"].Xml = "<ticker>EBAR</ticker>";

but changing the last line of the example above to:

doc.Root["ticker"].Xml = "this is a test";

causes an exception to be thrown since the string being assigned forms an XmlText node and not an XmlElement.

When assigning to the Xml property of an XmlElement, the element's identifier, attributes, and child list are replaced by the values given in the XML string. Note in particular that such an assignment may cause the name of the element to change.

See Also

XmlNode Class | XmlNode Members | System.Xml Namespace