Validate XML against XSD

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
uegodawa
Participant
Posts: 71
Joined: Thu Apr 27, 2006 12:46 pm

Validate XML against XSD

Post by uegodawa »

Hi,
I'm trying to validate XML document against it's defined rules. Here is the job layout.
Folder ---> XML Input ---> Seq File.
I've tried with Validate XML input (General/Strict) but didn't get the results.
I've tried with Log rejected Error option. Didn't get the expected results.
Then I went through the XMLPACK_20_Designer.pdf file and include the XSD in the XML document's root element as follows.

<Chains xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com C:\CR\Chains.xsd">

Even I mentioned the schema loaction in the XML, it didn't validate.

Here is my validation rule :
All the TranType except 'A' and 'C' should be rejected.


<xs:element name="TranType">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value='"A"'/>
<xs:enumeration value='"C"'/>
</xs:restriction>
</xs:simpleType>
</xs:element>


Please provide me details If I missed anything when I'm doing the validation.

Thanks
- U
Lotus26
Premium Member
Premium Member
Posts: 48
Joined: Tue Jul 13, 2004 2:09 pm

Post by Lotus26 »

HI

<Chains xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com C:\CR\Chains.xsd">


In your xml file please do specify the schema location like below and give a try.

<Chains xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="C:\CR\Chains.xsd">

Thanks.
Regards
Lotus26
uegodawa
Participant
Posts: 71
Joined: Thu Apr 27, 2006 12:46 pm

Post by uegodawa »

Hi,
I tried that option as well. Here is the error I got;
TestValidateXSD..XML_Input_1: XML input document parsing failed. Reason: Xalan fatal error (publicId: , systemId: , line: 1, column: 39): An exception occurred! Type:TranscodingException, Message:An invalid multi-byte source text sequence was encountered
Thanks
-U
Post Reply