Application Development 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: 

Check XML file against XSD? Via XSLT?

Former Member
0 Kudos

Hello,

we´re using a 6.20 system (XI not available) and want to check XML files against a XML-schema definition file (xsd).

Is there a function in 6.20 available for this? Is it possible to use "CALL TRANSFORMATION" for it? I´ve seen other XSLT parser in the internet which are able to check a source XML against an XSD before transforming it to the result XML.

But is this possible with an 6.20 system?

Thank you for your help,

best regards,

Stefan

13 REPLIES 13

sergey_korolev
Active Contributor
0 Kudos

XSLT processor is available since basis 6.10, so you can CALL TRANSFORMATION.

0 Kudos

you can check these threads for how to validate xml against xsd

Regards

Raja

0 Kudos

Hello Sergey,

yes, I know that it is available on my system. But how can I use this to validate a XML file?

Best regards,

Stefan

0 Kudos

Hello Raja,

thank you for this threads which describe a spolution. Unfortunately it works only for DTD, but not for XSD. is there any possibility to validate a XML against a XSD file?

best regards,

Stefan

athavanraja
Active Contributor
0 Kudos

if you already have a XSLT program which can do this job. create the same in SAP environment - SE80

and then use the stt as below.

CALL TRANSFORMATION (`<name of the xslt which can do the validateion`)

SOURCE XML = <source xml the one to be validated>

RESULT XML xml_out.

xml_out is the variable to receive the results.

Regards

Raja

0 Kudos

Hi Raja,

I have similar situation. I tried to save the schema in SE80 before I do the CALL TRANSFORMATION, but SAP does not like the <xsd:schema> tags, Here is the error message I got when I tried to activate the XSLT program.

Illegal root element 'xsd:schema'.

Please if know any work around for this.

Thanks,

Suman

0 Kudos

Hello,

unfortunately I do not have a XSL-file which can be used to validate a XML against a XSD-Schema (with CALL TRANSFORMATION). If you have one, can you send it to me, please?

Best regards,

Stefan

Former Member
0 Kudos

Here is the sample XML and the schema.

XML:

<?xml version="1.0" encoding="UTF-8"?>

<book isbn="0836217462">

<title>

Being a Dog Is a Full-Time Job

</title>

<author>Charles M. Schulz</author>

<character>

<name>Snoopy</name>

<friend-of>Peppermint Patty</friend-of>

<since>1950-10-04</since>

<qualification>

extroverted beagle

</qualification>

</character>

<character>

<name>Peppermint Patty</name>

<since>1966-08-22</since>

<qualification>bold, brash and tomboyish</qualification>

</character>

</book>

XSD:

<?xml version="1.0" encoding="utf-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="book">

<xs:complexType>

<xs:sequence>

<xs:element name="title" type="xs:string"/>

<xs:element name="author" type="xs:string"/>

<xs:element name="character" minOccurs="0" maxOccurs="unbounded">

<xs:complexType>

<xs:sequence>

<xs:element name="name" type="xs:string"/>

<xs:element name="friend-of" type="xs:string" minOccurs="0"

maxOccurs="unbounded"/>

<xs:element name="since" type="xs:date"/>

<xs:element name="qualification" type="xs:string"/>

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:sequence>

<xs:attribute name="isbn" type="xs:string"/>

</xs:complexType>

</xs:element>

</xs:schema>

- Suman

0 Kudos

check this weblog.

<a href="/people/tobias.trapp/blog/2006/08/22/xml-processing-in-abap-part-8--using-xslt-for-validation">XML Processing in ABAP Part 8 - Using XSLT for Validation</a>

Regards

Raja

0 Kudos

Hello Suman,

as far as I can see you´ve posted the XSD file. This will of course not work for CALL TRANSFORMATION (which expects an XSLT file). Or do I misunderstand here something!?

Best regards,

Stefan

0 Kudos

> check this weblog.

>

> <a href="/people/tobias.trapp/blog/2006/08/22/xml-processing-in-abap-part-8--using-xslt-for-validation">XML

> Processing in ABAP Part 8 - Using XSLT for

> Validation</a>

>

> Regards

> Raja

Hello Raja,

this web-log is about nearly the same problem. Unfortunately it is only working for schematron XML specifications; but this is no solution for W3C XML schema.

Best regards,

Stefan

Former Member
0 Kudos

Hi Stefan,

I know this off course don't work for the validation. I think Raja's solution mislead me in believing that we can use the SE80 stylesheet tool and the CALL TRANSFORMATION for the purpose of validation.

Now I have concluded that we can't use CALL TRANSFORMATION for the validation purposes. I have created a OSS Note to SAP, hopefully I may get some answer from them.

Thanks,

Suman

0 Kudos

Hi All,

Here is the reply I got from SAP OSS.

"No, there is no schema validator integrated in the ABAP server (not even in the current release)."

I guess we should find a alternative way at this point.

- Suman