0

When trying to validate XML against XSD in .net core 2.2 , we are unable to get the exact schema validation error . The validation error only give details on the name of XML element which has failed the validation , not on which XSD schema validation is failed.

Below error is thrown by .net xml parser

The element 'SignonRq' in namespace 'http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/' has invalid child element 'CustLangPref' in namespace '{http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/}'. List of possible elements expected: 'SignonPswd, SignonCert, SignonTransport, SessKey, ClientDt' in namespace 'http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/'.

Same validation if we run in Java below error is thrown.

Error - Line 42, 19: org.xml.sax.SAXParseException; lineNumber: 42; columnNumber: 19; cvc-complex-type.2.4.a: Invalid content was found starting with element 'PostalCode'. One of '{"http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/":Country, "http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/":Latitude, "http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/":Longitude, "http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/":County, "http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/":Region, "http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/":RegionCd, "http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/":Township, "http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/":LegalAddr, "http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/":ItemIdInfo, "http://www.ACORD.org/standards/PC_Surety/ACORD1/xml/":CountyTownCd, "http://www.CSIO.org/standards/PC_Surety/CSIO1/xml/":TownCd, "http://www.CSIO.org/standards/PC_Surety/CSIO1/xml/":AddrFormatCd, "http://www.CSIO.org/standards/PC_Surety/CSIO1/xml/":LengthTimeAddr, "http://www.CSIO.org/standards/PC_Surety/CSIO1/xml/":AddrValidationdInd}' is expected.

There is no way to get cvc exception schema code like -"cvc-complex-type.2.4.a" in .Net Core. Experts please provide your comments.

Aditya
  • 65
  • 1
  • 7

0 Answers0