Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
04-19-2012, 09:35 AM #1
- Join Date
- Apr 2012
- Thanked 0 Times in 0 Posts
Say that I've got the following XML
<document> <block key="block1"> <p>This is a <bold>paragraph</bold></p> </block> <block key="block2"> <p>Additional paragraph</p> </block> </document>
Obviously the schematics of this data and the constraints placed upon them can be described using XSD. For example, the following rules would apply:
* must be a document element as the top-level parent element
* must be at least one block element as a child of document
* each block must have a unique key value
* blocks can have 1...n p child elements.
* p elements can have 0...n bold child elements
* Q: Is the overall XML valid? A: yes / no + report
* Q: I'm looking at the element block (key="block2"). What are the valid child elements of this element? A: p (1...n).
* Q: I'm looking at the element p in the first block (key="block1"). What are the valid child elements of this element? A: #text, bold (0...n).
Determining the valid child elements of a particular element is something akin to how Visual Studio e.g. 2010 uses Intellisense. For example, given a schema Visual Studio let's you know what the valid elements are at a particular position as you type enter the XML.
Finally I've mentioned XSD / XML above but we do not necessarily have to be constrained to these technologies so alternative ideas will be appreciated equally as well.
Thank you for taking the time to examine my post.
04-19-2012, 08:19 PM #2
- Join Date
- Jun 2007
- Thanked 611 Times in 591 Posts