XML Architecture -- use XML architecture set

Source: Internet
Author: User
How to Use the XML architecture set

This example illustrates how to use the xmlschemacollection class used by xmlvalidatingreader for effective data verification. The xmlschemacollection class allows you to maintain the cache of multiple XML schema definition languages (XSD) and XML data simplified (XDR) architectures, which can be used when architecture is needed in the future. Although this class can store both the XSD and XDR architectures, only the XSD Schema can be applied to methods or attributes that use or return XMLSCHEMA.

The schema in xmlschemacollection can be used to verify XML data. When reading XML data, you can use xmlvalidatingreader to apply the verification. For information about how to use xmlvalidatingreader, see how to apply verification when reading XML.

Validation is the process of forcibly applying rules to XML content through document type definition (DTD) or a schema. Simply put, the architecture is the XML Representation of DTD, but it can also export the relationship between XML data and type information. The xmlvalidatingreader class provides verification support on xmltextreader.

 

VB schemacollection. aspx

[Running example] | [View Source code]

This example shows how xmlvalidatingreader uses xmlschemacollection for valid data verification. For the schema set, this example adds the XSD Schema xmlsc. XSD for verification. In this example, create an xmlvalidatingreader and add the schema from the schema set to the reader. Finally, this example uses the reader to read data and set the output display format.


... xmlvalidatingreader reader = NULL; xmlschemacollection xsc = new xmlschemacollection (); try {xsc. add (ARGs [1], new xmltextreader (ARGs [1]); reader = new xmlvalidatingreader (New xmltextreader (ARGs [0]); reader. schemas. add (xsc); reader. validationtype = validationtype. schema; while (reader. read ()){...}} 
... Dim reader as xmlvalidatingreader dim xsc as xmlschemacollection = new xmlschemacollection () Try xsc. add (ARGs (1), new xmltextreader (ARGs (1) reader = new xmlvalidatingreader (New xmltextreader (ARGs (0) reader. schemas. add (xsc) reader. validationtype = validationtype. schema while (reader. read ())... end while... end try
C # VB  
Summary
    1. You can use xmlschemacollection as the cache for the pre-loaded architecture.
    2. These pre-loaded architectures only need to be loaded once and can be reused. In this way, higher analysis performance can be achieved.
    3. Xmlschemacollection supports both XDR and XSD architectures.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.