By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,483 Members | 1,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,483 IT Pros & Developers. It's quick & easy.

How to set node values for Duplicate Elements in Xml using Xpath in java.

P: 1
I want to set node values for serviceRetailerName which are duplicate in xml. Only first node element nodeValue is setting and other elements are storing empty.

INPUT:
-----
Expand|Select|Wrap|Line Numbers
  1. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:imp="http://implementation.web.api.icc.services.osp.in.alcatel.com" xmlns:xsd="http://pojo.web.api.icc.services.osp.in.alcatel.com/xsd"> <soapenv:Header/> <soapenv:Body> <imp:create>  <imp:subscriberLine> <xsd:defaultAccount> <xsd:serviceRetailerName></xsd:serviceRetailerName> </xsd:defaultAccount> <xsd:friendAndFamilyList> <xsd:serviceRetailerName></xsd:serviceRetailerName> </xsd:friendAndFamilyList> <xsd:defaultComOfferSubscription> <xsd:serviceRetailerName></xsd:serviceRetailerName> </xsd:defaultComOfferSubscription> </imp:subscriberLine> </imp:create> </soapenv:Body> </soapenv:Envelope>
OutPut
------
Expand|Select|Wrap|Line Numbers
  1. <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:imp="http://implementation.web.api.icc.services.osp.in.alcatel.com" xmlns:xsd="http://pojo.web.api.icc.services.osp.in.alcatel.com/xsd"> <soapenv:Header/> <soapenv:Body> <imp:create>  <imp:subscriberLine> <xsd:defaultAccount> <xsd:serviceRetailerName>sdapprov</xsd:serviceRetailerName> </xsd:defaultAccount> <xsd:friendAndFamilyList> <xsd:serviceRetailerName/> </xsd:friendAndFamilyList> <xsd:defaultComOfferSubscription> <xsd:serviceRetailerName/> </xsd:defaultComOfferSubscription> </imp:subscriberLine> </imp:create> </soapenv:Body> </soapenv:Envelope>
Please Check "<xsd:serviceRetailerName/>" node value is not setting. Please help me to resolve this issue.
Nov 20 '15 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.