XML Validation Against XSD

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

XML Validation Against XSD

Post by Aquilis »

Hello all,
I was wondering why Parallel Extender is not able to validate XML Hierarchical file against the XSD when the same is happening in Server Edition.
In parallel its actaully rejecting the XML Data file & and also it's populating the records into database as expected.

I know ,It's already been discussed but nobody has come up any proper resolution,so any inputs on this would really help !!!
Following is the declarations i mentioned both in parallel as well as in server. Server Did a good job but why not Parallel can't ?

If anything i am missing please naybody point me out that

Code: Select all

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:NamespaceschemaLocation="/local/apps/work/Extract.xsd"
Aquilis
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Can you post whatever errors/warnings you are seeing?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Post by Aquilis »

There are no Fatal/errors/Warnings in the Job, Since I'm running the Job with Valid XML data file.
Upon validation against XSD,Either It should reject the Data file or it should parse and load the data,but in my case both are happening.Its getting rejected as well as data is getting loaded.

---Thanks
Aquilis
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Your description is still too generic. Can you be more specific.... so...when you test with a sample XML document.... it works? it fails? not sure which you are saying?

What are your settings in the XMLInput Stage?

What methods (in server and in EE) are you using to "read" your xml document into the job?

Does it happen with "any" xml document or just this one?

Does it happen with "any" xml/xsd combination, or just this one?

The XMLInput Stages themselves are largely the same at their "guts". What could be problematic is the way that you are reading the xml into the stage in Server vs EE.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Post by Aquilis »

It's for multiple valid XML data files against a single XSD.
Following are the list of settings done in Server & as well as in parallel.

In parallel I am reading the xml with external source activity & in Server I am using Folder stage.

XML Input Settings:
General settings:
1. Validate input XML --- Enabled
2. Log reject errors ---Enabled
3. schema validation level--- Strict
4. Transformation Error Mappings:
Fatal --- Reject
Error --- Reject
Warning--- Info

Transformation Settings:
Repeating Element required --Enabled
Include namespace declaration:

Code: Select all

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xsi:schemaLocation="/local/apps/work/Extract.xsd"
Aquilis
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

hmm. Try fully qualifying the xsd within the noNameSpaceSchemaLocation attribute and see what happens.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Post by Aquilis »

Ernie,
could you elaborate on how could i make fully Qualified XSD. Do I need to add tag into XSD file as well as :

Code: Select all

<xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Extract.xsd"> 

Currently I have below mentioned qualifiers in my XSD File.

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >


Thanks---
Aquilis
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Post by Aquilis »

Made it fully Qualified XSD file & parsed ok in XML Importer, as:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
But still validation problem persists. Could anybody suggest me, where Should I place the XSD file,I think I'm going wrong in XSD File placement and where should mention the XSD location in XML Input stage.

hope,this would probably resolve my problem.
Aquilis
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

You fully qualified it above, and I missed it. Sorry...pointing specifically to the subdirectory and exact name of your xsd is what I was referring to.

Call support..there were some patches to validation, although they were a long time ago...something still may be wrong, or maybe the patches still need to be applied to your site.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Post by Aquilis »

Ernie,
Thanks for the suggestion. I raised ticket with the IBM Support & they came back with a Patch.But this patch helped us to validate the XML data file against the XML Input stage Metadata only, but not with the actual (physical) XSD.

I have mentioned the wrong XSD name as shown in below code, then also it's rejecting the Invalid XML file to Reject Link,same is happening even if remove the XSD file Name & path too.

Code: Select all

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="/abcd/xyzfhkldhflshglkhl..xsd"
Is there any other patch exists for XSD validation only or I'm missisng something,Suggest me with your valuable inputs.
Aquilis
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

xml input only?

No...they either mis-interpreted the question, or it is still broken, or both. I did a very lengthy set of tests of validation back in release 7 when XMLpack2 came out, and submitted a set of issues in 8.0 when it had been broken. I know that some of it has been fixed, but I haven't myself found time to run all my tests again.

There is no "feature" to perform validation against the metadata in the stage. The validation check box simply tells the xml parser under the covers to do a normal validity check....enumerated types, unknown elements, elements too long, too many elements, etc.... all are normal things that can be checked via a formal xsd.

Did you patch have a number?

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Aquilis
Participant
Posts: 204
Joined: Thu Apr 05, 2007 4:54 am
Location: Bangalore
Contact:

Post by Aquilis »

Ok, Thanks for this detailed Info.

Patch Number Is : "patch_JR31866". It's for Sun Solaris Box.
Aquilis
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Ok... I will do some checking. In the meantime, I dug up my old .dsx and ran some tests. I have to look at it more, as I was surprised to see the Job Abort (I thought I had set all the options to reject), but it did indeed capture an unknown element, in that particular subset test.

This was in Server, and using a base 8.1 without any xml oriented patches applied, on Windows....but that shouldn't matter. Later I'll give it a spin on EE.

DynamicValidation..XML: XML input document parsing failed. Reason: Xalan error (publicId: , systemId: , line: 28, column: 32): Unknown element 'eight'
Xalan error (publicId: , systemId: , line: 29, column: 11): Element 'eight' is not valid for content model: '((four,five,six),seven)'

As you can see, DataStage isn't doing the validation --- it is merely reflecting back the resluts that xalan delivers when doing a formal validation check (and it has nothing to do with the metadata on the link ; ) )

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
dstage2006
Premium Member
Premium Member
Posts: 116
Joined: Fri Jan 20, 2006 2:30 pm

Post by dstage2006 »

Ernie,

I am facing the similar problem. I have the xml with schema file included in it.

Error:
an exception occurred! Type:RuntimeException, Message:Could not open DTD file .

Is there any patch to apply this kind of error(Validating dtd file/xsd) file.

Thanks in advance.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:!: Please start the similar post.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply