Giving this schema I have two questions. Is it mandatory to declare a qualified name mh:USAddress in the element shipAddress and USAddress of PurchaseOrder?? If I declare only type="USAddress" the schema does take the targetNamespace?
Team Leader<br />SCJP, SCBCD , SCDJWS, Oracle WebLogic, IBM WebSphere e IBM FileNet Certified<br /> <br /><a href="http://www.marcolombardo.it" target="_blank" rel="nofollow">http://www.marcolombardo.it</a>
Please, explain better. Is it legal to omit mh:? Thanks.
Joined: Aug 26, 2001
Sorry for the delay, Marco !
No, you have to put that prefix there otherwise the parser will not be able to find the USAddress type. The targetNamespace property only indicates in which namespace the newly defined types (PurchaseOrder, USAddress, Book) will be located. Thus, in order to use one of those types (as attribute or element type) you have to tell in which namespace to find it, and this is done by using the namespace prefix.
If you don't include the prefix, the element will be searched for in the default namespace (the one defined by xmlns="") and in this case it is the XML Schema namespace. The parser will not be able to find the USAddress element in the XML Schema namespace.