D
D
Dmitry Krapivin2021-02-17 21:11:56
XSD
Dmitry Krapivin, 2021-02-17 21:11:56

How can I specify in the XSD Schema that the element may be missing from the message?

In the XSD schema, you can specify it like this:

<xs:sequence>
              <xs:element name="current_status" type="nsi_current_status" nillable="true"/>
              <xs:element name="status_date" type="xs:dateTime" nillable="true"/>


In an XML message, if there is no element value, for example status_date, then it will be something like this:
<current_status>7897986<current_status/>
<status_date>null<status_date>


Question:
How to XSD designate an element so that if there is no data, then the element would not be sent with an XML message?

Example similar with status_date:
<current_status>7897986<current_status/>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sergey, 2021-02-18
kuzmin @sergueik

Occurrence indicators:
https://www.w3schools.com/xml/schema_complex_indic...
XSD Indicators
maxOccurs
minOccurs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question