0

I have recently started with XML and had a question regarding XML schemas. As I understand schemas define a sort of contract that all XML files that implement the schema, will follow.

Take, for example, this schema: http://estar8.energystar.gov/ESES/ABS20/Schemas/ManageMetersResponse.xsd

The root contains three children: txnsID, espUserID and customer. I've read up on schemas and I think I am OK, but I am looking after someone's code and the code calls

root.getAllChildrenByNameOf("customer") 

instead of

root.getChildByNameOf("customer") 

which makes me think that there might be multiple customer elements, while I think the schema defines that only one may exist per document. Any clarifications? Thanks for your time.

jn1kk
  • 5,012
  • 2
  • 45
  • 72
  • related: http://stackoverflow.com/questions/4821477/xml-schema-minoccurs-maxoccurs-default-values – jasso Nov 30 '11 at 16:03

2 Answers2

3

The schema you linked to allows any number of "customer" elements. The relevant portion is this attribute:

maxOccurs="unbounded"

This means the element can repeat any number of times.

Chris
  • 22,923
  • 4
  • 56
  • 50
0

The schema has a maxOccurs of unbounded for the customer node. This means it can occur any number of times

karakuricoder
  • 1,065
  • 8
  • 8