Hi friends,
I have to generate an error file while reading the XML file source. XML source contains the information regarding customers in customer data set and each customer data set contains various data elements (tags).There are some required data elements (tags) that should be present in the XML file. The error file should contain the information regarding the missing required data elements for particular customer data set. I can successfully read the XML file but would'nt be able to find out How should i process the XML file to detect the missing required data elements in XML file.
For example :
we have XML file like this:
<AcisXML>
<Customers>
<Customer Customer_ID="356843">
<Data>
<Entry EffDt="2007-01-01" TermDt="9999-12-31" TID="136030">
<CES_Customer_Number>0710984</CES_Customer_Number>
<Original_Effective_Date>2007-01-01</Original_Effective_Date>
<Market_Segment_Code>MM1</Market_Segment_Code>
<CES_Market_Segment_Code>050</CES_Market_Segment_Code>
<Market_Segment_Name>Key Accounts (51-500 Lives)</Market_Segment_Name>
<Organization_Type>Corporation</Organization_Type>
<Spin_Off_Indicator>N</Spin_Off_Indicator>
<Eligibility_Service_Center>775</Eligibility_Service_Center>
<Eligibility_Service_Center_Name>Tampa</Eligibility_Service_Center_Name>
</AcisXML>.
Let us assume "CES_Customer_Number" data element is required field. So we need to prepare an error log file which contains the list of customers which do not have this data element in their data set in XML file.
Can you please help How can i process this logic?
Thanks in advance!
XML file processing with missing elements
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 10
- Joined: Sat Dec 22, 2007 12:09 am
- Location: Gurgaon
XML file processing with missing elements
Siddharth Pratap Singh
Datastage Developer
Datastage Developer
The "simple" answer is that elements that are truly missing from the document (you have a column and proper xpath, but for a particular node, the element just isn't there) will simply come into the link as "null". You can then test them for nulls on that row inside a transformer.
It can possibly get more complicated than that, but the default covers most scenarios.
Ernie
It can possibly get more complicated than that, but the default covers most scenarios.
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>
-
- Participant
- Posts: 125
- Joined: Mon Sep 11, 2006 4:22 am
- Location: India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
In XML a data element is (simplistically) a container for zero or more data attributes.
In DataStage, a Data Element is a great way to attach more information to a column about its purpose and other business metadata. One can perform Usage Analysis on a Data Element, for example to answer the question "which jobs deal with telephone numbers?".
In DataStage, a Data Element is a great way to attach more information to a column about its purpose and other business metadata. One can perform Usage Analysis on a Data Element, for example to answer the question "which jobs deal with telephone numbers?".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 125
- Joined: Mon Sep 11, 2006 4:22 am
- Location: India
You really should just Google for stuff like this. For example:
http://www.ibm.com/developerworks/xml/l ... leatt.html
http://www.ibm.com/developerworks/xml/l ... leatt.html
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers