Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

XSD

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Schema definitions...i am trying to define a parent tag which can have one or more children in any sequence...how do i do that using xsd
i.e i want the XSD to be able to accomodate
<parent>
<child1>sdf</child1>
<child2>ddd</child2>
</parent>
OR
<parent>
<child2>abcd</child2>
<child1>sdfadf</child1>
</parent>
i looked at the xsd samples and found the definiton for complex types (xsd:complexType) gives only all,sequence or choice as alternatives and none of them see to cover what i need....can somebody shed some light on this???
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

[ July 02, 2003: Message edited by: Balaji Loganathan ]
 
Satish Gopalakrishnan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The <all> indicator specifies by default that the child elements can appear in any order and that each child element must occur once and only once:
I want one that can appear in any order multiple times
ex
<parent>
<child1>sdf</child1>
<child2>ddd</child2>
<child1>123123sdf</child1>
<child2>2314234ddd</child2>
</parent>
[ July 09, 2003: Message edited by: Satish Gopalakrishnan ]
 
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try this then
 
Satish Gopalakrishnan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this means i can have only one of child1 or child2 existing...i need both of them to co-exist in any order
 
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Satish Gopalakrishnan:
this means i can have only one of child1 or child2 existing...i need both of them to co-exist in any order


Yes you can, try to validate this xml against the above schema

but i don't know why you want to do this ?
 
Satish Gopalakrishnan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it works..sorry...
as to why i am doing this....
i am trying to hold contents of a document in an XML and have defined basic blocks like para,line etc which have to be used in this manner. I know this seems like a poor design but it gives me the maximum flexibility interms of changing the content easily.
 
Yup, yup, yup. Tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!