Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need to create nested element with name

 
Dan Grindstaff
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am trying to create an xml doc with elements arranged as follows: XML Doc example Notice that the Field elements are nested in Fields and have a name attribute, the product elements I am fine with so I will not address those. I am building an xsd to accomplish getting the Fields right and having some difficulty. This is a piece of the xsd I have that addresses the fields:


...
and to nest within the datafeed:



So far I am able to build the classes from xjc and marshall the xml but I cannot get the Field element to show up nested in the Fields element. I only get one or the other showing up depending on the element in the FeedType section.

Any help is greatly appreciated!
 
g tsuji
Ranch Hand
Posts: 656
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[1] Reason: typo.
<xs:element name="Field" type="Fields" minOccurs="0" maxOccurs="unbounded"/>

It should read:
<xs:element name="Field" type="Field" minOccurs="0" maxOccurs="unbounded"/>

[2] The type Field proper : if you allow text content to Field element (as the original erroneous part seems to suggest, xs:string) even if they don't have in the sample, you can do this.
 
Dan Grindstaff
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic