darshanaltekar
7th March 2007 11:41 UTC
problem while writing XML
i have one XML file as
<?xml version="1.0" encoding="utf-8"?>
<Preference>
<MessageSetting AutoStart="False" RUserPassword="True">
<UserID>123123</UserID>
<UserPassword>VvetqIEfbbA=</UserPassword>
<OrganizationIDList> <OrganizationID>ABC_MORTGAGE</OrganizationID>
</OrganizationIDList>
<RecentOrgID>ABC_MORTGAGE</RecentOrgID>
</MessageSetting>
<preferences>
In this file i have to add(not replce) node at organisation id ie add another organisation id in organisation list How can i do this?
I'm using nsisXML plugin
${nsisXML->CreateElement}
but its giving eroor
It'll be very helpful if some one can give me code example
Joel
7th March 2007 20:00 UTC
Your:
<?xml version="1.0" encoding="utf-8"?>
><Preference>
<MessageSetting AutoStart="False" RUserPassword="True">
<UserID>123123</UserID>
<UserPassword>VvetqIEfbbA=</UserPassword>
<OrganizationIDList> <OrganizationID>ABC_MORTGAGE</OrganizationID>
</OrganizationIDList>
<RecentOrgID>ABC_MORTGAGE</RecentOrgID>
</MessageSetting>
<preferences>
Should:
<?xml version="1.0" encoding="utf-8"?>
><Preference>
<MessageSetting AutoStart="False" RUserPassword="True">
<UserID>123123</UserID>
<UserPassword>VvetqIEfbbA=</UserPassword>
<OrganizationIDList>
<OrganizationID>ABC_MORTGAGE</OrganizationID>
</OrganizationIDList>
<RecentOrgID>ABC_MORTGAGE</RecentOrgID>
</MessageSetting>
</preferences>
onad
8th March 2007 13:03 UTC
One could try to improve the XML Plugin e.g. by stripping spaces first and ten evaluate.
Note: Valid XML not called "file" but "Document"
Backland
8th March 2007 13:51 UTC
As Joel corrected, the OPs root element wasnt closed (not sure if this was the issue), but it cant hurt to validate the XML.
darshanaltekar
8th March 2007 14:31 UTC
guys soory to put the wrong doc but i have checked the file & root element is closed properly in it i just need the code to add elements to <OrganizationID> (multiple elements)
Comm@nder21
8th March 2007 15:31 UTC
<Preference>
...
</preferences>
should be either "Preference" or "preferences" in both cases...
darshanaltekar
8th March 2007 15:42 UTC
<Preference>
</Preference>
guys i'm telling u there is no problem with XML please just tell me how can i add more than one OrganizationID's
ie
<OrganizationID>1234</OrganizationID>
<OrganizationID>5678</OrganizationID>
<OrganizationID>9012</OrganizationID>
i need code some problem with code that i wrote i'm new to both NSIS & XML
Joel
8th March 2007 16:39 UTC
If you are using my plugin see example-2.nsi