Get a representation of the part of the specified type.
Public MustOverride Function RetrieveAs( _
ByVal t As Type _
) As Object
[C#]
public abstract object RetrieveAs(
Type t
);
[C++]
public: virtual Object* RetrieveAs(
Type* t
) = 0;
[JScript]
public abstract function RetrieveAs(
t : Type
) : Object;
Parameters
- t
- The expected result type (XmlDocument, XmlReader, Stream, or the .NET type that the type is modeled after.
Exceptions
| Exception Type | Condition |
| InvalidCastException | If the property being updated is not ContentType. |
| ArgumentNullException | Setting the property value to a null. |
| Serialization exceptions | Thrown by System.Xml and custom formatters. |
Remarks
XML Schema-based types can be retrieved as XmlDocument, XmlNode, XmlElement, XmlDocumentFragment, or a Stream. For other requested types, the system performs XmlDeserialization on the underlying part into the requested type.
Non-XML Schema-based types that are not custom formatted are also deserialized unless the XML types are requested. For XML types, the object is XML de-serialized and the appropriate type returned.
Any custom formatted types can only use the underlying type.
Example
[C++]
<snippet id="75b37adf-08cc-4f0c-9b6f-ec535e95978b" name="" devlang="CSharp" type="start"/>
static public void ValidatePart(XLANGPart part)
{
// get an XMLSchemaCollection from the part
XmlSchemaCollection xsc = part.XmlSchemaCollection;
// use the RetrieveAs method to retrieve the part as a stream
Stream stm = (Stream)part.RetrieveAs(typeof(Stream));
XmlTextReader xtr = new XmlTextReader( stm );
XmlValidatingReader xvr = new XmlValidatingReader( xtr );
xvr.Schemas.Add( xsc );
xvr.ValidationType = ValidationType.Schema;
// use a validation class that you have implemented
Validator validator = new Validator();
xvr.ValidationEventHandler += new ValidationEventHandler( validator.Callback );
while (xvr.Read())
;
if (validator.Args != null)
throw validator.Args.Exception;
}
<snippet id="75b37adf-08cc-4f0c-9b6f-ec535e95978b" type="end"/>
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code.
See Also
XLANGPart Class | XLANGPart Members | Microsoft.XLANGs.BaseTypes Namespace
To download updated BizTalk Server 2004 Help from www.microsoft.com, go to
http://go.microsoft.com/fwlink/?linkid=20616.
Copyright © 2004 Microsoft Corporation.
All rights reserved.