I have an xml which has a structure:
<?xml version="1.0" encoding="utf-8" ?>
<XYZInquiry>
<Source>ABC</Source>
<Info>19991234</Info>
<RawData>
<EmailAddress>[email protected]</EmailAddress>
</RawData>
</XYZInquiry>
and corresponding XSD for validation as:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema id="XYZInquiry" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="XYZInquiry">
<xsd:complexType>
<xsd:all>
<xsd:element name="Source" minOccurs="1" maxOccurs="1" type="xsd:string" />
<xsd:element name="Info" minOccurs="1" maxOccurs="1" type="xsd:string" />
<xsd:element name="RawData" minOccurs="0" maxOccurs="1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="EmailAddress" minOccurs="0" maxOccurs="1"/>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
I need to read Info Tag and based on the first 4 digits, I need to put condition on the RawData Tag. i.e. if The Info value starts with 1234, then RawData Tag is allowed else Invalid.
Kindly advise.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…