0

I have to write values as below by reading the values from a text file

Text File:

123|John

XML file to generate:

<Member>
<Person Type="ID">123</Person>
<Person Type="Name">John</Person>
</Member>

XAPTH I am using:

For writing the value for attribute value ID

/Member/Person[@Type="ID"]

For writing the value for attribute value Name

/Member/Person[@Type="Name"]

But in the output, I am getting the XML file as

<Member>
<Person Type="ID">
123
John
</Person>
<Member>

Attribute value "Name" is missing

Any help is much appreciated

Markus
  • 3,155
  • 2
  • 23
  • 33
tradersjoe
  • 37
  • 4
  • Your question doesn't make sense at all. XPath is for selecting elements from XML files, and not for reading text files or writing XML files. So there is no use for XPath in your task. – Markus Oct 21 '16 at 06:57
  • please post a sample of your input and your desired output; I assume your text file contains a well-formed xml document? – Jayvee Oct 21 '16 at 09:33
  • Hey , Thanks for taking your time to respond. I am using IBM Datastage tool to read a text file and then convert to XML file. – tradersjoe Oct 21 '16 at 12:34
  • So I have to give XPATH for fields to generate a XML file from any fields i extract from a text file. I have a seme colon delimited file with 123;John. Now I have to extract this semi colon delimited file into an XML file by having 123 as "ID" Attribute value and John as "Name" attribute value – tradersjoe Oct 21 '16 at 12:45

0 Answers0