# How to edit xml file?

**URL:** <https://www.ruby-forum.com/t/how-to-edit-xml-file/158427>\
**Category:** Rails\
**Created:** [January 23, 2009, 6:45am UTC](https://www.ruby-forum.com/t/how-to-edit-xml-file/158427 "2009-01-23T06:45:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin\_mercy2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@martin\_mercy2001](https://www.ruby-forum.com/u/martin_mercy2001)\
**Post date:** [January 23, 2009, 6:45am UTC](https://www.ruby-forum.com/t/how-to-edit-xml-file/158427/1 "2009-01-23T06:45:39Z")

</div>

Dear all,

I have an xml server settings file and iam in process of editing the xml  
server settings file. could anyone suggest me how to edit the xml file.

My xml file.

 /home/user/pictures 192.168.0.111

I need to edit the above xml file with new port value. Please suggest  
how to edit the existing xml file.

Thanks in advance

Regards,  
Jose Martin

---

<div class="post-metadata">

**Author:** ![martin\_mercy2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@martin\_mercy2001](https://www.ruby-forum.com/u/martin_mercy2001)\
**Post date:** [January 23, 2009, 7:01am UTC](https://www.ruby-forum.com/t/how-to-edit-xml-file/158427/2 "2009-01-23T07:01:11Z")

</div>

On Thu, Jan 22, 2009 at 9:45 PM, dare ruby  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I need to edit the above xml file with new port value. Please suggest  
> how to edit the existing xml file.

With any available text editor.

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![martin\_mercy2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@martin\_mercy2001](https://www.ruby-forum.com/u/martin_mercy2001)\
**Post date:** [January 23, 2009, 7:05am UTC](https://www.ruby-forum.com/t/how-to-edit-xml-file/158427/3 "2009-01-23T07:05:29Z")

</div>

Thanks Hassan

> With any available text editor.

but i need to edit using ruby code.

Please suggest on how to edit using ruby code?

Thanks in advance

Regards,  
Jose Martin

---

<div class="post-metadata">

**Author:** ![martin\_mercy2001](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@martin\_mercy2001](https://www.ruby-forum.com/u/martin_mercy2001)\
**Post date:** [January 23, 2009, 5:02pm UTC](https://www.ruby-forum.com/t/how-to-edit-xml-file/158427/4 "2009-01-23T17:02:04Z")

</div>

On Thu, Jan 22, 2009 at 10:05 PM, dare ruby  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Please suggest on how to edit using ruby code?

This is a short intro to working with XML in Ruby:

[http://www.xml.com/pub/a/2005/11/09/rexml-processing-xml-in-ruby.html](http://www.xml.com/pub/a/2005/11/09/rexml-processing-xml-in-ruby.html)

See if that doesn’t get you started 🙂

## FWIW,

Hassan S. ------------------------ removed\_email\_address@domain.invalid
