U
U
UDAnton2017-06-25 15:15:01
XSD
UDAnton, 2017-06-25 15:15:01

How to make xsd validation for such a piece of xml?

Hello!
You need to do xsd validation on the following xml:

<Info>
<Text key="some_date" value="25.07.2017"/>
<Text key="some_code" value="1111111"/>
<Text key="some_number" value="1111111"/>
</Info>

The bottom line is that in "Info" there can be an arbitrary number. "Text" tags, but if it is not in the attributes: some_date, some_code, some_number, then it is not valid and you also need to put validation on the value attribute (for example, the date format must be passed through a dot). Perhaps it is not entirely clear, I will give an example of what is correct and what is not.
Correct:
1.
<Info>
<Text key="some_date" value="25.07.2017"/>
<Text key="some_code" value="1111111"/>
<Text key="some_number" value="1111111"/>
</Info>

2.
<Info>
<Text key="some_code" value="1111111"/>
<Text key="some_number" value="1111111"/>
<Text key="some_date" value="25.07.2017"/>
</Info>

3.
<Info>
<Text key="some_code" value="1111111"/>
<Text key="some_number" value="1111111"/>
<Text key="some_date2" value="25.07.2017"/>
<Text key="some_date3" value="25.07.2017"/>
<Text key="some_date" value="25.07.2017"/>
</Info>

Not correct:
1.
<Info>
<Text key="some_date" value="25.07.2017"/>
<Text key="some_code" value="1111111"/>
</Info>

2.
<Info>
<Text key="some_date" value="25-07-2017"/>
<Text key="some_code" value="1111111"/>
<Text key="some_number" value="1111111"/>
</Info>

3.
<Info>
<Text key="some_date1" value="25.07.2017"/>
<Text key="some_code1" value="1111111"/>
<Text key="some_number1" value="1111111"/>
</Info>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question