XML Input Stage
Moderators: chulett, rschirm, roy
XML Input Stage
Hello
I have job design with Seq File stage (4 Columns) that reads an xml file and passes it to XML Inout stage.
[b]Source XML File: -
<artist> Bee Gees
<company>COLUMBIA</company>
<price>10</price>
<year>1985</year>
</artist>
<country>USA</country> [/b]
The target is Seq file stage with "|" demiliter.
I get an output that looks like this
[i][b]Bee Gees
|COLUMBIA|10|1985|USA|[/b][/i]
Any pointers on how I can organize this row in a single line.
TIA
vick
I have job design with Seq File stage (4 Columns) that reads an xml file and passes it to XML Inout stage.
[b]Source XML File: -
<artist> Bee Gees
<company>COLUMBIA</company>
<price>10</price>
<year>1985</year>
</artist>
<country>USA</country> [/b]
The target is Seq file stage with "|" demiliter.
I get an output that looks like this
[i][b]Bee Gees
|COLUMBIA|10|1985|USA|[/b][/i]
Any pointers on how I can organize this row in a single line.
TIA
vick
The XPath on the output/columns tab has the following
artist/text()
artist/company/text()
artist/company/price/text()
so on so forth...
I assume that the input/columns tab does'nt require an Xpath. Pl correct me.
The xml file file format is making the output format go awry.
I 'm using the TFR TRIM function but to no avail.
Appreciate responses
artist/text()
artist/company/text()
artist/company/price/text()
so on so forth...
I assume that the input/columns tab does'nt require an Xpath. Pl correct me.
The xml file file format is making the output format go awry.
I 'm using the TFR TRIM function but to no avail.
Appreciate responses
You might want to explain what this means. It looks like you may be picking up a <CR> in the artist element - do that mean you are trying to remove it? Post your derivation.gsym wrote:I 'm using the TFR TRIM function but to no avail.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Craig
You got it. <CR> it is. But not able to fig out a eliminate the <CR>
The derivation of the source xml file
<artist>Bee Gees
<company>COLUMBIA</company>
<price>10</price>
<year>1985</year>
</artist>
<country>USA</country>
If I modify the derivation it works perfect. But I expect to get the file in above mentioned format and obviously I cant modify a mil of those.
TIA
You got it. <CR> it is. But not able to fig out a eliminate the <CR>
The derivation of the source xml file
<artist>Bee Gees
<company>COLUMBIA</company>
<price>10</price>
<year>1985</year>
</artist>
<country>USA</country>
If I modify the derivation it works perfect. But I expect to get the file in above mentioned format and obviously I cant modify a mil of those.
TIA
You might need to translate this into PX, but EReplace or Convert can do that for you:
Would replace each CR with an empty string, in essence removing it.
Code: Select all
EReplace(YourField,CHAR(13),"")
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Curious... does this file come from a Windows system? If you view the file in vi and ":set list" does a ^M show up at the end of each line? If so, ensure the file is transferred to your UNIX server via an ASCII transfer to eliminate those as an issue.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Nope. This was not created from a windows system. A $ shows up @ the end and ^I @ the start.
I used the Convert fucntion [Convert (DSLink.artist, CHAR (13), "")but it removes the 1st line frm the record.
Original Output Record
Bee Gees
|COLUMBIA|10|1985|USA|
After the use of Convert Function
|COLUMBIA|10|1985|USA|
I used the Convert fucntion [Convert (DSLink.artist, CHAR (13), "")but it removes the 1st line frm the record.
Original Output Record
Bee Gees
|COLUMBIA|10|1985|USA|
After the use of Convert Function
|COLUMBIA|10|1985|USA|
That was EReplace syntax, the syntax for Convert is different:
Try it that way and see if it helps.
Code: Select all
Convert(CHAR(13),"",DSLink.artist)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Nope Craig. It does'nt. I tried CompactWhiteSpace and TrimLeadingTrailing functions but the result is same.
<CR> comes into picture coz of the XML input file derivation and needs to be eliminated.
Just thinking aloud if there's something else that could be used other than TFR.
Any pointers.
Thanks a bunch for the previous responses.
<CR> comes into picture coz of the XML input file derivation and needs to be eliminated.
Just thinking aloud if there's something else that could be used other than TFR.
Any pointers.
Thanks a bunch for the previous responses.