Skip to content
⌘ NSIS Forum Archive

problem while writing XML

8 posts

darshanaltekar#

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#
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#
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#
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#
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#
<Preference>
...
</preferences>
should be either "Preference" or "preferences" in both cases...
darshanaltekar#
<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