XmlSerializableServices XmlSerializableServices XmlSerializableServices XmlSerializableServices Class

定義

包含讀取和寫入 XML 的方法。Contains methods for reading and writing XML.

public ref class XmlSerializableServices abstract sealed
public static class XmlSerializableServices
type XmlSerializableServices = class
Public Class XmlSerializableServices
繼承
XmlSerializableServicesXmlSerializableServicesXmlSerializableServicesXmlSerializableServices

備註

您可以使用 Windows Communication Foundation (WCF),產生的 XML 結構描述表示資料合約的 CLR 型別。Using Windows Communication Foundation (WCF), you can generate CLR types representing data contracts from XML schemas. 在某些情況下,當您這樣處理時,結構描述並非一定是用來表示資料合約。In certain cases when doing so, the schemas may not all be represented as data contracts. 在這種情況下,您可以使用 ImportXmlType 類別的 ImportOptions 屬性。In this case, you can use the ImportXmlType property of the ImportOptions class. 將屬性設定為 true,便可指定將這些類型匯入成為負責實作 IXmlSerializable 介面的 XML 類型。Setting the property to true specifies that these types are imported as XML types that implement the IXmlSerializable interface. 在此過程中,所產生的型別能夠儲存任何資料,但是序列化程式會將其當做 XML 進行讀取和寫入。In the process, the generated types can store anything, but they are read and written as XML by the serializer.

XmlSerializableServices 是抽象協助程式類別,其中包含的程式碼可由產生的 IXmlSerializable 型別用來讀取和寫入 XML。The XmlSerializableServices is an abstract helper class that contains code that is used by the generated IXmlSerializable types to read and write XML. 這個類別也包含可產生所產生型別之結構描述的程式碼。It also contains code for generating schema for the generated types. 請注意,其中並未儲存有關結構描述的詳細資料。Note that details about the schemas are not stored. 所產生的型別只會儲存名稱。Only the name is stored in the generated type. 這個類別所產生的預設結構描述,就是表示以適當結構描述型別名稱做為合約名稱的 XML 結構描述類型 anyTypeThis class generates a default schema that represents the XML schema type anyType with the appropriate schema type name as the contract name.

方法

AddDefaultSchema(XmlSchemaSet, XmlQualifiedName) AddDefaultSchema(XmlSchemaSet, XmlQualifiedName) AddDefaultSchema(XmlSchemaSet, XmlQualifiedName) AddDefaultSchema(XmlSchemaSet, XmlQualifiedName)

產生採用已指定類別名稱的預設結構描述型別,並將它新增至指定的結構描述集合。Generates a default schema type given the specified type name and adds it to the specified schema set.

ReadNodes(XmlReader) ReadNodes(XmlReader) ReadNodes(XmlReader) ReadNodes(XmlReader)

從指定的讀取器讀取 XML 節點集合,並傳回結果。Reads a set of XML nodes from the specified reader and returns the result.

WriteNodes(XmlWriter, XmlNode[]) WriteNodes(XmlWriter, XmlNode[]) WriteNodes(XmlWriter, XmlNode[]) WriteNodes(XmlWriter, XmlNode[])

使用指定的寫入器,寫入提供的節點。Writes the supplied nodes using the specified writer.

適用於