Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

XSD VALIDATION IN ABAP PROGRAM

0 Likes
1,181

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.

3 REPLIES 3
Read only

franois_henrotte
Active Contributor
0 Likes
694

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">

Read only

0 Likes
694

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

Read only

0 Likes
694

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