Validate XML against pre-defined .XSD ( Schema )

Hello,

I have a .xml file which I want my bot validate in every run against pre-defined .xsd file for the schema.
Now, I cannot use UiPath Marketplace components hence reaching out to know other ways to do this task.

Appreciate your help.

please share with us

  • sample xml
  • sample xsd

based on this we can help individually

Sample XML:

<SampleXML formID="SDF" formType="R" ID1="12" ID2="999abc" endDate="2018-01-01T00:00:00" Seq="1" ID3="" Name="" Title="" Email="" Date="2018-01-01T00:00:00" xsi:noNamespaceSchemaLocation="Schemas/RDF.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <123>
    <value>Shubham</value>
    <statement>Questions</statement>
  </123>
  <456>
    <value>studio</value>
    <statement>Questions</statement>
  </456>
  <789>
   <value>Tiwari</value>
   <statement>Questions</statement>
  </789>
</SampleXML>

Sample XSD:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="SampleXML">
    <xs:complexType>
      <xs:sequence>      
        <xs:element name="123" type="efRptTo"  minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>Questions</xs:documentation>
            <xs:documentation>Report To</xs:documentation>
          </xs:annotation>        
        </xs:element>
        <xs:element name="456" type="efRptee"  minOccurs="0" maxOccurs="1">
          <xs:annotation>
            <xs:documentation>Questions</xs:documentation>
            <xs:documentation>Reportee</xs:documentation>
          </xs:annotation>       
        </xs:element>

      <xs:attribute name="formID" type="xs:string" use="required"/>
      <xs:attribute name="Type" type="xs:string" use="required"/>
      <xs:attribute name="ID1" type="xs:string" use="required"/>
      <xs:attribute name="ID2" type="xs:string" use="required"/>
   </xs:sequence>
 </xs:complexType>

  <xs:complexType name="efInteger">
  <xs:sequence>
  <xs:element name="value" type="xs:integer"/>
  <xs:element name="statement" type="xs:string"/>
  </xs:sequence>
  </xs:complexType>
  <xs:complexType name="efString">
  <xs:sequence>
  <xs:element name="value" type="xs:string"/>
  <xs:element name="statement" type="xs:string"/>
  </xs:sequence>
  </xs:complexType>    

</xs:schema>

This is not a full XML and Schema, I have replicated similar one FYR. <123>, these type of nodes too many in the XML and similarly in schema.

@ppr Appreciate your quick response :slight_smile:

Hello,

Anyone any suggestions?