This is my simple schema
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element name="Application">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="NotesList">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="Note">
- <xs:complexType>
- <xs:attribute name="SectionID" type="xs:integer" default="1"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:schema>
And here sample XML file…
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <Application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Nodes.xsd">
- <NotesList>
- <Note />
- </NotesList>
- </Application>
My question is, in the XML file the attribute of “Note” element is not supplied, since in the xsd the attribute has the default value as “1” - When the schema is applied to given XML, will this copy the “default” from Schema to XML (i need to do this in C# 2003) ??
If so
1) How to apply the XSD to XML so that attribute is copied??
2) How can view the content of XML after schema is applied (just to make sure that attributes are copied)
I’m new to this area, please can you help…
Thanks in advance..
Cheers
Venu