简体   繁体   中英

Is it possible to retrieve data from an XML file through XSD in C#?

Let's say I have an XML file that has all sorts of data in it (integers, strings...) and I also have the corresponding XSD.

Is it possible to extract the XML data (and perhaps display it in a DataGridView ) by using only the XSD?

If so, how would one go about that?

The XML file will have to be involved, of course, in order to access its data. An XSD could help in accessing the data of an XML file in the following ways:

  • An XSD can be used to automatically derive classes in a programming language (such as Java or C#) which will be able to read (unmarshal) the XML file into objects, allow programmatic access and manipulation, and write ( marshal ) the objects back to XML.

  • An XSD, combined with a validating parser, can be used to parse the XML file and provide the following:

    1. Access to values.
    2. Notification of violations of the constraints specified in the XSD

(Note that access without validation (#1) requires no XSD even.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM