Including DTD for XML Validation

Dedicated to DataStage and DataStage TX editions featuring IBM<sup>®</sup> Service-Oriented Architectures.

Moderators: chulett, rschirm

Post Reply
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Including DTD for XML Validation

Post by rameshrr3 »

Can I copy paste a DTD anywhere in the XML input stage to validate the XML being processed ? Or does the DTD have to be part of the XML document or a file in the same directory as the XML source? I may need to enforce XML validation in certain jobs at the "Default" level.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

for xmlInput stage, it has to be part of the current incoming document, fully qualified within the NoNamespaceSchemaLocation or SchemaLocation attribute in the header.

In the xml Stage, it is "the" formal xsd "library" that you import during design time.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

Thanks .

Yes you are right , I always use an XSD to create xml table definitions. The xml itself can be used , but is only for a quick and dirty way of creating a table def.
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Yes...but a separate topic. The xsd can help generate the tabledef(s), but is critical if you want to perform formal xml "validation". With xmlInput Stage, you can generate the metadata for the output link any way you want, even hand type it, and still do validation by the "run time" value of the xsd that is inside of the incoming content.

I've had situations where I have "zapped" the schemaLocation attribute on my own to dynamically insert the name of an xsd when validation was desired. It's easy to do if the document isn't too large and you have access to it (either from a folder stage, or an MQ stage, or perhaps a database or file based stage).

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Post Reply