on 05-28-2008 9:52 AM
hello experts,
I am validating XML messages in XI using a Java mapping and by loading the XSDs at runtime.
I am facing a typical problem when my XSDs import / include other XSDs and below is the situation.
-
I have a Java mapping class say Validator in a package
com.myclient.xiutils.
I have XSDs in a folder inside this package which is
com.myclient.xiutils.xsds
Within the Validator class, I load the XSDs using the statement,
InputStream schemaInputStream =
this.getClass().getResourceAsStream("xsds/primary.xsd");
There is no issue if the primary.xsd has everything inside it but in my case, the third party has provided the xsds to us and the primary.xsd has a reference (import) to secondary.xsd.
whichever location in the package structure I put the secondary.xsd, XI does not recognize it and errors out saying unable to find secondary.
The workaround I had used was I copied the secondary.xsd to the location pointed by the environment variable user.dir and XI could find it at runtime but I want to know what is the correct way.
Edited by: Amol Joshi on May 28, 2008 10:53 AM
Hi Amol,
May be you could try the following lead to resolve the problem:
Lets assume your primary.xsd in the package com.myclient.xiutils.xsds has the following line within it
<xsd:import namespace="..." schemaLocation=
"com/myclient/xiutils/xsds/secondary.xsd"/>
In such a case I assume, the following would happen: Your java runtime would look for the secondary XSD under the following path
+com.myclient.xiutils.xsds.com.myclient.xiutils.xsds.secondary.xsd+.
The underlined path is the path for the primary.xsd, followed by the path of secondary.xsd. If this guess is right, then simply changing the schemaLocation to "secondary.xsd" would help.
Regards,
Keerti Nayak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amol,
Check the XSD Schema and Namespace in Secondary.xsd
Reward points if this helps
Regards
Pragathi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try to copy the secondar.xsd information into primary.xsd any try for it, its working or not check can we use other names or not.
Reward points if needful.
Thanks,
RamuV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.