What is the purpose of XSD files?

前端 未结 10 1478
抹茶落季
抹茶落季 2020-11-30 20:25

Since we can query on the XML file from C# (.NET), why do we need an XSD file? I know it is metadata file of particular XML file. We can specify the relationships in XSD, b

相关标签:
10条回答
  • 2020-11-30 20:59

    XSDs constrain the vocabulary and structure of XML documents.

    • Without an XSD, an XML document need only follow the rules for being well-formed as given in the W3C XML Recommendation.
    • With an XSD, an XML document must adhere to additional constraints placed upon the names and values of its elements and attributes in order to be considered valid against the XSD per the W3C XML Schema Recommendation.

    XML is all about agreement, and XSDs provide the means for structuring and communicating the agreement beyond the basic definition of XML itself.

    0 讨论(0)
  • 2020-11-30 20:59

    An XSD file is an XML Schema Definition and it is used to provide a standard method of checking that a given XML document conforms to what you expect.

    0 讨论(0)
  • 2020-11-30 21:03

    An XSD is a formal contract that specifies how an XML document can be formed. It is often used to validate an XML document, or to generate code from.

    0 讨论(0)
  • 2020-11-30 21:04

    XSD files are used to validate that XML files conform to a certain format.

    In that respect they are similar to DTDs that existed before them.

    The main difference between XSD and DTD is that XSD is written in XML and is considered easier to read and understand.

    0 讨论(0)
  • 2020-11-30 21:04

    Without XML Schema (XSD file) an XML file is a relatively free set of elements and attributes. The XSD file defines which elements and attributes are permitted and in which order.

    In general XML is a metalanguage. XSD files define specific languages within that metalanguage. For example, if your XSD file contains the definition of XHTML 1.0, then your XML file is required to fit XHTML 1.0 rather than some other format.

    0 讨论(0)
  • 2020-11-30 21:06

    Also questions is: What is the purpose of giving the relationships in xsd.

    Suppose you want to generate some XML for an external party's tool, or similar - how would you know what structure it is allowed to follow to be used correctly for their tool? you write to a schema. Likewise if you want other people to use your tool, you would write a schema for them to follow. It may also be useful for validating your own XML.

    0 讨论(0)
提交回复
热议问题