Bob, 

 

The wipkeys array returned from selectPath() method is just a copy, it's
not a live object in XMLBeans structures, so modifying it will not
change the original document.

 

You should call wipkeys[0].set(keys.getWIPKEYS()); or locate it's parent
and call parent.setWIPKEYS(keys.getWIPKEYS()) .

 

Cezar

 

________________________________

From: bob bob [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 15, 2007 1:25 PM
To: user@xmlbeans.apache.org
Subject: 2nd Post. Help! Search and Replace...Re: How to edit data in a
specific part of an XMLObject

 

Anyone?

Basically I want a search and replace. I can grab the XMLObject
(WIPKEYSDocument) but can't replace it with another 

WIPKEYSDocument.
Please?! Anyone?


 

----- Original Message ----
From: bob bob <[EMAIL PROTECTED]>
To: user@xmlbeans.apache.org
Sent: Tuesday, August 14, 2007 3:52:32 PM
Subject: How to edit data in a specific part of an XMLObject

I have and XMLObject node I find by using an XPath expression in my
XMLObject root element (XMLINIDocument). It finds this XMLObject (there
is only one instance) but I want to replace it with another one. How do
I do this?

 

** XML DOCUMENT **

 

<XMLINI>

  <CONFIG>

    <SERVICES>

      <SERVICE>

        <WIPKEYS>

          I WANT TO REPLACE THIS DATA

        </WIPKEYS>

.....

</XMLINI>

 

 

** CODE **

 

  // Load entire XML document

  XMLINIDocument config = XMLINIDocument.Factory.parse(editor.getText(),
validateOptions);

  // Create xpath to the node we wish to replace

  String wipQueryExpression = "declare namespace
xq='http://skywire.com/ccm/global';" +
 
"$this/xq:XMLINI/xq:CONFIG/xq:SERVICES/xq:SERVICE/xq:WIPKEYS";

 

  // XMLObject found through XPath.  This is the one I want to replace
with the new one.
  WIPKEYSDocument.WIPKEYS[] wipkeys = (WIPKEYSDocument.WIPKEYS[])
config.selectPath(wipQueryExpression);

  // Got XML data from server and loaded it into a WIPKEYSDocument and
wish to replace the wipkeys above with this one

  WIPKEYSDocument keys = WIPKEYSDocument.Factory.parse(serverData,
validateOptions);

  // This kind of substitution does not work

  wipkeys[0] = keys.getWIPKEYS();

 

  // Then I save it at the end

  config.save(new File("war/WEB-INF/xml/global.xml"));
  

 

Any ideas?

Thx,

Bob

 

________________________________

Moody friends. Drama queens. Your life? Nope! - their life, your story.
Play Sims Stories at Yahoo! Games.
<http://us.rd.yahoo.com/evt=48224/*http:/sims.yahoo.com/> 

 

 

________________________________

Shape Yahoo! in your own image. Join our Network Research Panel today!
<http://us.rd.yahoo.com/evt=48517/*http:/surveylink.yahoo.com/gmrs/yahoo
_panel_invite.asp?a=7>  


Notice:  This email message, together with any attachments, may contain 
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated 
entities,  that may be confidential,  proprietary,  copyrighted  and/or legally 
privileged, and is intended solely for the use of the individual or entity 
named in this message. If you are not the intended recipient, and have received 
this message in error, please immediately return this by email and then delete 
it.

Reply via email to