X
xan2
Hi,
I just want to know if it's possible to declare a value of a field in
XML Schema depending to other fields.
For example, suppose we have (in pseudo-xml not in xsd) a person who
have this fields:
<person>
<name> .... </name>
<hoursofwork> </hoursofwork>
<salaryperhour> </salaryperhour>
<salarypermonth> <salarypermonth>
<percentofwork> </percentofwork>
</person>
- name is string
- hoursofwork is number of hours person work in a month. So we have
that 0<= hoursofwork <= 744
- salaryperhour is what he/she receives per hour (it could be unsigned
int)
- salarypermonth is only salaryperhour plus hoursofwork
- percent of work is the percent of work a person do respecting to the
total of amount of hours of work of all person of the enterprise
So, we need (in pseudocode) that:
1) salarypermonth = hoursofwork * salaryperhour
2) percentofwork = hoursofwork/(TOTAL WORK), where TOTAL WORK = Sum of
all hoursofwork of all intances of xml file
Is it possible to do it with XML Schemas. I suspect that no, and that
we need some more stronger tool combined with schema (like OWL). Can
you answer me?
Thank you very much,
Xan.
I just want to know if it's possible to declare a value of a field in
XML Schema depending to other fields.
For example, suppose we have (in pseudo-xml not in xsd) a person who
have this fields:
<person>
<name> .... </name>
<hoursofwork> </hoursofwork>
<salaryperhour> </salaryperhour>
<salarypermonth> <salarypermonth>
<percentofwork> </percentofwork>
</person>
- name is string
- hoursofwork is number of hours person work in a month. So we have
that 0<= hoursofwork <= 744
- salaryperhour is what he/she receives per hour (it could be unsigned
int)
- salarypermonth is only salaryperhour plus hoursofwork
- percent of work is the percent of work a person do respecting to the
total of amount of hours of work of all person of the enterprise
So, we need (in pseudocode) that:
1) salarypermonth = hoursofwork * salaryperhour
2) percentofwork = hoursofwork/(TOTAL WORK), where TOTAL WORK = Sum of
all hoursofwork of all intances of xml file
Is it possible to do it with XML Schemas. I suspect that no, and that
we need some more stronger tool combined with schema (like OWL). Can
you answer me?
Thank you very much,
Xan.