cancel
Showing results for 
Search instead for 
Did you mean: 

XSD Validation - Storage of XSDs

Former Member
0 Kudos

Hello together!

I have the following problem. I have incoming XML messages and I want to validate this message against the matching XSD.

I have seen in a sun forum that I can validate the message with a DOM Parser :

/message/928947#928947 [original link is broken]

import org.apache.xerces.parsers.DOMParser;
import java.io.File;
import org.w3c.dom.Document;
 
public class SchemaTest 
{
   public static void main (String args[]) 
   {
          File docFile = new File("memory.xml");
          try
          {
               DOMParser parser = new DOMParser();
               parser.setFeature("http://xml.org/sax/features/validation", true);
               parser.setProperty(
                 "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", 
                            "memory.xsd");
               ErrorChecker errors = new ErrorChecker();
               parser.setErrorHandler(errors);
               parser.parse("memory.xml");
         }
         catch (Exception e) 
         {
             System.out.print("Problem parsing the file.");
         }
   }
}

But, in which directory on the XI or place can I do the XSD file to do a validation??

Thanks a lot

ciao Alex

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Bhavesh, Ananth,

thank you very much for the fast responses!! I will try it!

ciao Alex

Former Member
0 Kudos

Hello Ananth,

for the moment I am not sure: does everybody have an access to this directory or just the responsible persons which work with that directory on XI??

Thanks a lot

ciao Alex

Former Member
0 Kudos

Hi Alex,

No, Normally XI BASIS/Admin people have access to Server directories. And moreover AFAIK, XI validates your Incoming messages based on your Data type definition, so I dont think that explicit validation is required.

But if you want to do so then you have to store the XSD file in XI server directory and refer it in source XML.

regards,

Ananth

Former Member
0 Kudos

Hi Alexander,

You can place the XSD files in the following location

/usr/sap/XISRV/DVEBMGS**/j2ee/cluster/server0/

and refer the same in XML like this..


<?xml version="1.0"?>

<MSG
xmlns="http://www.abc.com"
xmlns:xsi="http://www.abc.org/XMLSchema-instance"
xsi:schemaLocation="locationURL YourXSD.xsd">

<Abc>
	<Bbc>XYZ</Bbc>
</Abc>

</MSG>

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Alexander,

In XI, you can do a validation of your XML in your Mapping by creating a Java Mapping.

As you have mentioned that you are using a DOM Parser, i think this link can help you a lot <a href="http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html">DOM Parser Methods</a>.

Also, you can develop your Java Mapping code, and then use import it as a JAR under IMPORTED ARCHIVES in your MAPPING OBJECTS.

Hope this helps,

Regards,

Bhavesh