473,326 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

XSD: What is elementFormDefault="qualified" for?

Hi everyone

I am a new poster to this group, so hello to you all!

Having just started a new job I have been thrown in the deep end with
some heavy XML work so I am finding my feet and I am sure that this
will be the first of many posts on here!

My first question is to do with Complex Types in XSD. I have figured
out what a complex type is, and I have found that what the API provider
is doing, is to do <xs:extension /> in a secondary set of XSDs.

What I have noticed is that at the top of the XSD in the <xs:schema />
opening tag, it says elementFormDefault="qualified" - and I was just
wondering if somebody could tell me what it is there for because I
can't find any documentation on what it does?

Many thanks in advance

Darren

May 12 '06 #1
5 4323
Hi Darren,

"daz_oldham" <Da**************@gmail.com> writes:
What I have noticed is that at the top of the XSD in the <xs:schema />
opening tag, it says elementFormDefault="qualified" - and I was just
wondering if somebody could tell me what it is there for because I
can't find any documentation on what it does?


elementFormDefault="qualified" declaration indicates that all elements,
even local (i.e., those defined within complexType) should be qualified
in the instance documents.

hth,
-boris

May 12 '06 #2
Thanks Boris, I know that you're answer is spot-on but still with my
newbie hat on - what does "qualified" mean?

I know that is a very novice question, but as I say, I am really new to
all this!

Many thanks

Darren

May 15 '06 #3
All "qualified" elements and attributes are in the targetNamespace of the
schema and all "unqualified" elements and attributes are in no namespace.
All global elements and attributes are qualified.

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

"daz_oldham" <Da**************@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Thanks Boris, I know that you're answer is spot-on but still with my
newbie hat on - what does "qualified" mean?

I know that is a very novice question, but as I say, I am really new to
all this!

Many thanks

Darren

May 15 '06 #4
"Qualified", in XML terms, means "Associated with a namespace, either by
the use of a declared prefix or via a default namespace declaration".

As to what elementFormDefault means: It indicates "whether or not
locally declared elements and attributes must be unqualified." See the
discussion and examples at

http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/#NS

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
May 15 '06 #5
Darren,

"daz_oldham" <Da**************@gmail.com> writes:
Thanks Boris, I know that you're answer is spot-on but still with my
newbie hat on - what does "qualified" mean?


Ok, I guess an example is in order:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com/library"
elementFormDefault="qualified">

<xsd:element name="catalog">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="book" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

</xsd:schema>
With this schema, your instance would then look lool like this:

<lib:catalog xmlns:lib="http://www.example.com/library">
<lib:book>XML Schema</lib:book>
</lib:catalog>

If you change the above schema to read elementFormDefault="uqualified",
then the instance becomes:

<lib:catalog xmlns:lib="http://www.example.com/library">
<book>XML Schema</book>
</lib:catalog>

In XML Schema terms, in the first case, local element catalog/book belongs
to the http://www.example.com/library namespace (and therefore has to be
prefixed with the corresponding namespace prefix (lib in our case)). In
the second case, the same element does not belong to any namespace and
therefore can be used as-is in the instance document.
hth,
-boris
--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding
May 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: johnsocs | last post by:
All I'm trying to write an xml schema for the following xml from the google web service api. In the schema I'm not sure how to describe the soapenv:encodingStyle attribute. Thanks. <?xml...
0
by: jacksuyu | last post by:
I have two xsd files, in one xsd file, I defined a "key", I'd like to use "keyref" to refer to that "key" from another xsd file. But I always get attribute is empty error. my.xsd is my first xsd...
2
by: joewhitehair | last post by:
Using the XSD.exe tool, I created a number of classes from my XSD file. When I generate the WSDL for my web service, the schema does not have the proper Occurance constraints for the attributes. In...
6
by: TS | last post by:
Hi, i have a problem validating xml against schema. I used http://apps.gotdotnet.com/xmltools/xsdvalidator/Default.aspx validator and it says it is fine. Can you tell me why this doesn't work? ...
4
by: bibsoconner | last post by:
Hi, I hope someone can please help me. I'm having a lot of trouble with schema files in .NET. I have produced a very simple example that uses "include" to include other schema files. It all...
0
by: Andrew Burgher | last post by:
Feeding the following .xsd into the XsdObjectGen (v1.4.2.0) tool produces an invalid attribute: with DataType="System.String". Has anybody seen this behaviour before? Is this a bug in...
5
by: CindyRob | last post by:
Using .NET framework 1.1 SP1, .NET framework SDK 1.1 SP1, Visual Studio .NET 2003, hotfixes 892202 and 823639. I create a proxy class using wsdl.exe, and in the serialized XML request, I see...
3
by: filip.norrgard | last post by:
Hi All! I've been developing an ASP.Net 2.0 web application using the Visual Studio 2005 tools. Currently datagrids on a page are filled with data from a dataset (a .xsd file in the "project")...
6
by: Bobby Edward | last post by:
Using ASP.NET 3.5 and MySQL (thru DevArt MyDirect.NET)... On the production server I get a "Parser Error" for every XSD dataset. It works perfect on my dev machine. But, on the production...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.