XML schema question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Harakaly

    #1

    XML schema question

    Hi
    I have a problem to express my needs in the XML schema. I need to
    validate an XML configuration file, where I have following XML tags:

    <param name="some_name " value="some_val ue"/>

    But I need to make a check between the name attribute value (some_name)
    and the type(value) of the value attribute. I need to find a way how to
    define the type of the "value" attribute for each value of the "name"
    attribute.

    In other words: I need to express that the attribute "name" can have a
    value from a list of enumerated values ("name1", "name2", ...) but also
    that each name form this list has associated its own type of the value
    attribute.

    In XML it would be:
    ....
    ....
    <param name="name1" value="99"/>
    <!-- value for "name1" is an integer from 0 to 100 -->
    <param name="name2" value="String"/>
    <!-- value for "name2" is a string -->
    ....
    ....


    !!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!
    The:
    <param name="name1" value="101"/>
    or
    <param name="name1" value="Some_nam e"/>

    should generate a validation error.
    !!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!

    I'll appreciate any direction where to look, URL, partial solution from
    which I can learn, etc, to help me to solve this problem.

    Thank you

    Robert Harakaly
Working...