Page 1 of 1

Handling XML element tags

Posted: Wed Oct 14, 2009 11:26 am
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

Posted: Wed Oct 14, 2009 12:42 pm
by eostic
scroll to the right on the link... add "text()" to the end of each of the strings....

Ernie

Posted: Wed Oct 14, 2009 2:12 pm
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

Posted: Wed Oct 14, 2009 3:53 pm
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