Handling XML element tags

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
muralisankarr
Premium Member
Premium Member
Posts: 83
Joined: Tue Oct 28, 2008 1:55 am
Location: Chennai

Handling XML element tags

Post by muralisankarr »

I'm new to XML stages. Need your help for the following.

When I use MS Excel to import the XML I got the element name by default for parent elements. But in datastage we got the full tags.Is there any way we have to extract the element name instead of tags?.

Note:
In XML document on XMLInput section it is mentioned as.
When an XPath expression ends with an element node, XML Input
extracts and writes an XML fragment.
Please help if there are any alternative to avoid the fragments.

Many Thanks
MSR
The minute you start talking about what you're going to do if you lose, you have lost
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

scroll to the right on the link... add "text()" to the end of each of the strings....

Ernie
Ernie Ostic

blogit!
<a href="https://dsrealtime.wordpress.com/2015/0 ... ere/">Open IGC is Here!</a>
muralisankarr
Premium Member
Premium Member
Posts: 83
Joined: Tue Oct 28, 2008 1:55 am
Location: Chennai

Post by muralisankarr »

Hi Ernie,
eostic wrote:scroll to the right on the link... add "text()" to the end of each of the strings....

Ernie
Will that work for a parent element which don't have any text.

Below is the XML I have used
<?xml version="1.0" encoding="ISO-8859-1" ?>
- <note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
when I appended text() to /note/test(), I got the bellow error
DataStage Job 19 Phantom 3740
Program "DSP.ActiveRun": Line 51, Exception raised in GCI subroutine:
Unknown exception code.
Attempting to Cleanup after ABORT raised in stage LMC..XMLInput
DataStage Phantom Aborting with @ABORT.CODE = 3
I have handled the xml fragments in the Transformer stage. It worked fine. But please guide me if there is any way to handle this on XPath or I'm making a wrong move

Many Thanks
MSR
The minute you start talking about what you're going to do if you lose, you have lost
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

"Note" is a parent element containing sub-elements...it need not be retrieved....it has no text....the only columns are "to" "from" "heading" and "body" ...they are 'defined' by their parent, Note..... you could change the column names to NoteTo and NoteFrom if you wanted......but there is really no reason (in this structure) to have Note as a column on the link at all...

Ernie
Ernie Ostic

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