Saxon API for .NET |

# DocumentBuilder.Build Method (XmlReader)

Load an XML document, delivered using an XmlReader.

public XdmNode Build(
XmlReader reader
);

#### Return Value

An `XdmNode`, the document node at the root of the tree of the resulting in-memory document

#### Remarks

The XmlReader is responsible for parsing the document; this method builds a tree representation of the document (in an internal Saxon format) and returns its document node. The XmlReader is not required to perform validation but it must expand any entity references. Saxon uses the properties of the `XmlReader` as supplied.

Use of a plain `XmlTextReader` is discouraged, because it does not expand entity references. This should only be used if you know in advance that the document will contain no entity references (or perhaps if your query or stylesheet is not interested in the content of text and attribute nodes). Instead, use an `XmlValidatingReader` (with `ValidationType` set to `None`).

Conformance with the W3C specifications requires that the `Normalization` property of an

    XmlTextReader

should be set to `true`. However, Saxon does not insist on this.

If the `XmlReader` performs schema validation, Saxon will ignore any resulting type information. Type information can only be obtained by using Saxon's own schema validator, which will be run if the `SchemaValidationMode` property is set to `Strict` or `Lax`

#### See Also

DocumentBuilder Class | Saxon.Api Namespace | DocumentBuilder.Build Overload List