System.Xml
2.0.0.0
4.0.0.0
System.Object
The class in the namespace allows you to infer an XML Schema Definition Language (XSD) schema from the structure of an XML document. The class outputs an XML schema that can validate the XML document.
The class supports the W3C XML and XML Schemas standards. It can be used to infer a new schema or to refine an existing schema.
Infers an XML Schema Definition Language (XSD) schema from an XML document. The class cannot be inherited.
Constructor
2.0.0.0
4.0.0.0
To be added.
Initializes a new instance of the class.
Method
2.0.0.0
4.0.0.0
System.Xml.Schema.XmlSchemaSet
The method infers one or more W3C XML Schema Definition Language (XSD) schemas from the XML instance document contained in the object specified. If the XML document contains elements and attributes from multiple namespaces, then multiple schemas are generated: one for each namespace used in the document. The primary schema is the schema that can validate the entire XML document, and its target namespace is the same as the namespace of the document element of the XML document.
The following are important notes to consider when using the method.
-
The method ignores any xsi:type, xsi:schemaLocation, or xsi:noNamespaceSchemaLocation attributes in the XML document.
-
If the object is typed, the type information it contains is ignored.
-
If the object is positioned on an element that is not the root element of the XML document, a schema is inferred for only that element. If the object is not positioned on an element, the method is called on the parameter until an element is encountered (for example, when is ). At this point, the inference process starts from that element. If no element is encountered until the end of the document, an is thrown.
Infers an XML Schema Definition Language (XSD) schema from the XML document contained in the object specified.
An object containing the inferred schemas.
An object containing the XML document to infer a schema from.
Method
2.0.0.0
4.0.0.0
System.Xml.Schema.XmlSchemaSet
The method infers one or more W3C XML Schema Definition Language (XSD) schemas from the XML instance document contained in the object specified. If the XML document contains elements and attributes from multiple namespaces, multiple schemas are generated: one for each namespace used in the document. The primary schema is the schema that can validate the entire XML document, and its target namespace is the same as the namespace of the document element of the XML document.
The following are important notes to consider when using the method.
-
The method ignores any xsi:type, xsi:schemaLocation, or xsi:noNamespaceSchemaLocation attributes in the XML document.
-
If the object is typed, the type information it contains is ignored.
-
If the object is positioned on an element that is not the root element of the XML document, a schema is inferred for only that element. If the object is not positioned on an element, the method is called on the parameter until an element is encountered (for example, when is ). At this point, the inference process starts from that element. If no element is encountered until the end of the document, an is thrown.
-
If an object is passed as a parameter and the element upon which the object is positioned is defined in one of the schemas in the , the inferred schema is used to refine an existing schema in the parameter with the same target namespace; otherwise, a new schema is inferred for the namespace.
Infers an XML Schema Definition Language (XSD) schema from the XML document contained in the object specified, and refines the inferred schema using an existing schema in the object specified with the same target namespace.
An object containing the inferred schemas.
An object containing the XML document to infer a schema from.
An object containing an existing schema used to refine the inferred schema.
Property
2.0.0.0
4.0.0.0
System.Xml.Schema.XmlSchemaInference+InferenceOption
To be added.
If the property is set to , the first time elements are encountered in the XML document, the schema declaration is inferred as minOccurs="1". When attributes are encountered, the schema declaration is inferred as use="required".
If the property is set to , element schema declarations are inferred as minOccurs="0", and attribute schema declarations are inferred as use="optional".
The default value of the property is .
Gets or sets the value that affects schema occurrence declarations inferred from the XML document.
Property
2.0.0.0
4.0.0.0
System.Xml.Schema.XmlSchemaInference+InferenceOption
To be added.
If the property is set to , the inferred type of elements and attributes in the XML document with simple content is always xs:string. If the property is set to , more specific types are inferred, such as xs:date, xs:decimal, xs:unsignedByte, and so on.
The default value of the property is .
Gets or sets the value that affects types inferred from the XML document.