I'm validating XML against XSD in Windows Forms using C# .NET and it's giving me the error "Please Suggest the fix"
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="ScreeningSubjectPersonDe开发者_如何学JAVAtailsType" 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...
精彩评论