• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

XML schema (XSD) validation

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Not sure if this is the right board, but here goes.

I have a small XML document, and currently I am validating it be hand.

I have 2 question:
1) would it (in your opionon) be quicker/more efficent to use SAX to validate it?
2)With XML Scheme is there a difference between an element or arrtibute being empty (ie it is optional) and that element having a value which is empty (equal to "")?

Thanks
Gavin
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gavin,

Definitely it would be faster to do this validation using program than doing the same manually.

If an attribute is mandatory then the element has to have that attribute or else it would fail in validation.Even empty attribute would do.

If attribute sex is mandatory for element name.then the following is valid.

<name sex="">rahul</name>



You can find some code example in XML faq for validation.
reply
    Bookmark Topic Watch Topic
  • New Topic