‎2011 Sep 07 2:25 PM
Hi,
I have a requirement where in a report i am picking xml file from the presentation server (desktop) and then i am parsing the xml file using FM "SMUM_XML_PARSE" (first i use FM SCMS_BINARY_TO_XSTRING and then SMUM_XML_PARSE). after using the function SMUM_XML_PARSE i get the xml data in my internal table and then my report uses that data for some processing. This all is working fine .
My issue is that how do i do a XSD VALIDATION for the xml file that i am reading . I would have liked to do a xsd validation after i import the xml file and throw error if the xml file is not as per its xsd.As i am not using any middleware technology like XI/ WTX which have XSD validation functionality i am not sure how to achieve this in abap program.
‎2011 Sep 13 4:09 PM
the parser should verify if the XML file complies with XSD file if the XSD file is linked
the link is done in root tag of the XML file: you should see something like
<RootTag xsi:noNamespaceSchemaLocation="somepath/somefile.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
‎2011 Sep 14 4:08 PM
Hi,
Which parser will verify that ? the fm SMUM_XML_PARSE doesnt verify that and the max that i have seen is DTD validation done by writing some additional code but i have not seen R3 doing XSD validation
‎2011 Sep 14 8:32 PM
Hi,
I think you're right, iXML can only validate DTD via its if_ixml_parser->set_validating method (you can find this information in SAP SDN article "ABAP XML Mapping", as of release 6.10, I couldn't find any other reference saying that xsi:noNamespaceSchemaLocation is supported since then).
By looking at SDN, I saw an external link about XSD to DTD conversion via XSLT (http://crism.maden.org/consulting/pub/xsl/xsd2dtd.xsl), but I don't have any idea if it works. On another thread, people used OS command to do XML/XSD validation, but didn't describe what they ran exactly (anyway, that means using any external tool).
Sandra