Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
65 lines (54 sloc) 3.84 KB
<Type Name="XmlValueGetter" FullName="System.Xml.Schema.XmlValueGetter">
<TypeSignature Language="C#" Value="public delegate object XmlValueGetter();" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed XmlValueGetter extends System.MulticastDelegate" />
<TypeSignature Language="DocId" Value="T:System.Xml.Schema.XmlValueGetter" />
<TypeSignature Language="VB.NET" Value="Public Delegate Function XmlValueGetter() As Object " />
<TypeSignature Language="C++ CLI" Value="public delegate System::Object ^ XmlValueGetter();" />
<TypeSignature Language="F#" Value="type XmlValueGetter = delegate of unit -&gt; obj" />
<AssemblyInfo>
<AssemblyName>System.Xml</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.0.5.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>netstandard</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.Xml.ReaderWriter</AssemblyName>
<AssemblyVersion>4.2.0.0</AssemblyVersion>
<AssemblyVersion>4.2.1.0</AssemblyVersion>
<AssemblyVersion>4.2.2.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Delegate</BaseTypeName>
</Base>
<Parameters />
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Docs>
<summary>A <see langword="delegate" /> used by the <see cref="T:System.Xml.Schema.XmlSchemaValidator" /> class to pass attribute, text, and white space values as a Common Language Runtime (CLR) type compatible with the XML Schema Definition Language (XSD) type of the attribute, text, or white space.</summary>
<returns>An object containing the attribute, text, or white space value. The object is a CLR type that corresponds to the XSD type of the attribute, text, or white space value.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
An <xref:System.Xml.Schema.XmlValueGetter>`delegate` is useful if the CLR value of an attribute, text, or white space node is already available, and avoids the cost of converting it to a `string` and then reparsing it again for validation.
For more information about the <xref:System.Xml.Schema.XmlSchemaValidator> class, see the [XmlSchemaValidator Push-Based Validation](~/docs/standard/data/xml/xmlschemavalidator-push-based-validation.md) topic, or the <xref:System.Xml.Schema.XmlSchemaValidator> class reference documentation.
## Examples
The following example validates the `contosoBooks.xml` file against the `contosoBooks.xsd` schema. The example uses the <xref:System.Xml.Serialization.XmlSerializer> class to deserialize the `contosoBooks.xml` file and pass the value of the nodes to the methods of the <xref:System.Xml.Schema.XmlSchemaValidator> class.
[!code-csharp[XmlSchemaValidatorExamples#1](~/samples/snippets/csharp/VS_Snippets_Data/XmlSchemaValidatorExamples/CS/XmlSchemaValidatorExamples.cs#1)]
[!code-vb[XmlSchemaValidatorExamples#1](~/samples/snippets/visualbasic/VS_Snippets_Data/XmlSchemaValidatorExamples/VB/XmlSchemaValidatorExamples.vb#1)]
The example takes the `contosoBooks.xml` file as input.
[!code-xml[XPathXMLExamples#2](~/samples/snippets/xml/VS_Snippets_Data/XPathXMLExamples/XML/contosoBooks.xml#2)]
The example also takes the `contosoBooks.xsd` as an input.
[!code-xml[XPathXMLExamples#3](~/samples/snippets/xml/VS_Snippets_Data/XPathXMLExamples/XML/contosoBooks.xsd#3)]
]]></format>
</remarks>
<altmember cref="T:System.Xml.Schema.XmlSchemaValidator" />
<altmember cref="T:System.Xml.Serialization.XmlSerializer" />
<related type="Article" href="https://msdn.microsoft.com/library/911d4460-dd91-4958-85b2-2ca3299f9ec6">XmlSchemaValidator Push-Based Validation</related>
</Docs>
</Type>
You can’t perform that action at this time.