Hi, I am not clear about targetNamespace. Hope you can help me. .. <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:mh="http://www.Monson-Haefel.com/jwsbook" targetNamespace="http://www.Monson-Haefel.com/jwsbook">
"targetNamespace declare the XML namespace of all NEW TYPES explicitly created within the schema"(from RMH book-p36).I understand that USAddress belongs to targetNamespace, because it is a new types created in the schema. The schema also declare a default namespace. The namespace(default namespace) "is the standard namespace defined by the XML schema specification-all the XML schema elements must belong to this namespace"(from RMH book-p36).Does that mean "address","name" and "street" belong to the default namespace? Thanks for your help.
address","name" and "street" are the element identifiers.
I would say address","name" and "street" are more like the class/instance variables in a Java Class, it can be any valid name.
targetnamespace is saying this is the namespace that these new element belong to.
Hope I did not confuse you :roll:
Thanks,
Santosh
Nancy King
Ranch Hand
Joined: Jan 06, 2003
Posts: 30
posted
0
Santosh,
If I understand correctly, you mean "address", "name" and "street" element belong to targetNamespace, right? Then no element in above XML schema belong to default namespace. If that's true, no need to define default namespace in schema, am I right? I don't understand "all the XML schema elements must belong to this namespace(defult Namespace)"(from p36 of RMH book). In above XML schema, what are "XML schema elements"? If above XML schema define elementFormDefault="qualified", then "name" and "address" in xml document must belong to targetNamespace, if no elementFormDefault defined, then "name" and "address" in xml document may not from targetNamespace. Am I right? I am still confused, and please help me out. Thanks, Nancy
"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
vishal mehta
Greenhorn
Joined: Jun 07, 2004
Posts: 3
posted
0
I have one question regarding targetNamespace. Can we have more than one targetNamespace? If yes then can someone give me an example?
Vishal
Slava Lovkiy
Greenhorn
Joined: Aug 17, 2005
Posts: 29
posted
0
According to XML-Schema spec. (http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/), we have the following definition of targetNamespace: "[Definition:] Several kinds of component have a target namespace, which is either �absent� or a namespace name, also as defined by [XML-Namespaces]. The �target namespace� serves to identify the namespace within which the association between the component and its name exists. In the case of declarations, this in turn determines the namespace name of, for example, the element information items it may �validate�." And there is a note in the same document: "At the abstract level, there is no requirement that the components of a schema share a �target namespace�. Any schema for use in �assessment� of documents containing names from more than one namespace will of necessity include components with different �target namespaces�. This contrasts with the situation at the level of the XML representation of components, in which [i]each schema document contributes definitions and declarations to a single target namespace[i]."
Thus, single schema definition might address not more than 1 targetNamespace
ramesh vanka
Greenhorn
Joined: Mar 13, 2005
Posts: 9
posted
0
TargetNameSpace: main purpose to identify uniqueness of the schema.
Here I had created 2 schemas 1) Default Name Space 2) Default Name Space and TargetName Space