Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2001
    Posts
    498

    XML.SetValue Path

    I am attempting to use XML.SetValue to change the value of "Assistance" from "true" to "false", thus toggling the radio button in its group.

    When referencing the path, does the full path have to be referenced? I.E., AutoPlay\\Docs\\...? Then, based on the example, what is the proper path to change the value?

    After changing the value, is the XML.Save action required, or is the change written and saved to the XML file with the SetValue action?

    Code:
     
    <?xml version="1.0" encoding="iso-8859-1" ?> 
    - <menu lang="en">
    - <item label="File">
      <item label="Exit" /> 
      </item>
    - <item label="Documents">
    - <item label="Instructions">
      <item label="Standard Buttons" /> 
      <item label="Address Bar" /> 
      <item label="Links" /> 
      <item type="separator" /> 
      <item label="Lock the Toolbars" /> 
      </item>
    - <item label="Specifications">
      <item label="Standard Buttons" /> 
      <item label="Address Bar" /> 
      <item label="Links" /> 
      <item type="separator" /> 
      <item label="Lock the Toolbars" /> 
      </item>
    - <item label="References">
      <item label="Standard Buttons" /> 
      <item label="Address Bar" /> 
      <item label="Links" /> 
      <item type="separator" /> 
      <item label="Lock the Toolbars" /> 
      </item>
      </item>
    - <item label="Instruction">
    - <item label="Overview">
      <item label="Standard Buttons" type="check" selected="true" /> 
      <item label="Address Bar" type="check" selected="true" /> 
      <item label="Links" type="check" selected="true" /> 
      <item type="separator" /> 
      <item label="Lock the Toolbars" type="check" selected="true" /> 
      <item label="Customize…" /> 
      </item>
      <item label="Type 1" /> 
    - <item label="Type 2">
      <item label="Search" type="check" /> 
      <item label="Favorites" type="check" /> 
      <item label="Media" type="check" /> 
      <item label="History" type="check" /> 
      <item label="Folders" type="check" /> 
      </item>
      </item>
    - <item label="Options">
    - <item label="Assistance">
      <item label="On" type="radio" groupName="assistance" selected="true" /> 
      <item label="Off" type="radio" groupName="assistance" selected="false" /> 
      </item>
      <item type="separator" /> 
    - <item label="Narration">
      <item label="On" type="radio" groupName="narration" selected="true" /> 
      <item label="Off" type="radio" groupName="narration" selected="false" /> 
      </item>
      </item>
    - <item label="Help">
      <item label="Contents and Index" /> 
      <item type="separator" /> 
      <item label="Check for Update" /> 
      <item type="separator" /> 
      <item label="About…" /> 
      <item label="Program Support" /> 
      </item>
      </menu>
    Last edited by AXXESS; 09-01-2005 at 12:40 PM.

  2. #2
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    The full path needs to be referenced within the XML, not the PC's directory structure and the items contained within the <> will be attributes so you will want to XML.SetAttribute. For instance;

    XML.SetAttribute("menu/item:4/item:1/item:1", "selected", "false");
    XML.SetAttribute("menu/item:4/item:1/item:2", "selected", "true");

    The above is based on the file you posted, since all the strings are labled item, you have to specify which item number you want to modify. So the above will set item 4, item 1 and then item 1 to false and then item 4, item1, item 2 to true. I have created a tabed version posted below

    Code:
    <?xml version="1.0" encoding="iso-8859-1" ?> 
    - <menu lang="en">
    	- <item label="File">
    	  	<item label="Exit" /> 
    	</item>
    	- <item label="Documents">
    		- <item label="Instructions">
    			  <item label="Standard Buttons" /> 
    			  <item label="Address Bar" /> 
    			  <item label="Links" /> 
    			  <item type="separator" /> 
    			  <item label="Lock the Toolbars" /> 
    		  </item>
    		- <item label="Specifications">
    			  <item label="Standard Buttons" /> 
    			  <item label="Address Bar" /> 
    			  <item label="Links" /> 
    			  <item type="separator" /> 
    			  <item label="Lock the Toolbars" /> 
    		  </item>
    		- <item label="References">
    			  <item label="Standard Buttons" /> 
    			  <item label="Address Bar" /> 
    			  <item label="Links" /> 
    			  <item type="separator" /> 
    			  <item label="Lock the Toolbars" /> 
    		  </item>
    	</item>
    	- <item label="Instruction">
    		- <item label="Overview">
    			  <item label="Standard Buttons" type="check" selected="true" /> 
    			  <item label="Address Bar" type="check" selected="true" /> 
    			  <item label="Links" type="check" selected="true" /> 
    			  <item type="separator" /> 
    			  <item label="Lock the Toolbars" type="check" selected="true" /> 
    			  <item label="Customize…" /> 
    		  </item>
    		  <item label="Type 1" /> 
    		- <item label="Type 2">
    			  <item label="Search" type="check" /> 
    			  <item label="Favorites" type="check" /> 
    			  <item label="Media" type="check" /> 
    			  <item label="History" type="check" /> 
    			  <item label="Folders" type="check" /> 
    		  </item>
    	</item>
    	- <item label="Options"> menu/item:4
    		- <item label="Assistance"> menu/item:4/item:1
    			  <item label="On" type="radio" groupName="assistance" selected="true" />  menu/item:4/item:1/item:1
    			  <item label="Off" type="radio" groupName="assistance" selected="false" />  menu/item:4/item:1/item:2
    		  </item>
    		  <item type="separator" /> 
    		- <item label="Narration">
    			  <item label="On" type="radio" groupName="narration" selected="true" /> 
    			  <item label="Off" type="radio" groupName="narration" selected="false" /> 
    		  </item>
    	</item>
    	- <item label="Help">
    		  <item label="Contents and Index" /> 
    		  <item type="separator" /> 
    		  <item label="Check for Update" /> 
    		  <item type="separator" /> 
    		  <item label="About…" /> 
    		  <item label="Program Support" /> 
    	</item>
    </menu>
    And you will have to do a XML.Save to write the XML information back to a file. The changes you made above were made in memory.

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  3. #3
    Join Date
    Nov 2001
    Posts
    498
    Good call, Tigg! I was goofing around with both SetAttribute and SetValue for a couple hours... thanks for the help!

  4. #4
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    np glad it helped
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

Similar Threads

  1. How do I add to my PATH statement at install?
    By Tnygaard in forum Setup Factory 6.0
    Replies: 3
    Last Post: 05-27-2002, 01:38 AM
  2. Path problems in NT when executing file with spaces in path
    By tomarppe in forum Setup Factory 6.0
    Replies: 6
    Last Post: 03-21-2002, 02:01 PM
  3. PATH environment variable
    By RDodson in forum Setup Factory 6.0
    Replies: 4
    Last Post: 02-27-2002, 12:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts