Forums de Wizou
http://wiz0u.free.fr/forum/

issue in update a property value in XML
http://wiz0u.free.fr/forum/viewtopic.php?f=11&t=2327
Page 1 of 1

Author:  rajprabuit [ Mon 10 Aug 2015, 14:55 ]
Post subject:  issue in update a property value in XML

Hi Wizou,

Here is my XML file:
<?xml version="1.0" encoding="utf-8"?>
<project name="Production" xmlns="http://nant.sf.net/release/0.90/nant.xsd>
<property name="database.name" value="HUBServer"/>
</project>


Here is my code to update above XML file
nsisXML::create
nsisXML::load ${ConfigFile}
nsisXML::select "/project/property[@name='${Name}']"
nsisXML::setAttribute "value" ${Value}
nsisXML::save ${ConfigFile}

The above code is working fine for me, if the XML file doesn't contain XMLNS.

But the above XML file contains XMLNS. So that I couldn't update that file.

Could you please help me to fix the above issue.

Thanks in Advance,
Raja

Author:  Wizou [ Mon 28 Sep 2015, 21:42 ]
Post subject:  Re: issue in update a property value in XML

Try this:
<project name="Production" xmlns="http://nant.sf.net/release/0.90/nant.xsd" xmlns:myns="http://nant.sf.net/release/0.90/nant.xsd">

and then:
nsisXML::select "/myns:project/property[@name='${Name}']"

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/