473,545 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# (2003) - Schema and default attribute

26 New Member
Hi:

This is my simple schema

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  3.     <xs:element name="Application">
  4.         <xs:complexType>
  5.             <xs:sequence>
  6.                 <xs:element name="NotesList">
  7.                     <xs:complexType>
  8.                         <xs:sequence>
  9.                             <xs:element name="Note">
  10.                                 <xs:complexType>
  11.                                     <xs:attribute name="SectionID" type="xs:integer" default="1"/>
  12.                                 </xs:complexType>
  13.                             </xs:element>
  14.                         </xs:sequence>
  15.                     </xs:complexType>
  16.                 </xs:element>
  17.             </xs:sequence>
  18.         </xs:complexType>
  19.     </xs:element>
  20. </xs:schema>


And here sample XML file…

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Nodes.xsd">
  3.     <NotesList>
  4.         <Note />
  5.     </NotesList>
  6. </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
Dec 28 '07 #1
0 1028

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1410
by: Maxim | last post by:
If there is a document like this: <Configurations> <Configuration default="true"> ... </Configuration> <Configuration> ...
0
1569
by: inquirydog | last post by:
Hi- I am using xml to hold configuration data for a project, and using schema to define what the configuration file should look like. I wanted to get some advice on an intelligant way to specify and create a default config file. In other words, when the developer puts a new element in the schema
4
2924
by: Lénaïc Huard | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I've some namespace problems when defining default values for attributes. My problem seems to come from the fact that the attributes are defined in a different namespace from the element.
0
1450
by: chris.millar | last post by:
I am using the ReadXMLSchema method of system.data.dataset to read a schema into a dataset. I have an XML file that I build up and wish to do a .Update against a database. The dataset doesn't have a schema and takes the following form: xml: <?xml version="1.0" encoding="utf-8"?> <DataSetEntities...
12
4929
by: Stefano | last post by:
Hi all, what is the correct use of the "default" attribute in XML Schema? For example: <xs:element name="myProperty" type="xs:string" default="myDefaultValue"/> What can I do with it? What is the meaning of < ....default="myDefaultValue" /> ?
0
1566
by: Deep Purple | last post by:
I started with the following error... ------------------------------------------------------- An error occured while loading the schema with TargetNamespace 'http://www.w3.org/2001/XMLSchema' referenced in this document. The value for the 'base' attribute is invalid - 'xsd:string' is an invalid value for the 'base' attribute. An error...
4
2962
by: ashish.sadanandan | last post by:
Hi, I'm new to XML and just started reading some documentation on W3C compliant schemas recently. The XML file I'm generating is for an embedded application and so size is of extreme importance. The information I want to save in this XML file is the attributes of the members of a structure. Now lets say there is a member variable that is...
0
2617
by: rautsmita | last post by:
hello friends , i am using to jdk6 and JAXB2.0, i have geomtry.xsd file i am trying to compile this file using jaxb but i got some error i.e.The particle of the type is not a valid restriction of the particle of the base this xsd file is valid as per w3c standard i am also providing error in detail and geometry.xsd file geometry.xsd <?xml...
0
1255
by: =?Utf-8?B?VmVudQ==?= | last post by:
This is my simple schema ------------------------------------------------------------------------------------ <?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>...
0
7499
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7689
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7943
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
3490
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1919
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.