Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

XPathQueryGenerator Class

.NET Framework (current version)
 

When given a class representing a data contract, and metadata representing a member of the contract, produces an XPath query for the member.

Namespace:   System.Runtime.Serialization
Assembly:  System.Runtime.Serialization (in System.Runtime.Serialization.dll)

System::Object
  System.Runtime.Serialization::XPathQueryGenerator

public ref class XPathQueryGenerator abstract sealed 

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticCreateFromDataContractSerializer(Type^, array<MemberInfo^>^, StringBuilder^, XmlNamespaceManager^%)

Creates an XPath from a data contract using the specified contract data type, array of metadata elements, the top level element, and namespaces.

System_CAPS_pubmethodSystem_CAPS_staticCreateFromDataContractSerializer(Type^, array<MemberInfo^>^, XmlNamespaceManager^%)

Creates an XPath from a data contract using the specified data contract type, array of metadata elements, and namespaces..

For more information about data contracts, see Using Data Contracts.

To use the class, there are four steps:

  1. Create the data contract type by applying the DataContractAttribute and DataMemberAttribute as appropriate to the type and its fields or properties.

  2. Use the GetMember method of the Type class to generate the MemberInfo array.

  3. Pass the type and the array to the method.

  4. If needed, use the XmlNamespaceManager returned by the namespaces parameter to examine the XML namespaces referenced by the namespaces prefixes in the XPath query.

System_CAPS_noteNote

The namespace prefix "xg" (for "XPath Generator") is used as the default in the XPath. This cannot be changed. Instead, refer to the NameTable collection to see what namespace the prefix is associated with.

The following example creates XPath queries from two classes to which the DataContractAttribute and DataMemberAttribute attributes have been applied.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 4.0

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: