-1

I am new to XSD. I want to know how XSD files are used to export data to XML.

I assume that same XSD file can be used while imorting the XML file to check if the schema of the XML file is as per the schema of XSD file. I hope this assumption is correct.

Thanks, Ram

Ram
  • 11,404
  • 15
  • 62
  • 93

2 Answers2

1

Some corrections in your statement:
XSD file doesn't export the data .. it is used to validate the data.
XSD file can be used to validate XML while importing it .. so as to check if XML file is as per the SCHEMA file. XSD-XML Schema Definition

ps: Normal convention is .. XSD is used on imported data than exporting ones.. because you know what you are sending .. but you should be sure enough to accept the valid data that is sent to you by other system.. (no harm in validating out-going data though)

  • XML stands for EXtensible Markup Language
  • XML is a markup language much like HTML (but not HTML)
  • XML was designed to carry data, (not to display data)
  • No tags or attributes are predefined. What you define is your data :)

The purpose of an XML Schema is to define rule-sets for an XML document, just like a DTD. (its much more advanced than DTD.) Refer this link [click_here] to know capabilities and limits of XSD

Community
  • 1
  • 1
Rookie Programmer Aravind
  • 11,952
  • 23
  • 81
  • 114
0

XSD files are used to check the schema of the XML:

XmlReaderSettings xmlSettings = new XmlReaderSettings();
xmlSettings.ValidationType = ValidationType.Schema;
xmlSettings.Schemas.Add("http://www.example.com/SchemaName", 
    "http://intranet/xml/schemadatei.xsd");
XmlReader xmlReader = XmlReader.Create(this.dateiname, xmlSettings);
while (xmlReader.Read())
{ }

And you can generate from XSD a class as you can see here: http://msdn.microsoft.com/de-de/library/x6c1kb0s%28v=vs.80%29.aspx

user1027167
  • 4,320
  • 6
  • 33
  • 40