Validate xml with xsd in x++

rafax12

New Member
I want to validate my xml against xsd in AX2009.But whatever I change in the xml, the xml will always validate...Wat is wrong with my code?\[code\]static void Job174(Args _args){ XMLDocument xmlDocument; XMLSchema xmlSchema; XMLSchemaValidationError validationError; XMLReader xmlReader; FileName xsdFile; ; xsdFile = 'c:\\e\\note.xsd'; xmlSchema = xmlSchema::newFile(xsdFile); if(xmlSchema) { //xmlDocument = new XMLDocument(); //xmlDocument.load('c:\\e\\note.xml'); xmlReader = XMLReader::newXml('c:\\e\\note.xml'); validationError = xmlReader.validate(xmlSchema.writeToString()); if (validationError) info(strfmt('%1',checkFailed(validationError.message()))); else info('XML is Ok..!'); }}\[/code\]
 
Back
Top