Page 1 of 1

XML validation in XMLInput Stage

Posted: Sun Jan 25, 2009 6:27 am
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??

Posted: Sun Jan 25, 2009 7:00 am
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

Posted: Sun Jan 25, 2009 7:09 am
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 )))

Posted: Sun Jan 25, 2009 9:08 am
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.

Posted: Sun Jan 25, 2009 9:24 am
by eostic
Either that, or have an xml schema that has formal data value validations, such as enumerated types, ranges, etc.

Ernie

Posted: Sun Jan 25, 2009 9:39 am
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.

Posted: Mon Jan 26, 2009 3:37 am
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

Posted: Tue Jan 27, 2009 12:18 am
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