473,396 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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
0 4909

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

Similar topics

0
by: bdinmstig | last post by:
I am building various framework components for my team to use in development, and one of those components is a Facade for reading/writing user preferences. The idea is that preference settings...
1
by: bdinmstig | last post by:
I refined my attempt a little further, and the following code does seem to work, however it has 2 major problems: 1. Very limited support for XPath features Basic paths are supported for...
2
by: Felicity | last post by:
Hello, The following XML file shows an example of some config data for a Side Button Bar control. There are two forms this Button Bar control relates to, "frmMainMenu" and "Listing". <?xml...
4
by: Ken Getz | last post by:
Hi. I have an xml file in this format: <strings> <string>Item1</string> <string>Item2</string> <string>Item3</string> <string>Item4</string> </string> I'm looking for the best way to...
1
by: Mike | last post by:
Hi, I'm a complete newbie to XML and am needing to rush through a job requiring far more knowledge than I have the time to gather. Basically... I need to build a breadcrumb menu for our...
2
by: nick_tucker | last post by:
Hi, I am very new to XML and XPATH. I have made a sample XML fileto ask my question. <?xml version="1.0" encoding="utf-8"?> <Test> <A> <B> <C> <D>
2
by: Bilal | last post by:
Hello, I'm stuck on this problem for quite some time and hope somebody would be able to guide me. Basically, I need to populate a large number of "template" XML files which have all...
2
by: luthriaajay | last post by:
I need some help to extract the LatestFillQuantity element value using XPATH. in Java. I am unable to extract the value of 10000. Please help as to what have I done wrong.? Help appreciated. ...
7
by: messagewalker | last post by:
Hi guys, I wanted to know how to set node value using xpath, for example <root> <name></name> </root> what I want is get the node 'name' and set its value to say 'bob', so it will be like...
7
by: swami | last post by:
What is the query for selecting non duplicate elements for eg: no name age 1 siva 28 2 blair 32 3 mano 28 i want to select blair which hasn't got any duplicate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.