XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 18th, 2012, 03:03 PM
LaundryBoy LaundryBoy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Posts: 1 LaundryBoy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 m 10 sec
Reputation Power: 0
XML editing: adding elements to xml lists

To start, I have almost zero experience with XML scripting/language but do have programming skills with other languages... this is something i have taken on at the behest of a colleague since it seems i am the only one with any programming knowledge... I was wondering if it is possible to take an xml list and using a sed,awk or perl script pass it a list of xml elements(plugin names) and insert a value(session name) keeping within the formatting rules... so the final command would look like

Code:
$xml_edit file.xml plugin_list.txt SESSION3


plugin_list.txt would contain the values:

CopyAtValidation
CopyAtFinish

Given a snippet of file.xml:

Code:
   <plugin name="CopyAtValidation"
        <plugin-filter code="some_filter.java">
               <param name="SessionName" value="
                SESSION1,
                SESSION2"/>
        </plugin-filter>
    </plugin>

	   <plugin name="CopyAtStart"
        <plugin-filter code="some_filter.java">
               <param name="SessionName" value="
                SESSION1,
                SESSION2"/>
        </plugin-filter>
    </plugin>
		
	   <plugin name="CopyAtFinish"
        <plugin-filter code="some_filter.java">
               <param name="SessionName" value="
                SESSION1,
                SESSION2"/>
        </plugin-filter>
    </plugin>


I would like to add the value of SESSION3 to plugins CopyAtValidation and CopyAtFinish only so the final result looks like:

Code:
   <plugin name="CopyAtValidation"
        <plugin-filter code="some_filter.java">
               <param name="SessionName" value="
                SESSION1,
                SESSION2,
		SESSION3"/>
        </plugin-filter>
    </plugin>

	   <plugin name="CopyAtStart"
        <plugin-filter code="some_filter.java">
               <param name="SessionName" value="
                SESSION1,
                SESSION2"/>
        </plugin-filter>
    </plugin>
		
	   <plugin name="CopyAtFinish"
        <plugin-filter code="some_filter.java">
               <param name="SessionName" value="
                SESSION1,
                SESSION2,
		SESSION3"/>
        </plugin-filter>
    </plugin>



I do want to point out that when you do insert the new values you have to add a comma to the end of the line of the previous value... namely SESSION2 otherwise this wont work.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XML editing: adding elements to xml lists

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap