XML validation in XMLInput Stage

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
igorlp
Participant
Posts: 10
Joined: Thu Mar 09, 2006 2:13 am

XML validation in XMLInput Stage

Post by igorlp »

I try to validate XML file in XMLInput Stage with Schema.
Datastage fail with structure error of file but don't make validation of data in file.
What i need to do??
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Not sure what you mean...... are you saying that the error is detected, but you aren't able to capture the actual problem?

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
igorlp
Participant
Posts: 10
Joined: Thu Mar 09, 2006 2:13 am

Post by igorlp »

No.. I meen, that i undestand how validate a structure of XML file in Input stage, but don't now how validate a data of file...
I'm sorry for my english )))
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So if the structure of the XML is correct, the data must be validated afterwards in a Transformer. Check there for values outside of what any validation would catch.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Either that, or have an xml schema that has formal data value validations, such as enumerated types, ranges, etc.

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Pretty much what I meant... thinking perhaps this is more of a "logical" data validation outside of what the schema would catch.

igorlp - can you post an specific example or two of your issue? XML, xsd, errors/warnings, whatever you can.
-craig

"You can never have too many knives" -- Logan Nine Fingers
igorlp
Participant
Posts: 10
Joined: Thu Mar 09, 2006 2:13 am

Post by igorlp »

chulett wrote:Pretty much what I meant... thinking perhaps this
igorlp - can you post an specific example or two of your issue? XML, xsd, errors/warnings, whatever you can.
Yes..

This is schema:
<?xml version="1.0" encoding="utf-8" ?>
- <xs:schema id="TElectricCircuitBatchSchema" targetNamespace="http://iec.co.il/NIS/TElectricCircuitBatchSchema/v1.0" elementFormDefault="qualified" xmlns="http://iec.co.il/NIS/TElectricCircuitBatchSchema/v1.0" xmlns:mstns="http://iec.co.il/NIS/TElectricCircuitBatchSchema/v1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <!-- Interface no.20
-->
- <xs:element name="CircuitList">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="Circuit" maxOccurs="unbounded">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="ActionType">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:enumeration value="I" />
<xs:enumeration value="U" />
<xs:enumeration value="D" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="District">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="1" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="DistrictsTraverse" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="1" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="OperationalVoltage" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="8" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CircuitID" type="xs:int" />
<xs:element name="NumOfPolesInCircuit" type="xs:int" minOccurs="0" />
<xs:element name="StationID" type="xs:int" minOccurs="0" />
<xs:element name="FieldNumber" type="xs:int" minOccurs="0" />
- <xs:element name="CircuitName" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="40" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="CircuitClassification" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="7" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="CircuitType" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="7" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="InstallationDate" type="xs:dateTime" minOccurs="0" />
<xs:element name="LastUpdateDate" type="xs:dateTime" minOccurs="0" />
- <xs:element name="SegmentConductorMaterial" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="SegmentConductorSize" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="SegmentWiresNumPerPhase" type="xs:int" minOccurs="0" />
- <xs:element name="GroundConductorMaterial" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="GroundConductorSize" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="255" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="GroundWiresNumPerPhase" type="xs:int" minOccurs="0" />
- <xs:element name="CircuitColor" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="20" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Status" type="xs:int" minOccurs="0" />
<xs:element name="SerialNumber" type="xs:int" minOccurs="0" />
- <xs:element name="ApprovalDrawingID" minOccurs="0">
- <xs:simpleType>
- <xs:restriction base="xs:string">
<xs:maxLength value="30" />
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

This is a file:

<?xml version="1.0" encoding="utf-8"?>
<CircuitList xmlns="http://iec.co.il/NIS/TElectricCircuitBatchSchema/v1.0">
<Circuit>
<ActionType>I</ActionType>
<District>345</District>
<DistrictsTraverse>7</DistrictsTraverse>
<CircuitID>904</CircuitID>
<CircuitClassification>ק</CircuitClassification>
<CircuitType>ע</CircuitType>
<SegmentConductorMaterial>4</SegmentConductorMaterial>
<SegmentConductorSize>64.5</SegmentConductorSize>
<SegmentWiresNumPerPhase>1</SegmentWiresNumPerPhase>
<ApprovalDrawingID>rrrrrrrrrrrrrrrrrrrr</ApprovalDrawingID>
<OperationalVoltage>115657576576576</OperationalVoltage>
<FieldNumber>2211</FieldNumber>
<StationID>22</StationID>
<CircuitColor>1111111111111</CircuitColor>
<SerialNumber>5555555</SerialNumber>
</Circuit>
</CircuitList>

I mean that datastage do warnings for not rigth data, but validation of XML don't give errors or warnings
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

Can you be more explicit? Which element, which validation type isn't working? There was an anomaly in an early version of 8.x that broke validation, but in 7.x it works very well, unless there is one subtle type that for some reason isn't working. I've tried it with invalid elements, enumerated lists, datatype failures, wrong number of elements, etc.

Check validation, then create a reject link on output (there's a pull down to tell you that it is reject), and in that link you can provide a column for any validation errors and also send down the original incoming link or content via passthru (just use the same exact column name as on your input link).

Ernie
Ernie Ostic

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