Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > [XML Schema] Value of a field depending to other fields?

Reply
Thread Tools

[XML Schema] Value of a field depending to other fields?

 
 
xan2@ono.com
Guest
Posts: n/a
 
      05-01-2006
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.

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      05-01-2006


http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:


> 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.


You can't express such constraints with a W3C XML schema. Schematron
might be able to express the constraints.
On the other hand it looks a bit as you are trying to store data in XML
which should not be stored at all but rather computed when it is needed.

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
xan2@ono.com
Guest
Posts: n/a
 
      05-01-2006

Martin Honnen wrote:
> (E-Mail Removed) wrote:
>
>
> > 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.

>
> You can't express such constraints with a W3C XML schema. Schematron
> might be able to express the constraints.


Can you put the code here? Thanks.
And with OWL + XML Schema is it possible to express such constraints?

> On the other hand it looks a bit as you are trying to store data in XML
> which should not be stored at all but rather computed when it is needed.


Why it should not be stored _at all_. Can you explain me?

Thanks,
Xan.
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
26W or 40W sucking (depending on site) AGP4x card in a 175W PSU computer update from the field thanatoid Computer Support 0 10-19-2008 12:30 AM
Copy File Field Value to Dynamic File Field Value VUNETdotUS Javascript 25 11-10-2007 10:36 AM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
Different template depending on a field in the database??? Gigital ASP .Net Building Controls 0 04-02-2004 09:45 AM



Advertisments