Below is  my xml file. The root is JposEntries and it has 4 elements
(JposEntry)

I want to make a clone of 4 elements inside my root element. How do I do
that? I know how to make a clone of an element but how to go @ this one?

 

<?xml version="1.0" encoding="UTF-8"?>

<JposEntries>

    

    <JposEntry logicalName="i6550_form1">

        <prop name="ItemDisplay" type="String" value="item.icg"/>

      </JposEntry>

    

    <JposEntry logicalName="i6550_msr1">

        <prop name="disableMsr" type="Boolean" value="false"/>

      </JposEntry>

    

    <JposEntry logicalName="i6550_pp1">

        <prop name="flowControl" type="String" value="Xon/Xoff"/>

      </JposEntry>

        

    <JposEntry logicalName="i6550_sg1">

        <prop name="flowControl" type="String" value="Xon/Xoff"/>

   </JposEntry>

    

</JposEntries>

 

Thanks,

Devang

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Devang
Joshi
Sent: Tuesday, March 13, 2007 5:07 PM
To: dom4j-user@lists.sourceforge.net
Subject: [dom4j-user] How to remove Element from Document

 

I am trying to delete first device element from my xml document.

iterateToDevicePosition() function returns me the first device element,

But doc.remove() did not work for me. (Note: doc has the parsed xml

file)

 

//Now delete the first device element

Element dummyElem = iterateToDevicePosition();

//Now dummy element has the element I want to remove

doc.remove(dummyElem); //This does not remove it from the doc???

 

Thanks,

Devang

 

-----Original Message-----

From: [EMAIL PROTECTED]

[mailto:[EMAIL PROTECTED] On Behalf Of Evan S.

Kirkconnell

Sent: Tuesday, March 13, 2007 7:52 AM

To: dom4j-user@lists.sourceforge.net

Subject: Re: [dom4j-user] convert String to Element

 

(Element)DocumentHelper.parseText(xml).getRootElement().detach()

 

As a forewarning, I think this creates the element in the null

namespace.  If you need it in the xhtml namespace, you may have to do a

little more work.

--Evan

 

----- Original Message -----

From: Devang Joshi <[EMAIL PROTECTED]>

Date: Monday, March 12, 2007 4:44 pm

Subject: [dom4j-user] convert String to Element

To: dom4j-user@lists.sourceforge.net

 

> I am trying to create clone of element then convert the element to

> string. Do some string manipulation and then convert the string 

> back to

> element.  

> 

> //***This will insert new elements inside the clone*** 

> Element newElement = (Element) currElement.clone(); 

> 

> //***We need to replace few values in the new element so convert to

> string*** 

> String strElem = newElement.asXML(); 

> 

> // Do something with string (internal logic) 

> 

> How do I convert string to element and insert that in my xml

> document????????????????????????? 

> 

> //this would put the element in the doc 

> this.insertElementAt(newElement, this.root.indexOf(currElement)+1);

> 

> 

> 

> Thanks,

> 

> Devang

> 

> 972-550-2746

> 

> 

> 

> 

 

------------------------------------------------------------------------

-

Take Surveys. Earn Cash. Influence the Future of IT

Join SourceForge.net's Techsay panel and you'll get the chance to share

your

opinions on IT & business topics through brief surveys-and earn cash

http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE

V

_______________________________________________

dom4j-user mailing list

dom4j-user@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/dom4j-user

 

------------------------------------------------------------------------
-

Take Surveys. Earn Cash. Influence the Future of IT

Join SourceForge.net's Techsay panel and you'll get the chance to share
your

opinions on IT & business topics through brief surveys-and earn cash

http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDE
V

_______________________________________________

dom4j-user mailing list

dom4j-user@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/dom4j-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to