root element in XML document

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
pillip
Premium Member
Premium Member
Posts: 50
Joined: Thu Dec 10, 2009 10:43 am

root element in XML document

Post by pillip »

Hi,

I need to generate an XML document which has a root element. I am able to get the rest of the document except the root element. I have checked the best practices document. Did not get much help. I feel I am missing something here.How do I obtain this root element using the XML output stage. Kindly suggest



Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Just to make sure we're all on the same page, can you post an example of your "root element", please?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pillip
Premium Member
Premium Member
Posts: 50
Joined: Thu Dec 10, 2009 10:43 am

Post by pillip »

Root element is "the parent" of all other elements.

Format :

<root>
<child>
<subchild>.....</subchild>
</child>
</root>

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK, that much I know, was looking for something more... specific, example wise. :wink:

Not sure why you're not getting that unless you've enabled the 'chunk' (off the top of my head) property or left off the leading slash. Perhaps it might help to post the XPath Expressions you are using?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pillip
Premium Member
Premium Member
Posts: 50
Joined: Thu Dec 10, 2009 10:43 am

Post by pillip »

Below is the format required :

<note ElementID="x">
- <Table>
<MANDT>n1</MANDT>
<MATNR>n2</MATNR>
<SPRAS>n3</SPRAS>
<MAKTX>n4</MAKTX>
<MAKTG>n5</MAKTG>
</Table>
- </Table>
<MANDT>p1</MANDT>
<MATNR>p2</MATNR>
<SPRAS>p3</SPRAS>
<MAKTX>p4</MAKTX>
<MAKTG>p5</MAKTG>
</Table>
'
'
'
'
'
'
-</note >


what xpath expressions do i need to use for the root(arrayofmaterialdescriptions). Here note is the root element and Table is the child element, whch has the other elements.

I am unable to get the root element.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Do you have an xsd for this target? If so, then import the metadata from it and the Importer will automatically generate the proper XPath Expressions for you. If not... post what you are using now.
-craig

"You can never have too many knives" -- Logan Nine Fingers
eostic
Premium Member
Premium Member
Posts: 3838
Joined: Mon Oct 17, 2005 9:34 am

Post by eostic »

The root is usually going to be the first string in your Description property on the input link of your XMLOutput Stage...... EVERY column will have the same value for that first string.....so, I would exect, in your job, to see every Description starting with /arrayofmaterialdescriptions/...

Sometimes, when the repetition isn't right you will get incorrectly get duplicates of your desired root, but you should always get the string....

Ernie
Ernie Ostic

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