Wrap an XmltextReader for simulating an event stream.
Each Read() operation goes either to the next element or next attribute within
the current element. TestExpression() is used to match the current event
to an xpath expression. The general pattern looks like this:
CopyC#
UnmarshallerContext context = new UnmarshallerContext(xmlReader); while (context.Read()) { if (context.TestExpresion("path/to/element")) { myObject.stringMember = stringUnmarshaller.GetInstance().Unmarshall(context); continue; } if (context.TestExpression("path/to/@attribute")) myObject.MyComplexTypeMember = MyComplexTypeUnmarshaller.GetInstance().Unmarshall(context); }
Declaration Syntax
C# |
public class XmlUnmarshallerContext : UnmarshallerContext
Members
All Members | Constructors | Methods | Properties | ||
Icon | Member | Description |
---|---|---|
XmlUnmarshallerContext(String, NameValueCollection) |
Wrap an XmlTextReader with state for event-based parsing of an XML stream.
| |
XmlUnmarshallerContext(Stream, NameValueCollection) |
Wrap an XmlTextReader with state for event-based parsing of an XML stream.
| |
CurrentDepth |
Returns the element depth of the parser's current position in the XML
document being parsed.
| |
CurrentPath |
The current XML path that is being unmarshalled.
| |
Equals(Object) | (Inherited from Object.) | |
GetHashCode()()()() | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType()()()() | Gets the type of the current instance. (Inherited from Object.) | |
Headers |
Gets the associated headers for the request.
| |
IsAttribute |
True if NodeType is Attribute.
| |
IsEndElement |
True if NodeType is EndElement.
| |
IsStartElement |
True if NodeType is Element.
| |
IsStartOfDocument |
True if the context is at the start of the document.
| |
NodeType |
The XmlNodeType of the current event. Will be one of
Element, EndElement, or Attribute during parsing,
and None at the start and end.
| |
Read()()()() |
Reads to the next node in the XML document, and updates the context
accordingly.
| |
ReadText()()()() |
Returns the text contents of the current element being parsed.
| |
Reset()()()() |
Rewinds the context to the start of the XML document being parsed.
| |
ResponseBody | (Inherited from UnmarshallerContext.) | |
TestExpression(String) |
Tests the specified expression against the current position in the XML
document | |
TestExpression(String, Int32) |
Tests the specified expression against the current position in the XML
document being parsed, and restricts the expression to matching at the
specified stack depth. | |
ToString()()()() | Returns a string that represents the current object. (Inherited from Object.) |
Inheritance Hierarchy
Object | ||
UnmarshallerContext | ||
XmlUnmarshallerContext |