Schema validation of control totals

S

Steve

Hi,

I have xml data containing "line item" elements and a "footer" element
which contains control totals for the line items. While I can easily
validate the control totals in xslt, I have not been able to do it
using a schema, which I need to do.

Example:
<data>
<item><fld1>1</fld2><fld2>2</fld2></item>
<item><fld1>3</fld2><fld2>4</fld2></item>
<item><fld1>5</fld2><fld2>6</fld2></item>
<footer><tot1>10</tot1><tot2>12</tot2></footer>
</data>

Given the above, where tot1 and tot2 are control totals for fld1 and
fld2, the required schema validation should raise an error because
tot1 should be 9, whereas it is actually 10.

Is it possible?

Thanks in advance,
Steve.
 
M

Martin Honnen

Steve said:
Hi,

I have xml data containing "line item" elements and a "footer" element
which contains control totals for the line items. While I can easily
validate the control totals in xslt, I have not been able to do it
using a schema, which I need to do.

Example:
<data>
<item><fld1>1</fld2><fld2>2</fld2></item>

I think you want
<item><fld1>3</fld2><fld2>4</fld2></item>
<item><fld1>5</fld2><fld2>6</fld2></item>
<footer><tot1>10</tot1><tot2>12</tot2></footer>
</data>

Given the above, where tot1 and tot2 are control totals for fld1 and
fld2, the required schema validation should raise an error because
tot1 should be 9, whereas it is actually 10.

Is it possible?

I don't think it is possible with the W3C XML schema language. It should
be possible with other schema languages that allow to specify
constraints with XPath.
 
S

Steve

Thanks Martin - pretty much what I had gathered. Thanks for your assistance.

Steve.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top