I've tried to load dataset columns from a schema with ReadXmlSchema method.
It's working but 0 column loads. And I could not see any problem with the xsd file. Here my xsd file:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns3="http://tempuri.org/Ortak_Tip.xsd" xmlns:ns4="http://tempuri.org/Ortak_Risk.xsd" xmlns:ns5="http://tempuri.org/Ek.xsd" xmlns:t="http://tempuri.org/Form.xsd" targetNamespace="http://tempuri.org/Form.xsd" elementFormDefault="qualified">
<xsd:import namespace="http://tempuri.org/Ortak_Tip.xsd" schemaLocation="http://tempuri.org/Ortak_Tip.xsd"/>
<xsd:import namespace="http://tempuri.org/Ortak_Risk.xsd" schemaLocation="http://tempuri.org/Ortak_Risk.xsd"/>
<xsd:import namespace="http://tempuri.org/Ek.xsd" schemaLocation="http://tempuri.org/Ek.xsd"/>
<xsd:element name="Form">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="Veri">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="Satir" maxOccurs="unbounded">
<xsd:complexType>
<xsd:complexContent>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:element name="SiraNo" type="ns3:Sayi15"/>
<xsd:element name="KrediIslemHesapNo" type="ns4:Karakter60"/>
<xsd:element name="MusteriNo" type="ns5:Karakter25"/>
<xsd:element name="VergiNo" type="ns4:Sayi11" nillable="true"/>
<xsd:element name="Adi" type="ns3:Karakter255"/>
<xsd:element name="UlkeKodu" type="ns3:UlkeKodu"/>
<xsd:element name="IslemTuru" type="xsd:boolean"/>
<xsd:element name="TarafKodu" type="ns3:IslemTarafKodu"/>
<xsd:element name="MusteriRiskSinif" type="ns4:MusterininRiskSinifi2"/>
<xsd:element name="IslemTutarAnaparaTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:element name="IslemTutarFaizTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:element name="IslemTutarToplamTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:element name="IslemOrijinalParaKodu" type="ns3:ParaKodu2"/>
<xsd:element name="ParaKoduEndeks" type="ns3:ParaKoduEndeks" nillable="true"/>
<xsd:element name="MKIhracciUnvan" type="ns3:Karakter255"/>
<xsd:element name="MKISINKodu" type="ns3:Karakter12"/>
<xsd:element name="PiyasaFiyatTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:element name="MKParaKodu" type="ns3:ParaKodu2"/>
<xsd:element name="MKVade" type="xsd:date" nillable="true"/>
<xsd:element name="IslemVade" type="xsd:date"/>
<xsd:element name="Portfoy" type="ns4:Portfoy2"/>
<xsd:element name="BilancoDeger" type="ns5:Yuzde14_2"/>
<xsd:element name="NominalDeger" type="ns5:Yuzde14_2"/>
<xsd:element name="AlacakVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:element name="KurVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:element name="TeminatVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:element name="KarsiTarafRiskAgirlik" type="ns3:Sayi4" nillable="true"/>
<xsd:element name="TeminatRiskAgirlik" type="ns3:Sayi4" nillable="true"/>
<xsd:element name="RAV" type="ns5:Yuzde14_2" nillable="true"/>
<xsd:element name="IslemTHPKodu" type="ns3:Karakter8"/>
<xsd:element name="MKTHPKodu" type="ns3:Karakter8" nillable="true"/>
<xsd:element name="MKSinif" type="ns4:MKIslemSinif"/>
<xsd:element name="IslemSinif" type="ns4:MKIslemSinif"/>
<xsd:element name="EmanetDurumu" type="ns3:Karakter255"/>
<xsd:element name="IlaveTeminat" type="xsd:boolean"/>
<xsd:element name="KRATSonraRAV" type="ns5:Yuzde14_2" nillable="true"/>
<xsd:element name="KarsiTarafDerecelendirmeNotu1" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="KarsiTarafDerecelendirmeNotu2" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="KarsiTarafDerecelendirmeNotu3" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="KarsiTarafDerecelendirmeNotu4" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="MKDerecelendirmeNotu1" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="MKDerecelendirmeNotu2" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="MKDerecelendirmeNotu3" type="ns5:Karakter25" nillable="true"/>
<xsd:element name="MKDerecelendirmeNotu4" type="ns5:Karakter25" nillable="true"/>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Gun" type="ns4:Gun" use="required" fixed="1"/>
<xsd:attribute name="Ay" type="ns4:Ay" use="required"/>
<xsd:attribute name="Yil" type="ns3:Sayi4" use="required"/>
<xsd:attribute name="FormKodu" type="ns3:Karakter7" use="required" fixed="RT100AS"/>
<xsd:attribute name="KurulusKodu" type="ns5:Sayi3" use="required"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Could someone please tell me where I'm wrong?
It's working...
That's not believable.
...but 0 column loads.
Now that is believable.
An immediately obvious problem is that the URLs given by the schemaLocations in the xsd:imports of your XSD redirect to www.bing.com. Before anything else, you'll have to resolve this problem.
xsd namespace doesn't like nested tags. Also you need a single root element. Made changes to get xml to read. Not sure if it is what you really need.
code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace ConsoleApplication1
{
class Program
{
const string FILENAME = #"c:\temp\test.xml";
static void Main(string[] args)
{
DataSet ds = new DataSet();
ds.ReadXml(FILENAME, XmlReadMode.ReadSchema);
}
}
}
xml
<?xml version="1.0" encoding="utf-8" ?>
<Root xsd:schema="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001" xmlns:ns3="http://tempuri.org/Ortak_Tip.xsd" xmlns:ns4="http://tempuri.org/Ortak_Risk.xsd" xmlns:ns5="http://tempuri.org/Ek.xsd" xmlns:t="http://tempuri.org/Form.xsd" targetNamespace="http://tempuri.org/Form.xsd" elementFormDefault="qualified">
<xsd:import namespace="http://tempuri.org/Ortak_Tip.xsd" schemaLocation="http://tempuri.org/Ortak_Tip.xsd"/>
<xsd:import namespace="http://tempuri.org/Ortak_Risk.xsd" schemaLocation="http://tempuri.org/Ortak_Risk.xsd"/>
<xsd:import namespace="http://tempuri.org/Ek.xsd" schemaLocation="http://tempuri.org/Ek.xsd"/>
<xsd:element name="Form">
<xsd:complex>
<xsd:complexSequence>
<xsd:restriction base="xsd:anyType">
<xsd:sequence>
<xsd:elementSequence name="Veri">
<xsd:complexContent>
<xsd:complexType>
<xsd:restrictionType base="xsd:anyType">
<xsd:sequenceType>
<xsd:table name="Satir" maxOccurs="unbounded">
<xsd:elementAttribute>
<xsd:complexAttribute>
<xsd:restrictionAttribute base="xsd:anyType">
<xsd:sequenceAttribute>
<xsd:attribute name="SiraNo" type="ns3:Sayi15"/>
<xsd:attribute name="KrediIslemHesapNo" type="ns4:Karakter60"/>
<xsd:attribute name="MusteriNo" type="ns5:Karakter25"/>
<xsd:attribute name="VergiNo" type="ns4:Sayi11" nillable="true"/>
<xsd:attribute name="Adi" type="ns3:Karakter255"/>
<xsd:attribute name="UlkeKodu" type="ns3:UlkeKodu"/>
<xsd:attribute name="IslemTuru" type="xsd:boolean"/>
<xsd:attribute name="TarafKodu" type="ns3:IslemTarafKodu"/>
<xsd:attribute name="MusteriRiskSinif" type="ns4:MusterininRiskSinifi2"/>
<xsd:attribute name="IslemTutarAnaparaTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:attribute name="IslemTutarFaizTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:attribute name="IslemTutarToplamTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:attribute name="IslemOrijinalParaKodu" type="ns3:ParaKodu2"/>
<xsd:attribute name="ParaKoduEndeks" type="ns3:ParaKoduEndeks" nillable="true"/>
<xsd:attribute name="MKIhracciUnvan" type="ns3:Karakter255"/>
<xsd:attribute name="MKISINKodu" type="ns3:Karakter12"/>
<xsd:attribute name="PiyasaFiyatTLKarsilik" type="ns5:Yuzde14_2"/>
<xsd:attribute name="MKParaKodu" type="ns3:ParaKodu2"/>
<xsd:attribute name="MKVade" type="xsd:date" nillable="true"/>
<xsd:attribute name="IslemVade" type="xsd:date"/>
<xsd:attribute name="Portfoy" type="ns4:Portfoy2"/>
<xsd:attribute name="BilancoDeger" type="ns5:Yuzde14_2"/>
<xsd:attribute name="NominalDeger" type="ns5:Yuzde14_2"/>
<xsd:attribute name="AlacakVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:attribute name="KurVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:attribute name="TeminatVolAyarKatsayi" type="ns4:Yuzde5_3" nillable="true"/>
<xsd:attribute name="KarsiTarafRiskAgirlik" type="ns3:Sayi4" nillable="true"/>
<xsd:attribute name="TeminatRiskAgirlik" type="ns3:Sayi4" nillable="true"/>
<xsd:attribute name="RAV" type="ns5:Yuzde14_2" nillable="true"/>
<xsd:attribute name="IslemTHPKodu" type="ns3:Karakter8"/>
<xsd:attribute name="MKTHPKodu" type="ns3:Karakter8" nillable="true"/>
<xsd:attribute name="MKSinif" type="ns4:MKIslemSinif"/>
<xsd:attribute name="IslemSinif" type="ns4:MKIslemSinif"/>
<xsd:attribute name="EmanetDurumu" type="ns3:Karakter255"/>
<xsd:attribute name="IlaveTeminat" type="xsd:boolean"/>
<xsd:attribute name="KRATSonraRAV" type="ns5:Yuzde14_2" nillable="true"/>
<xsd:attribute name="KarsiTarafDerecelendirmeNotu1" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="KarsiTarafDerecelendirmeNotu2" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="KarsiTarafDerecelendirmeNotu3" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="KarsiTarafDerecelendirmeNotu4" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="MKDerecelendirmeNotu1" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="MKDerecelendirmeNotu2" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="MKDerecelendirmeNotu3" type="ns5:Karakter25" nillable="true"/>
<xsd:attribute name="MKDerecelendirmeNotu4" type="ns5:Karakter25" nillable="true"/>
</xsd:sequenceAttribute>
</xsd:restrictionAttribute>
</xsd:complexAttribute>
</xsd:elementAttribute>
</xsd:table>
</xsd:sequenceType>
</xsd:restrictionType>
</xsd:complexType>
</xsd:complexContent>
</xsd:elementSequence>
</xsd:sequence>
<xsd:attribute name="Gun" type="ns4:Gun" use="required" fixed="1"/>
<xsd:attribute name="Ay" type="ns4:Ay" use="required"/>
<xsd:attribute name="Yil" type="ns3:Sayi4" use="required"/>
<xsd:attribute name="FormKodu" type="ns3:Karakter7" use="required" fixed="RT100AS"/>
<xsd:attribute name="KurulusKodu" type="ns5:Sayi3" use="required"/>
</xsd:restriction>
</xsd:complexSequence>
</xsd:complex>
</xsd:element>
<!--</xsd:schema>-->
</Root>
Related
I need to obtain values from c# resx file using powershell script.Is it possible to obtain these xml values using only PS scripting?I wrote a code only in PS but it didn't work.Snippets would help!!
Using ResXResourceSet Class:
$File = 'c:\path\to\file.resx'
# Add assembly containing class, not sure if needed, but wouldn't hurt
Add-Type -AssemblyName System.Windows.Forms
# Create new ResXResourceSet, pass path to the resx file to the constructor
$ResourceSet = New-Object -TypeName 'System.Resources.ResXResourceSet' -ArgumentList $File
# Get resources
$ResourceSet.GetString('TestString')
$ResourceSet.GetString('AnotherTestString')
ResX example:
<?xml version="1.0" encoding="utf-8"?>
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="TestString" xml:space="preserve">
<value>This is some test string...</value>
</data>
<data name="AnotherTestString" xml:space="preserve">
<value>Another test string...</value>
</data>
</root>
Output:
This is some test string...
Another test string...
P.S.
ResX files are XML, so you can get values from them using XPath or other methods.
References:
How to clean up resx files with PowerShell
I'm trying to figure out how to consume a SAP webservice. I have a .WSDL file which looks for certain info in SAP.
My .WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="Customer_Out" targetNamespace="..." xmlns:p1="...." xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:documentation/>
<wsp:UsingPolicy wsdl:required="true"/>
<wsp:Policy wsu:Id="OP_CustomerRead_sync"/>
<wsdl:types>
<xsd:schema targetNamespace="..." xmlns="..." xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="MT_CustomerRead_response" type="DT_CustomerRead_response"/>
<xsd:element name="FMT_Customer">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="standard" type="ExchangeFaultData"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="MT_CustomerRead_request" type="DT_CustomerRead_request"/>
<xsd:complexType name="ExchangeFaultData">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">..</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="faultText" type="xsd:string"/>
<xsd:element name="faultUrl" type="xsd:string" minOccurs="0"/>
<xsd:element name="faultDetail" type="ExchangeLogData" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DT_Customer">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">...</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="BpId" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Name" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="AccountGroup" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Street" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Number" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="City" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Country" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Region" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DT_CustomerRead_request">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">...</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="RowLimit" type="xsd:integer"/>
<xsd:element name="BpId" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="Name" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ExternalCustomer" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="AccountGroup" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ExchangeLogData">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">...</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="severity" type="xsd:string" minOccurs="0"/>
<xsd:element name="text" type="xsd:string"/>
<xsd:element name="url" type="xsd:string" minOccurs="0"/>
<xsd:element name="id" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="DT_CustomerRead_response">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/VersionID">...</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Customer" type="DT_Customer" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">...</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Remark" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="MT_CustomerRead_request">
<wsdl:documentation/>
<wsdl:part name="MT_CustomerRead_request" element="p1:MT_CustomerRead_request"/>
</wsdl:message>
<wsdl:message name="MT_CustomerRead_response">
<wsdl:documentation/>
<wsdl:part name="MT_CustomerRead_response" element="p1:MT_CustomerRead_response"/>
</wsdl:message>
<wsdl:message name="FMT_Customer">
<wsdl:documentation/>
<wsdl:part name="FMT_Customer" element="p1:FMT_Customer"/>
</wsdl:message>
<wsdl:portType name="Customer_Out">
<wsdl:documentation/>
<wsdl:operation name="CustomerRead_sync">
<wsdl:documentation/>
<wsp:Policy>
<wsp:PolicyReference URI="#OP_CustomerRead_sync"/>
</wsp:Policy>
<wsdl:input message="p1:MT_CustomerRead_request"/>
<wsdl:output message="p1:MT_CustomerRead_response"/>
<wsdl:fault name="FMT_Customer" message="p1:FMT_Customer"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Customer_OutBinding" type="p1:Customer_Out">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
<wsdl:operation name="CustomerRead_sync">
<soap:operation soapAction="http://sap.com/xi/WebService/soap1.1" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
<wsdl:input>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</wsdl:output>
<wsdl:fault name="FMT_Customer">
<soap:fault use="literal" name="FMT_Customer" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Customer_OutService">
<wsdl:port name="HTTP_Port" binding="p1:Customer_OutBinding">
<soap:address location="..." xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I've added a Service Reference to my .NET project which references the .WSDL file. This creates a namespace which allows me to make an instance of a couple of classes (9 in total).
I can't seem to find how to pass the request and receive the corresponding response. Should I parse these requests/responses? I'm aware of this tutorial but it doesn't really correspond with the file which I'm dealing with.
A request looks like this:
<man:MT_CustomerRead_request>
<RowLimit>100</RowLimit>
<!--Optional:-->
<!-- <CustomerId>?
<!--Optional:-->
<Name>Dell*</Name>
<!--Optional:-->
<!--Optional:-->
<AccountGroup>ABC</AccountGroup>
</man:MT_CustomerRead_request>
Thanks in advance
I'm just working on this topic and here's an example on how to create a request and call the SAP service in .NET (C#).
// Create the client
SapServiceReference.ECC_WS sapService = new SapServiceReference.ECC_WS();
sapService.Credentials = new NetworkCredential("Account", "Password");
// Prepare the parameters
SapServiceReference._parameters param = new SapServiceReference._parameters();
param.id = 1;
param.action = "R";
// Call SAP service
SapServiceReference._ws_Response response = sapService._someFunction(param);
string result = response.EvDescriptionText.Tdline;
For an XSD document such as this, say I was to create a C# class using some tool like xsd.exe or xsd2code, How do I define the namespace each class belongs to? Or do they all belong to only one namespace?
?xml version="1.0" encoding="UTF-8"?><xsd:schema targetNamespace="http://com.ibm.wbit.comptest.controller"
xmlns:Q1="http://com.ibm.wbit.comptest.controller" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="TestResults">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="testSuites" type="Q1:TestSuiteRun"/>
</xsd:sequence>
<xsd:attribute name="testProject" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="TestSuiteRun">
<xsd:complexContent>
<xsd:extension base="Q1:TestRun">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="testCases" type="Q1:TestCaseRun">
</xsd:element>
</xsd:sequence>
<xsd:attribute name="tests" type="xsd:int"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="TestCaseRun">
<xsd:complexContent>
<xsd:extension base="Q1:TestRun">
<xsd:sequence>
<xsd:element name="result" type="Q1:Severity"/>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="variations" type="Q1:VariationRun">
</xsd:element>
</xsd:sequence>
<xsd:attribute name="variationCount" type="xsd:int"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="VariationRun">
<xsd:complexContent>
<xsd:extension base="Q1:TestRun">
<xsd:sequence>
<xsd:element name="result" type="Q1:Severity"/>
<xsd:element name="exception" nillable="true" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
This element is used to display the exception of a failure or error.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:simpleType name="Severity">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="pass"/>
<xsd:enumeration value="fail"/>
<xsd:enumeration value="error"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="TestRun">
<xsd:attribute name="name" type="xsd:string"/>
<xsd:attribute name="startTime" type="xsd:dateTime"/>
<xsd:attribute name="endTime" type="xsd:dateTime"/>
<xsd:attribute name="result" type="xsd:string"/>
</xsd:complexType>
</xsd:schema>
I tried to run Visual Studio's XSD.EXE utility on the zillow "SearchResults.xsd" to generate c# or vb.net classes but am having no luck and am looking for help. I keep getting errors (see below). Here is the original file I downloaded from http://www.zillow.com/howto/api/GetDeepSearchResults.htm:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema attributeFormDefault="unqualified"
elementFormDefault="unqualified"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.zillow.com/static/xsd/SearchResults.xsd"
xmlns:ZillowTypes="http://www.zillow.com/static/xsd/ZillowTypes.xsd">
<xsd:import namespace="http://www.zillow.com/static/xsd/ZillowTypes.xsd"
schemaLocation="/vstatic/4/static/xsd/ZillowTypes.xsd" />
<xsd:element name="searchresults">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="request">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="address" type="xsd:string" />
<xsd:element name="citystatezip" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="message" type="ZillowTypes:Message" />
<xsd:element minOccurs="0" name="response">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="results">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="unbounded" name="result" type="ZillowTypes:SimpleProperty" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Here are the errors I keep getting when I try XSD.EXE from Visual Studio 2010:
C:\Users\username\Documents>xsd /classes SearchResults.xsd
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: Type 'http://www.zillow.com/static/xsd/ZillowTypes.xsd:Message' is not declared. Line 25, position 6.
Schema validation warning: Type 'http://www.zillow.com/static/xsd/ZillowTypes.xsd:SimpleProperty' is not declared. Line 33, position 12.
Warning: Schema could not be validated. Class generation may fail or may produce
incorrect results.
Error: Error generating classes for schema 'SearchResults'.
- The datatype 'http://www.zillow.com/static/xsd/ZillowTypes.xsd:Message' is missing.
It looks like everything is defined in the ZillowTypes.xsd so I am stumped.
There are a couple of problems with the setup. Starting from the location of the XSD file, which is supposed to be at http://www.zillow.com/static/xsd/SearchResults.xsd
The above XSD is referencing another xsd using an import with a relative uri /vstatic/4/static/xsd/ZillowTypes.xsd which resolves to http://www.zillow.com/vstatic/4/static/xsd/ZillowTypes.xsd - but this URL is not dereferenceable (404)!!
If instead you try http://www.zillow.com/static/xsd/ZillowTypes.xsd then you found part 2 of your puzzle, which is ZillowTypes.xsd.
Because of these errors, you need to download both XSD files to your local machine to fix them.
Download first as SearchResults.xsd and second as ZillowTypes.xsd; put them in the same folder.
Edit SearchResults.xsd by changing the line below:
<xsd:import namespace="http://www.zillow.com/static/xsd/ZillowTypes.xsd" schemaLocation="/vstatic/4/static/xsd/ZillowTypes.xsd" />
to:
<xsd:import namespace="http://www.zillow.com/static/xsd/ZillowTypes.xsd" schemaLocation="ZillowTypes.xsd" />
Then you run into another problem. ZillowTypes.xsd contains an invalid element declaration! So edit the decl below:
<xsd:complexType name="investmentBuyingBlock">
<xsd:sequence>
<xsd:element name="buying" minOccurs="0" maxOccurs="unbounded">
<xsd:sequence>
<xsd:element name="year" type="xsd:integer"/>
<xsd:element name="rentalIncome" type="xsd:integer"/>
<xsd:element name="otherIncome" type="xsd:integer"/>
<xsd:element name="mortgagePayment" type="xsd:integer"/>
<xsd:element name="principal" type="xsd:integer"/>
<xsd:element name="interest" type="xsd:integer"/>
<xsd:element name="hoaFees" type="xsd:integer"/>
<xsd:element name="propertyTaxes" type="xsd:integer"/>
<xsd:element name="utilities" type="xsd:integer"/>
<xsd:element name="renovations" type="xsd:integer"/>
<xsd:element name="maintainCosts" type="xsd:integer"/>
<xsd:element name="homeOwnerInsurance" type="xsd:integer"/>
<xsd:element name="managementFees" type="xsd:integer"/>
<xsd:element name="advertisingCosts" type="xsd:integer"/>
<xsd:element name="otherExpenses" type="xsd:integer"/>
<xsd:element name="totalExpenses" type="xsd:integer"/>
<xsd:element name="opportunityCostInitial" type="xsd:integer"/>
<xsd:element name="opportunityCostYearly" type="xsd:integer"/>
<xsd:element name="depreciationBuilding" type="xsd:integer"/>
<xsd:element name="depreciationrenovation" type="xsd:integer"/>
<xsd:element name="totalBenefit" type="xsd:integer"/>
<xsd:element name="totalProfitLoss" type="xsd:integer"/>
</xsd:sequence>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
To:
<xsd:complexType name="investmentBuyingBlock">
<xsd:sequence>
<xsd:element name="buying" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="year" type="xsd:integer"/>
<xsd:element name="rentalIncome" type="xsd:integer"/>
<xsd:element name="otherIncome" type="xsd:integer"/>
<xsd:element name="mortgagePayment" type="xsd:integer"/>
<xsd:element name="principal" type="xsd:integer"/>
<xsd:element name="interest" type="xsd:integer"/>
<xsd:element name="hoaFees" type="xsd:integer"/>
<xsd:element name="propertyTaxes" type="xsd:integer"/>
<xsd:element name="utilities" type="xsd:integer"/>
<xsd:element name="renovations" type="xsd:integer"/>
<xsd:element name="maintainCosts" type="xsd:integer"/>
<xsd:element name="homeOwnerInsurance" type="xsd:integer"/>
<xsd:element name="managementFees" type="xsd:integer"/>
<xsd:element name="advertisingCosts" type="xsd:integer"/>
<xsd:element name="otherExpenses" type="xsd:integer"/>
<xsd:element name="totalExpenses" type="xsd:integer"/>
<xsd:element name="opportunityCostInitial" type="xsd:integer"/>
<xsd:element name="opportunityCostYearly" type="xsd:integer"/>
<xsd:element name="depreciationBuilding" type="xsd:integer"/>
<xsd:element name="depreciationrenovation" type="xsd:integer"/>
<xsd:element name="totalBenefit" type="xsd:integer"/>
<xsd:element name="totalProfitLoss" type="xsd:integer"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
The re-run you XSD command line by replacing
SearchResults.xml
with
SearchResults.xsd ZillowTypes.xsd
It should work (at least the XSDs are valid now).
I'm validating XML against XSD in Windows Forms using C# .NET and it's giving me the error "Please Suggest the fix"
Here is my code
namespace XMLValidation
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
// Validation Error Count
static int ErrorsCount = 0;
// Validation Error Message
static string ErrorMessage = "";
public static void ValidationHandler(object sender,
ValidationEventArgs args)
{
ErrorMessage = ErrorMessage + args.Message + "\r\n";
ErrorsCount++;
}
private void button1_Click(object sender, EventArgs e)
{
XDocument doc1 = XDocument.Load("C:\\Hit.xml");
Validate(doc1.ToString());
}
public void Validate(string strXMLDoc)
{
try
{
// Declare local objects
XmlTextReader tr = null;
XmlSchemaCollection xsc = null;
XmlValidatingReader vr = null;
// Text reader object
tr = new XmlTextReader("C:\\ScreeningReport.xsd");
xsc = new XmlSchemaCollection();
xsc.Add(null, tr);
// XML validator object
vr = new XmlValidatingReader(strXMLDoc,
XmlNodeType.Document, null);
vr.Schemas.Add(xsc);
// Add validation event handler
vr.ValidationType = ValidationType.Schema;
vr.ValidationEventHandler +=
new ValidationEventHandler(ValidationHandler);
// Validate XML data
while (vr.Read()) ;
vr.Close();
// Raise exception, if XML validation fails
if (ErrorsCount > 0)
{
throw new Exception(ErrorMessage);
}
// XML Validation succeeded
MessageBox.Show("XML validation succeeded.\r\n");
}
catch (Exception error)
{
// XML Validation failed
MessageBox.Show("XML validation failed." + "\r\n" +
"Error Message: " + error.Message);
}
}
}
}
My XML file
<ScreeningReport xmlns="http://www.sterlingtesting.com/hrxml/1.0">
<DocumentIDGroup>
<DocumentID schemeID="CorrelationID" schemeAgencyID="TRACKER">5500209_1</DocumentID>
</DocumentIDGroup>
<ScreeningPackageResult>
<ScreeningSubjectPersonDetails>
<PersonLegalID schemeAgencyName="" schemeAgencyID="AG" schemeName="SSN" schemeID="">346455645</PersonLegalID>
<PersonName>
<GivenName>Testfn</GivenName>
<FamilyName>Testln</FamilyName>
</PersonName>
<BirthDateDetails>
<YearMonthDate>1980-01-01</YearMonthDate>
</BirthDateDetails>
</ScreeningSubjectPersonDetails>
<ScreeningUserDetails>
<UserID>CRIMT</UserID>
</ScreeningUserDetails>
<ScreeningResult>
<IDGroup>
<ID schemeID="CorrelationID" schemeAgencyID="TRACKER">5500209_1</ID>
<ID schemeID="OrderID" schemeAgencyID="TRACKER">5500209</ID>
<ID schemeID="ScreeningID" schemeAgencyID="TRACKER">5911635</ID>
</IDGroup>
<ScreeningStatusDetails>
<ScreeningOrderStatusCode>Hit</ScreeningOrderStatusCode>
<Score>ExactMatch</Score>
</ScreeningStatusDetails>
<Ordered>true</Ordered>
<Count>1</Count>
<CriminalReport>
<CriminalCase>
<IDGroup>
<ID schemeID="Case" schemeAgencyID="AG">57675</ID>
</IDGroup>
<JurisdictionType>County</JurisdictionType>
<CountryCode>US</CountryCode>
<CountrySubdivisionCode>AK</CountrySubdivisionCode>
<CountyName>DENALI</CountyName>
<ScreeningSubjectPersonDetails>
<PersonLegalID schemeAgencyID="AG" schemeName="SSN">346455645</PersonLegalID>
<PersonName>
<GivenName>Testfn</GivenName>
<FamilyName>Testln</FamilyName>
</PersonName>
<BirthDateDetails>
<YearMonthDate>1980-01-01</YearMonthDate>
</BirthDateDetails>
</ScreeningSubjectPersonDetails>
<Charge>
<IDGroup>
<ID schemeID="Charge" schemeAgencyID="AG">7546</ID>
<ID schemeID="ConvictedOffenseCode" schemeAgencyID="AG" />
<ID schemeID="StatuteNumber" schemeAgencyID="AG" />
</IDGroup>
<ChargeOrComplaint>test charge</ChargeOrComplaint>
<Disposition>disp1</Disposition>
<AdditionalItems qualifier="Parsed">
<UserArea>
<ChargeInfo>
<ChargeType>Conviction</ChargeType>
<ChargeLevel>Felony</ChargeLevel>
<Sentences />
</ChargeInfo>
<SterlingFields>
<Field name="Convicted Offense Description">test charge</Field>
</SterlingFields>
</UserArea>
</AdditionalItems>
<AdditionalItems qualifier="ParsedSentence">
<UserArea>
<SterlingFields>
<Field name="Enhanced Firearm Penalty">test charge</Field>
</SterlingFields>
</UserArea>
</AdditionalItems>
<AdditionalItems qualifier="ParsedCharge">
<UserArea>
<SterlingFields>
<Field name="ChargeCHARGE_LEVEL_ID">Felony</Field>
</SterlingFields>
</UserArea>
</AdditionalItems>
</Charge>
<AdditionalItems qualifier="Parsed">
<UserArea>
<CaseInfo>
<CaseArrestDate>
<YearMonthDate>2011-02-08</YearMonthDate>
</CaseArrestDate>
<CaseDispositionDate>
<YearMonthDate>2011-02-02</YearMonthDate>
</CaseDispositionDate>
<CaseStatus>Closed Case</CaseStatus>
<ReportingDecision>DO_NOT_REPORT</ReportingDecision>
<Sentences>
<Sentence>
<Type>Costs</Type>
<Suspended>false</Suspended>
<FineAmount>123</FineAmount>
<OtherInfo>suspended fine=123</OtherInfo>
</Sentence>
</Sentences>
<CaseType>Conviction</CaseType>
<CaseLevel>Felony</CaseLevel>
</CaseInfo>
</UserArea>
</AdditionalItems>
<AdditionalItems qualifier="ParsedCriminalCase">
<UserArea>
<SterlingFields>
<Field name="CriminalCaseAdditionalInfo">additional ionfo text</Field>
<Field name="CriminalCaseGovernmentID">346455645</Field>
<Field name="CriminalCaseReportDecision">DO NOT REPORT</Field>
<Field name="CriminalCasePossibleRecord">false</Field>
</SterlingFields>
</UserArea>
</AdditionalItems>
</CriminalCase>
</CriminalReport>
<AdditionalItems qualifier="FulfillmentType">
<UserArea>
<Text>MANUAL</Text>
</UserArea>
</AdditionalItems>
<AdditionalItems qualifier="ResearcherType">
<UserArea>
<Text>Internal</Text>
</UserArea>
</AdditionalItems>
<AdditionalItems qualifier="TrackerUserId">
<UserArea>
<Text>ed</Text>
</UserArea>
</AdditionalItems>
</ScreeningResult>
</ScreeningPackageResult>
</ScreeningReport>
My XSD
<xsd:schema xmlns="http://www.sterlingtesting.com/hrxml/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.sterlingtesting.com/hrxml/1.0" elementFormDefault="qualified" attributeFormDefault="unqualified">
<!-- top level screening result definition -->
<xsd:element name="ScreeningReport" type="ScreeningReportType"/>
<xsd:complexType name="ScreeningReportType">
<xsd:sequence>
<xsd:element name="DocumentIDGroup" type="DocumentIDGroupType"/>
<xsd:element name="ScreeningPackageResult" type="ScreeningPackageResultType"/>
<xsd:element name="ScreeningException" type="ScreeningExceptionType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- document ID according to the new hrxml/oagis specifications -->
<xsd:complexType name="DocumentIDGroupType">
<xsd:sequence>
<xsd:element name="DocumentID" type="DocumentIDType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- single document id specification, according to the hrxml/oagis specification -->
<xsd:complexType name="DocumentIDType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="schemeAgencyID" type="xsd:string" use="required"/>
<xsd:attribute name="schemeID" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<!--
top level package container for screenings
(or batch in IFN terminology)
-->
<xsd:complexType name="ScreeningPackageResultType">
<xsd:sequence>
<xsd:element name="ScreeningSubjectPersonDetails" type="ScreeningSubjectPersonDetailsType" minOccurs="0"/>
<xsd:element name="ScreeningUserDetails" type="ScreeningUserDetailsType" minOccurs="0"/>
<xsd:element name="CompletionDate" type="CompletionDateType" minOccurs="0"/>
<xsd:element name="ScreeningOptionCode" type="ScreeningOptionCodeType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ScreeningResult" type="ScreeningResultType" maxOccurs="unbounded"/>
<xsd:element name="ScreeningException" type="ScreeningExceptionType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- optional codes to tweak the screening request -->
<xsd:complexType name="ScreeningOptionCodeType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<!-- details for the screening client -->
<xsd:complexType name="ScreeningUserDetailsType">
<xsd:sequence>
<xsd:element name="UserID" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the completion date -->
<xsd:complexType name="CompletionDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- the individual screening (or result in IFN terminology) -->
<xsd:complexType name="ScreeningResultType">
<xsd:sequence>
<xsd:element name="IDGroup" type="IDGroupType"/>
<xsd:element name="ScreeningException" type="ScreeningExceptionType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ScreeningStatusDetails" type="ScreeningStatusDetailsType" minOccurs="0"/>
<xsd:element name="Ordered" type="xsd:boolean" minOccurs="0"/>
<xsd:element name="Count" type="xsd:int" minOccurs="0"/>
<xsd:choice minOccurs="0">
<xsd:element name="CriminalReport" type="CriminalReportType"/>
<xsd:element name="SanctionReport" type="SanctionReportType"/>
</xsd:choice>
<xsd:element name="AdditionalItems" type="AdditionalItemsType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- sanction report -->
<xsd:complexType name="SanctionReportType">
<xsd:sequence>
<xsd:element name="SubjectConfirmationMethodCode" type="xsd:string" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- an exception on the individual result -->
<xsd:complexType name="ScreeningExceptionType">
<xsd:sequence>
<xsd:element name="ExceptionIdentifier" type="xsd:string"/>
<xsd:element name="ExceptionSeverity" type="xsd:string"/>
<xsd:element name="ExceptionMessage" type="xsd:string"/>
<xsd:element name="ExceptionPath" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!-- status type -->
<xsd:complexType name="ScreeningStatusDetailsType">
<xsd:sequence>
<xsd:element name="ScreeningOrderStatusCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="ScreeningResultCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="Score" type="xsd:string" minOccurs="0"/>
<xsd:element name="StatusDate" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!-- grouping of IDs according to the new hrxml/oagis specifications -->
<xsd:complexType name="IDGroupType">
<xsd:sequence>
<xsd:element name="ID" type="IDType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- single id specification, according to the hrxml/oagis specification -->
<xsd:complexType name="IDType">
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="schemeAgencyID" type="xsd:string" use="required"/>
<xsd:attribute name="schemeID" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<!-- criminal report type definition -->
<xsd:complexType name="CriminalReportType">
<xsd:sequence>
<xsd:element name="CriminalCase" type="CriminalCaseType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CriminalCaseType">
<xsd:sequence>
<xsd:element name="IDGroup" type="IDGroupType"/>
<xsd:element name="ArrestingAgency" type="xsd:string" minOccurs="0"/>
<xsd:element name="JurisdictionType" type="JurisdictionTypeEnumType"/>
<xsd:element name="CourtName" type="xsd:string" minOccurs="0"/>
<xsd:element name="CourtType" type="xsd:string" minOccurs="0"/>
<xsd:element name="CourtJurisdiction" type="xsd:string" minOccurs="0"/>
<xsd:element name="CountryCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="CountrySubdivisionCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="CountyName" type="xsd:string" minOccurs="0"/>
<xsd:element name="CityName" type="xsd:string" minOccurs="0"/>
<xsd:element name="ChargeTypeClassification" type="xsd:string"/>
<xsd:element name="CaseFileDate" type="CaseFileDateType" minOccurs="0"/>
<xsd:element name="SubjectConfirmation" type="SubjectConfirmationType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="ScreeningSubjectPersonDetails" type="ScreeningSubjectPersonDetailsType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="Charge" type="ChargeType" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="AdditionalItems" type="AdditionalItemsType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the Subject Confirmation -->
<xsd:complexType name="SubjectConfirmationType">
<xsd:sequence>
<xsd:element name="ConfirmByFamilyName" type="xsd:string" minOccurs="0"/>
<xsd:element name="ConfirmByGivenName" type="xsd:string" minOccurs="0"/>
<xsd:element name="ConfirmByMiddleName" type="xsd:string" minOccurs="0"/>
<xsd:element name="ConfirmByDateOfBirth" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the charge date -->
<xsd:complexType name="ChargeType">
<xsd:sequence>
<xsd:element name="IDGroup" type="IDGroupType"/>
<xsd:element name="ChargeOrComplaint" type="xsd:string"/>
<xsd:element name="ChargeTypeClassification" type="xsd:string"/>
<xsd:element name="ChargeClassification" type="xsd:string"/>
<xsd:element name="ArrestDate" type="ArrestDateType"/>
<xsd:element name="ChargeDate" type="ChargeDateType"/>
<xsd:element name="OffenseDate" type="OffenseDateType"/>
<xsd:element name="Sentence" type="xsd:string"/>
<xsd:element name="SentenceDate" type="SentenceDateType"/>
<xsd:element name="Disposition" type="xsd:string"/>
<xsd:element name="DispositionDate" type="DispositionDateType"/>
<xsd:element name="ProbationStatus" type="xsd:string"/>
<xsd:element name="AdditionalItems" type="AdditionalItemsType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the disposition date -->
<xsd:complexType name="DispositionDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the arrest date -->
<xsd:complexType name="ArrestDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the charge date -->
<xsd:complexType name="ChargeDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the case file date -->
<xsd:complexType name="CaseFileDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the offense date -->
<xsd:complexType name="OffenseDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the sentence date -->
<xsd:complexType name="SentenceDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- *********************** REFACTOR **************************** -->
<!-- details about the subject for the screening -->
<xsd:complexType name="ScreeningSubjectPersonDetailsType">
<xsd:sequence>
<xsd:element name="ScreeningSubjectDetailsTypeCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="PersonLegalID" type="PersonIDType" minOccurs="0"/>
<xsd:element name="PersonName" type="PersonNameType" minOccurs="0"/>
<xsd:element name="PostalAddress" type="PostalAddressType" minOccurs="0"/>
<xsd:element name="GenderCode" type="GenderCodeEnumType" minOccurs="0"/>
<xsd:element name="BirthDateDetails" type="BirthDateDetailsType" minOccurs="0"/>
<xsd:element name="RaceCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="EyeColor" type="xsd:string" minOccurs="0"/>
<xsd:element name="HairColor" type="xsd:string" minOccurs="0"/>
<xsd:element name="Height" type="xsd:string" minOccurs="0"/>
<xsd:element name="Weight" type="xsd:string" minOccurs="0"/>
<xsd:element name="Age" type="xsd:string" minOccurs="0"/>
<xsd:element name="Licenses" type="LicensesType" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="Type" type="xsd:string" use="optional"/>
</xsd:complexType>
<!-- licenses -->
<xsd:complexType name="LicensesType">
<xsd:sequence>
<xsd:element name="License" type="LicenseType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="LicenseType">
<xsd:sequence>
<xsd:element name="LicenseName" type="xsd:string"/>
<xsd:element name="IssuingAuthority" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- postal address -->
<xsd:complexType name="PostalAddressType">
<xsd:sequence>
<xsd:element name="AddressLine" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
<xsd:element name="CityName" type="xsd:string" minOccurs="0"/>
<xsd:element name="CountrySubDivisionCode" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
<!-- state/province ISO code -->
<xsd:element name="CountryCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="PostalCode" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<!-- details for the personal legal id -->
<xsd:complexType name="PersonIDType">
<xsd:simpleContent>
<xsd:extension base="xsd:normalizedString">
<xsd:attribute name="schemeID" type="xsd:normalizedString" use="optional"/>
<xsd:attribute name="schemeName" type="xsd:string" use="optional"/>
<xsd:attribute name="schemeAgencyID" type="xsd:normalizedString" use="optional"/>
<xsd:attribute name="schemeAgencyName" type="xsd:string" use="optional"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
<!--
gender enumeration from the hrxml-3.0 spec
http://ns.hr-xml.org/3.0/documentation/components/GenderCode-element.php
-->
<xsd:simpleType name="GenderCodeEnumType">
<xsd:restriction base="xsd:integer">
<xsd:enumeration value="0"/>
<xsd:enumeration value="1"/>
<xsd:enumeration value="2"/>
<xsd:enumeration value="9"/>
<!-- not known -->
<!-- male -->
<!-- female -->
<!-- not specified -->
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="JurisdictionTypeEnumType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="National"/>
<xsd:enumeration value="State"/>
<xsd:enumeration value="County"/>
<xsd:enumeration value="Federal District"/>
<xsd:enumeration value="Local District"/>
</xsd:restriction>
</xsd:simpleType>
<!-- generic name reference -->
<xsd:complexType name="PersonNameType">
<xsd:sequence>
<xsd:choice>
<xsd:element name="FormattedName" type="xsd:string"/>
<xsd:sequence>
<xsd:element name="GivenName" type="xsd:string"/>
<xsd:element name="MiddleName" type="xsd:string" minOccurs="0"/>
<xsd:element name="FamilyName" type="xsd:string"/>
</xsd:sequence>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<!-- details for the birth date -->
<xsd:complexType name="BirthDateDetailsType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- additional details -->
<xsd:complexType name="AdditionalItemsType">
<xsd:sequence>
<xsd:element name="Text" type="xsd:string" minOccurs="0"/>
<xsd:element name="UserArea" type="UserAreaType" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="vendor" type="xsd:string" use="optional"/>
<xsd:attribute name="type" type="xsd:string" use="optional"/>
<xsd:attribute name="qualifier" type="xsd:string" use="optional"/>
</xsd:complexType>
<!-- user area definition -->
<!--
<xsd:complexType name="UserAreaType" block="restriction">
<xsd:sequence>
<xsd:choice/>
<xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
-->
<xsd:complexType name="UserAreaType" block="restriction">
<xsd:sequence>
<xsd:element name="ChargeInfo" type="ChargeInfoType" minOccurs="0"/>
<xsd:element name="CaseInfo" type="CaseInfoType" minOccurs="0"/>
<xsd:element name="UserInfo" type="UserInfoType" minOccurs="0"/>
<xsd:element name="SterlingFields" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Field" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:simpleContent>
<xsd:extension base="xsd:string">
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Text" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ChargeInfoType">
<xsd:sequence>
<xsd:element name="ChargeType" type="xsd:string" minOccurs="0"/>
<xsd:element name="ChargeLevel" type="xsd:string" minOccurs="0"/>
<xsd:element name="Sentences" type="SentencesType" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SentencesType">
<xsd:sequence>
<xsd:element name="Sentence" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Consecutive" type="xsd:boolean" minOccurs="0"/>
<xsd:element name="LengthMonths" type="xsd:string" minOccurs="0"/>
<xsd:element name="LengthDays" type="xsd:string" minOccurs="0"/>
<xsd:element name="LengthHours" type="xsd:string" minOccurs="0"/>
<xsd:element name="LengthYears" type="xsd:string" minOccurs="0"/>
<xsd:element name="LengthWeeks" type="xsd:string" minOccurs="0"/>
<xsd:element name="Type" type="xsd:string" minOccurs="0"/>
<xsd:element name="MappedSentenceType" type="xsd:string" minOccurs="0"/>
<xsd:element name="Suspended" type="xsd:boolean" minOccurs="0"/>
<xsd:element name="FineAmount" type="xsd:string" minOccurs="0"/>
<xsd:element name="OtherInfo" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CaseInfoType">
<xsd:sequence>
<xsd:element name="CaseArrestDate" type="CaseArrestDateType" minOccurs="0"/>
<xsd:element name="CaseDispositionDate" type="CaseDispositionDateType" minOccurs="0"/>
<xsd:element name="CaseDisposition" type="xsd:string" minOccurs="0"/>
<xsd:element name="CaseStatus" type="xsd:string" minOccurs="0"/>
<xsd:element name="ReportingDecision" type="ReportingDecisionEnumType" minOccurs="0"/>
<xsd:element name="ReportingDecisionRule" type="xsd:string" minOccurs="0"/>
<xsd:element name="ReportingDecisionRuleBlurb" type="xsd:string" minOccurs="0"/>
<xsd:element name="Sentences" type="SentencesType" minOccurs="0"/>
<xsd:element name="CaseType" type="xsd:string" minOccurs="0"/>
<xsd:element name="CaseLevel" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CaseArrestDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CaseDispositionDateType">
<xsd:sequence>
<xsd:element name="YearMonthDate" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="ReportingDecisionEnumType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="REPORT"/>
<xsd:enumeration value="DO_NOT_REPORT"/>
<xsd:enumeration value="CONTACT_CLIENT_UNORDERED_HIT"/>
<xsd:enumeration value="CONTACT_CLIENT_NO_SALARY"/>
<xsd:enumeration value="DATA_ERROR"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="UserInfoType">
<xsd:sequence>
<xsd:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
The error is:
The element 'CriminalCase' in namespace 'http://www.sterlingtesting.com/hrxml/1.0' has invalid child element 'ScreeningSubjectPersonDetails' in namespace 'http://www.sterlingtesting.com/hrxml/1.0'. List of possible elements expected: 'http://www.sterlingtesting.com/hrxml/1.0:CityName http://www.sterlingtesting.com/hrxml/1.0:ChargeTypeClassification'.
ScreeningSubjectPersonDetails is the child element. Why is it showing INVALID CHILD?
Do you really believe anyone is going to read through this HUGE pile of code?
Anyway, the error message simply says that your XML file doesn't conform to the XSD...