Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Doubt on XML Schema validity

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Source: Some snippets are from RMH, assembled with other examples from SOA Using JWS, Ivan's notes.

Note that there are two definitions of USAddress, one defined in this xsd (line 16), other one in imported schema in USAddress2.xsd (line 14)

Consider, PurchaseOrder.xsd.



Here is USAddress2.xsd.



Currently PurchaseOrder.xsd is not valid. Apparently issue is in its line no. 10. It is not able to find USAddress type. However when I change it to



It works. Why is that so, I have already exposed both Address and USAddress as global element types so it should be ok to refer either of them in PurchaseOrder.xsd

 
Kamal Tripathi
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Figured it out later.

Guess it was late night
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, what is it?
 
Kamal Tripathi
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh it was a rookie mistake.

USAddress is the name of the element whereas its type is usIntAddress

type attribute is for global local or complex types. To refer elements ref attribute has to be used.

So it should either be

or
 
When people don’t understand what you are doing they call you crazy. But this tiny ad just doesn't care:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic