Parsing XML file

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

Post Reply
Etler21
Participant
Posts: 52
Joined: Mon Mar 08, 2010 5:51 am

Parsing XML file

Post by Etler21 »

I have a XML file whose content I am trying to load into a table,I am not sure how to pull data from this XML file because I am not able to understand the metadata behind this XML.

I tried to Import this XML file into Import table defination section,XML as source and build a metadata which is then used in the XML imput stage.

Still,there are some issues with the design and Value coloumn is blank at all the places.I have pasted a sample XML file for the reference..
Anyone could please suggest me the way to read all data within the XML.

=================================================

<dumps Patcher="http://hoverif.comer:29081/d3p">
<dump time="Tue Mar 09 10:32:27 CST 2010">
<scom name="com.sepr:type=Metrics,service=monitorService">
<attributes>
<attribute name="Failed">
<value>
dd
</value>
</attribute>
<attribute name="Successful">
<value>
e0
</value>
</attribute>
<attribute name="Consolidated">
<value>
<composite>
<attribute name ="LastRes">
<value>
1084
</value>
</attribute>
<attribute name ="LastResponseUpdate">
<value>
Tue Mar 09 10:24:34 CST 2010
</value>
</attribute>
</composite>

</value>
</attribute>
<attribute name="Operational">
<value>
Available
</value>
</attribute>
<attribute name="NumberOfSuccessful">
<value>
0
</value>
</attribute>
<attribute name="LastResponse">
<value>
1084
</value>
</attribute>
<attribute name="TimeInThread">
<value>
10
</value>
</attribute>
<attribute name="ThreadQueueLength">
<value>
10
</value>
</attribute>
<attribute name="Health">
<value>
NotApplicable
</value>
</attribute>
</attributes>
</scom>
</dump>
</dumps>
=================================================
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Tried to import the metadata? So, did you? What happened? If you have (or can get) an xsd for this, it would be a better source to import metadata from, by the way.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Etler21
Participant
Posts: 52
Joined: Mon Mar 08, 2010 5:51 am

Post by Etler21 »

can you please tell me how to get xsd for this xml file ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ask for it from whomever supplied you with the XML, meaning whomever created it. They should also have an xsd (the metadata) for it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Etler21
Participant
Posts: 52
Joined: Mon Mar 08, 2010 5:51 am

Post by Etler21 »

unfortunately no-one knows about that xsd of that XML file,this is an auto generated thing.this is the Metadata which I am using in the XML xformer stage.

Patcher VarChar(60) /dumps/@Patcher
Time VarChar(30) /dumps/dump/@time
scomname VarChar(80) /dumps/dump/scom/@name
name VarChar(50) /dumps/dump/scom/attributes/attribute/@name
Value Decimal(15) /dumps/dump/scom/attributes/attribute/@value

When I use this meta data and run the job,all colums get loaded properly but Value field is Blank..

I am sure about all other thing which is good in the job,but I am not sure about the metadata,Is there something wrong in the metadata ?
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

Value Decimal(15) /dumps/dump/scom/attributes/attribute/value/text()
You are the creator of your destiny - Swami Vivekananda
Post Reply