Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Doubt in xsd

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Marshal
Posts: 69789
277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Too difficult a question for us beginners. Moving.
 
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic