XML design objectives in .NET Framework

xiaoxiao2021-03-06  113

The XML target in NET Framework is:

Compliant with the W3C standard. Scalability. Plug-in structure. performance. Tighten to ADO.NET.

Standards compliant

The standard means that class is fully compliant with XML, namespace, XSLT, XPath, Architecture, and Document Object Model (DOM) current W3C recommendation standard. The standards ensure interoperability and make it easy to develop cross-platform applications.

The most prominent point is that the XML class in .NET Framework supports the W3C XML Architecture Definition Language (XSD) 1.0 recommendation. There are some XML classes in .NET Framework to provide authentication, and an object model can be used to generate an XSD architecture in memory. A quick only-entered analyzer that can be verified for architecture, DTD, XDR, and XSD is called XMLValidatingReader. XMLValidatingReader is a standard XML analyzer. The XMLSChemacollection class can be used to cache common XSD or XDR architectures when using XMLValidatingReader.

There is an XML class set in the .NET Framework to provide a schema object model (SOM), which can be programmatically generated and compile the XSD architecture. Xmlschema class represents an XSD architecture. These architectures can be loaded and kept using the XMLReader and XMLWRITER classes.

XMLDocument class implements document object model level 1 and level 2 suggestions, it is customized according to the General Design Guide of .NET Framework. For example, the method name uses uppercase letters.

The XSLTransform class is compliant with the XSL conversion (XSLT) 1.0 version of the XSLT conversion document (XSLT) 1.0 recommendation.

Extensibility

The XML in .NET Framework becomes expandable by using abstract base classes and imaginary methods. Such scalability (or child creation) is interpreted by XmlReader, XMLWriter, and XPathnavigator, which makes it possible to develop newly implemented classes and public XML classes on different storage regions or data sources. For example, XPathnavigator is an API integrating an XPath query engine that can be implemented on existing storage systems (such as file systems, registry, and relational databases). It not only shows data as XML, but also uses the default implementation of the XPath API query method (such as Select), providing XPath query support for different data sources.

Another example of the scalability is XMLReader, which provides an API for quick only in the storage area, which is disclosed to the XML Infoset found when it moves through the flow. The XML of the .NET Framework has the following XMLReader implementation: XMLTextReader class for reading the stream, the XMLNodeReader class for reading the node tree and the XMLValidatingReader for verifying support on the XMLTextReader.

XMLWriter generates an XML stream using a push-based API. The XML in the .NET Framework has an XMLWRITER implementation called XMLTextWriter.

It can be further derived from these classes to create additional readers that can implement specific processing. For example, by derived from XMLTextReader, create a custom reader called MyXMLTextReader, you can create a reader version with logic specific to application processing requirements.

XmlResolver abstraction provides hooks for external resources referenced in an XML document. This allows you to cache resources as applications (such as databases) or by derived from this class to resource with different protocols. XMLResolver's two implementations XMLURLRESOLVER and XMLSecureresolver use http: //, https: // and file: // protocol resources. Plugable structure

The XML in the .NET Framework has a plug-in structure. In the stream-based structure, the plug-in means that it is easy to replace the components based on these abstractions in the .NET Framework. The plug-in structure also means that the data can be transmitted in the form of flow between components and new components inserted into this stream can change the processing. For example, the stream from XML Web Services can be analyzed by XMLTextReader. You can create XMLDocument using XMLTextReader, and then you can create XMLNodeReader using XMLDocument.

Another example is to load the DOM (XMLDocument class) from XMLReader and save the output using XMLWRITER. By expanding existing classes to create their own implementations, you can affect the behavior of the XMLDocument class. For example, if a XMLReader implementation called MYXMLFileReader is created, and it can disclose the file system as XML, you can load XMLDocument from this reader. Or you can inherit from XMLTextReader, create a new custom reader to convert to an element-centered document with an element-centered document, which can be used to load XMLDocument. This provides a plug-in structure based on a new class of existing classes.

Another example of plugging together with a component is using different data stores (such as XpathDocument and XMLDocument) during the conversion process. These data storage areas can be converted with XSLTransform class, and output can then flow into another storage area or returned from XML Web Services in a stream. The following figure illustrates this.

By using the IXPathnavigable interface, any storage area for XPathnavigator can be inserted into the XSLTransform class to allow XSLT conversion to the storage area. XMLDocument, XpathDocument and XMLDATADOCUMENT classes have this capability. The flow output from XSLTransform can then be sent to XMLReader or XMLWRITER in the plug-in structure style.

performance

The XML class in the .NET Framework represents a low level XML processing component, which is not only used as part of the .NET Framework, but also integrates XML into the application. These classes require extremely high performance.

The XML class in .NET Framework is designed to support stream processing-based models, which have the following features:

Using XMLReader only, the cache used in the pull mode analysis is minimized. Use XMLValidatingReader for only verification. Xpathnavigator's innovative cursor style navigation, which creates nodes to a single virtual node, but still provides random access to documents. This does not need to generate a complete node tree in memory, such as DOM. Incremental stream output from the XslTransform class.

XpathDocument is an optimized read-only memory of XPath queries. It is recommended to use it at any time you need to perform XSLT processing. High-performance XSLT conversion can be achieved by using this storage area and the XSLTransForm class.

Integrate with ADO.NET

Tight integration between the XML class and ADO.NET, relational data and XML are combined in .NET Framework. The DataSet component represents a disconnected database that can be read and written to XML using XMLReader and XMLWRITER classes, maintaining its internal relational architecture structure as an XML architecture (XSD) and projecting from an XML document.

By synchronizing the Dataset with XMLDocument, it is updated in the other when the maintained data is appropriate, and XMLDATADOCUMENT does exceed the boundaries of XML and relational data. Since XMLDocument can store semi-structured data, the DataSet provides an XML on the XML based on all of the functions of the XML storage area.

For more information on how the .NET Framework is enabled by DataSet objects and XMLDATADOCUMENT objects, see the relationship data and XML integration of ADO.NET.

转载请注明原文地址:https://www.9cbs.com/read-97509.html

New Post(0)