File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Doubt in xsd Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Web Services
Reply Bookmark "Doubt in xsd" Watch "Doubt in xsd" New topic
Author

Doubt in xsd

Pradeep Kumar
Ranch Hand

Joined: Sep 08, 2006
Posts: 108

Hi,
I am learning XSD and these are my doubts.

1. where is "xmlns:xs="http://www.w3.org/2001/XMLSchema" defined. When we try to validate an XML against a schema where
does it look for the schema.
2. The significance of targetNamespace and elementFormDefault attributes in XSD document.


Can someone please explain me with this.


Thanks and Regards, Pradeep Kumar
SCJP 1.6, SCWCD 5.0
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32654
    
    4
Too difficult a question for us beginners. Moving.
Ivan Krizsan
Bartender

Joined: Oct 04, 2006
Posts: 2193
Hi!
1) Try pasting http://www.w3.org/2001/XMLSchema.xsd into your web browser.
That is where the XML "schema of schemas" is defined. However, I assume that for most cases, this schema is built-in to the basic XML processing APIs.
Regretfully, I have not been able to come up with any proof of this.
2.1) targetNamespace
Declaring a target namespace is significant in the way that it determines to which namespace the definitions in a schema belong.
A namespace is like a box with a name on it. In this box you can put things, but in order to find things in a box, you first have to supply the name of the box in which to look, i.e. the namespace, and then what item to look for. Instead of having all things in one big box (in one namespace) namespaces helps you to group things into smaller groups. This also allows you to define items with the same names without name collisions (as long as they belong to different namespaces).
2.2) elementFormDefault
If elementFormDefault="qualified" means that the elements defined in the schema with this declaration must be qualified with a namespace prefix in an instance of the XML schema. A qualified element looks like this: <tns:someElement/>, an unqualified element looks like this <someElement/>
Please refer to these URLs for more information and examples:
http://www.w3.org/TR/xmlschema-0/#UnqualLocals
http://www.w3.org/TR/xmlschema-0/#QualLocals
Best wishes!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in xsd
 
Similar Threads
DTD v/s XSD
Legal XML
xml schema with xerces parser
How to Convert XSD into XML
WebContent on classpath?