Table of Contents

Class XmlUnmarshallerContext

Namespace
Amazon.Runtime.Internal.Transform
Assembly
AWSSDK.Core.dll

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:

UnmarshallerContext context = new UnmarshallerContext(...);
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);
}
public class XmlUnmarshallerContext : UnmarshallerContext, IDisposable
Inheritance
XmlUnmarshallerContext
Implements
Derived
Inherited Members

Constructors

XmlUnmarshallerContext(Stream, bool, IWebResponseData, bool)

Wrap an XmlTextReader with state for event-based parsing of an XML stream.

public XmlUnmarshallerContext(Stream responseStream, bool maintainResponseBody, IWebResponseData responseData, bool isException = false)

Parameters

responseStream Stream

Stream with the XML from a service response.

maintainResponseBody bool

If set to true, maintains a copy of the complete response body constraint to log response size as the stream is being read.

responseData IWebResponseData

Response data coming back from the request

isException bool

If set to true, maintains a copy of the complete response body as the stream is being read.

XmlUnmarshallerContext(Stream, bool, IWebResponseData, bool, IRequestContext)

Wrap an XmlTextReader with state for event-based parsing of an XML stream.

public XmlUnmarshallerContext(Stream responseStream, bool maintainResponseBody, IWebResponseData responseData, bool isException, IRequestContext requestContext)

Parameters

responseStream Stream

Stream with the XML from a service response.

maintainResponseBody bool

If set to true, maintains a copy of the complete response body constraint to log response size as the stream is being read.

responseData IWebResponseData

Response data coming back from the request

isException bool

If set to true, maintains a copy of the complete response body as the stream is being read.

requestContext IRequestContext

Context for the request that produced this response

Properties

AllowEmptyElementLookup

Lookup of element names that are not skipped if empty within the XML response structure.

public HashSet<string> AllowEmptyElementLookup { get; }

Property Value

HashSet<string>

CurrentDepth

Returns the element depth of the parser's current position in the XML document being parsed.

public override int CurrentDepth { get; }

Property Value

int

CurrentPath

The current XML path that is being unmarshalled.

public override string CurrentPath { get; }

Property Value

string

IsAttribute

True if NodeType is Attribute.

public bool IsAttribute { get; }

Property Value

bool

IsEndElement

True if NodeType is EndElement.

public override bool IsEndElement { get; }

Property Value

bool

IsStartElement

True if NodeType is Element.

public override bool IsStartElement { get; }

Property Value

bool

IsStartOfDocument

True if the context is at the start of the document.

public override bool IsStartOfDocument { get; }

Property Value

bool

Stream

public Stream Stream { get; }

Property Value

Stream

Methods

Dispose(bool)

protected override void Dispose(bool disposing)

Parameters

disposing bool

Read()

Reads to the next node in the XML document, and updates the context accordingly.

public override bool Read()

Returns

bool

True if a node was read, false if there are no more elements to read./

ReadText()

Returns the text contents of the current element being parsed.

public override string ReadText()

Returns

string

The text contents of the current element being parsed.