unable to validate Input XML
Moderators: chulett, rschirm, roy
unable to validate Input XML
Hi All,
I am unable to validate the input XML in a job which extracts data from a XML source file and subsequently converts the information to a text file (with Header repeated for Details).
Job Design:
XML Source File -> XML Input Stage -> Transformer -> Text File
In the XML Input Stage the option 'Validate Input XML' is checked and the schema validation level is indicated as 'strict'. The job converts the source XML file to a text file as expected. However, there is no validation performed. There is no warning or job failure for contents not satisfying the XML criteria (e.g. length is not as specified, character content for numeric field).
I would greatly appreciate your advise on what may be the cause and how i could enable the validation of XML source files. Thanks !
I am unable to validate the input XML in a job which extracts data from a XML source file and subsequently converts the information to a text file (with Header repeated for Details).
Job Design:
XML Source File -> XML Input Stage -> Transformer -> Text File
In the XML Input Stage the option 'Validate Input XML' is checked and the schema validation level is indicated as 'strict'. The job converts the source XML file to a text file as expected. However, there is no validation performed. There is no warning or job failure for contents not satisfying the XML criteria (e.g. length is not as specified, character content for numeric field).
I would greatly appreciate your advise on what may be the cause and how i could enable the validation of XML source files. Thanks !
Make sure that the xsd is properly identified in the header of the xml document, and that it is fully qualified as to its location......meaning, check the exact value of the schemaLocation or NoNamespaceSchemaLocation attributes.
Ernie
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Thanks for your response. Is it sufficient to define the location of the XSD schema in the XML Input Stage and not in the XML document or is it a must that it has to be specified in the XML document ?
XSD is defined as follows:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="ROOT">
<xs:complexType>
<xs:sequence>
<xs:element name="HDR">
...
...
<xs:element name="DTL" minOccurs="0" maxOccurs="unbounded">
...
...
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XSD is defined as follows:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="ROOT">
<xs:complexType>
<xs:sequence>
<xs:element name="HDR">
...
...
<xs:element name="DTL" minOccurs="0" maxOccurs="unbounded">
...
...
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The only way I know of to tell it which xsd is to do it inside the instance document itself.
At time's, I have "zapped" the value into the doc in an upstream transformer
Ernie
At time's, I have "zapped" the value into the doc in an upstream transformer
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
Hi,
I imported the XSD to the schema library. Then in the XML document I made reference to it as follows:
<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="TEST.xsd">
<HDR><FIELD1>ABC</FIELD1></HDR>
<DTL><FIELD2>123</FIELD2></DTL>
</ROOT>
I encountered the following error:
Xalan warning (publicId: , systemId: , line: 0, column: 0): An exception occurred! Type:RuntimeException, Message:Warning: The primary document entity could not be opened. Id=TEST.xsd
Any suggestion to fix this ?
I imported the XSD to the schema library. Then in the XML document I made reference to it as follows:
<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="TEST.xsd">
<HDR><FIELD1>ABC</FIELD1></HDR>
<DTL><FIELD2>123</FIELD2></DTL>
</ROOT>
I encountered the following error:
Xalan warning (publicId: , systemId: , line: 0, column: 0): An exception occurred! Type:RuntimeException, Message:Warning: The primary document entity could not be opened. Id=TEST.xsd
Any suggestion to fix this ?
....ok. Now I am confused. In the first post you noted that you are using the xml Input Stage......
Now above the Library Schema Manager is mentioned.
Two different technologies and two different methods of doing xml validation. Which Stage are you using (xml or xmlInput) ?
Ernie
Now above the Library Schema Manager is mentioned.
Two different technologies and two different methods of doing xml validation. Which Stage are you using (xml or xmlInput) ?
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
As Craig said. But the two aren't going to mix.
Using the xmlInput Stage, validation will occur if the xsd is noted inside the document and it can be properly found. As Craig notes, it might need to be in the project directory --- I haven't done one in awhile and can't recall if it enforces that or not. Validation with the xmlInput Stage has nothing to do with the Library Manager.
The xml Stage uses the xsd that is imported at design time into the Library Manager and specifically noted in the assembly. Validation options are selected within the xmlParser Step.
Ernie
Using the xmlInput Stage, validation will occur if the xsd is noted inside the document and it can be properly found. As Craig notes, it might need to be in the project directory --- I haven't done one in awhile and can't recall if it enforces that or not. Validation with the xmlInput Stage has nothing to do with the Library Manager.
The xml Stage uses the xsd that is imported at design time into the Library Manager and specifically noted in the assembly. Validation options are selected within the xmlParser Step.
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
I recall that also...I also recall a time when it simply had to be fully qualified....it may depend on the release --- but either way, that discussion is exclusively for the xmlInput Stage.
Ernie
Ernie
Ernie Ostic
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>