aspose file tools*
The moose likes XML and Related Technologies and the fly likes XML schema problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "XML schema problem" Watch "XML schema problem" New topic
Author

XML schema problem

Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 207

Hi all,
I just started to study XML schemas and I am facing a doubt regarding namespaces in xml schema:
1:How does the parser know what are the defined elements in the namespace if namespaces themselves do not point to any physical location.i.e in below declaration
"xs: http://www.w3.org/2001/XMLSchema ",how does the parser knows that <xs:element> is valid declaration.
2:when we say <xs:element name="name" type="xs:string">,then "type" attribute belongs to which namespace,as it is not prefixed with anything?

Thanks.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Try to use your parser with the following declaration in your XML Schema and see what happens.

"xs:dsfklnsdaklfnsdkljnvxchvosdfhuigvsvn/XMLSchema"
Sudhanshu Mishra
Ranch Hand

Joined: May 28, 2011
Posts: 207

Hi Jimmy,
Thanks for the reply.I got my answer for the first question,but what about second question?Please be patient with me if it's a silly one.
Waiting for the reply.

Thanks...
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9318
    
109

Sudhanshu Mishra wrote:
I got my answer for the first question,but what about second question?


Read this article on namespaces.

[My Blog] [JavaRanch Journal]
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 464
    
    2
2:when we say <xs:element name="name" type="xs:string">,then "type" attribute belongs to which namespace,as it is not prefixed with anything?

The type attribute, just like the name attribute, is in null (or sometime said empty for the same) namespace. But these attributes are somehow ontologically "attached" to the element (xs:element) they are "describing" (if you are somehow knowing the rudiment of renaissance philosophy, that might help a bit), their schema is normally appearing in the schema defining the xs namespace (that is the schema or schema). Does it make thing clearer? I think you might think, hell no! Maybe you might come back to it when time comes.
 
 
subject: XML schema problem
 
Similar Threads
Namespace URLs
how to import 2 xsd's which have same namespace?
Help me for xsd creation
Validating a SOAP document using XSD
Help needed on xmlns & targetNamespace