File Parsing and Editing Help

Matt Picone EMAIL HIDDEN
Tue Dec 8 04:22:07 CET 2009


-Barians,

I am working on a software project (music related!) which involves an 
XML file. I lack the knowledge required to perform some specific edits.

What I have to do is identify all instances of a certain construction in 
the text and change the case of certain characters found therein.

The construction is consistent: it always begins with "item", followed 
by a 1-3 digit number (1, 11, 111), an equal sign, quotation marks, some 
VALUE, and then the close quotes.

I want to change the CASE of the VALUE from ALL CAPS to Intial Caps. 
Initial Caps locations are designated as those which begin the string, 
follow a hypen, space, or forward slash.

Ideally, I'd like to have an exceptions list, or a follow on procedure 
to correct certain entries which should be excepted (ex: ms, Hz, LED, etc.)

There are typically multiple "item" entries found in succession. They'll 
always be preceded and followed by unrelated material.

Example:

I want to change:

<Parameter effectType="MultiTap" effectID="114" paramType="INT" 
paramID="35" default="0" minimum="0" maximum="8" precision="0" unit="" 
numVals="9" item0="QUAD-TAP" item1="PLEX DELAY" item2="PLEX DETUNE" 
item3="PLEX SHIFT" item4="BAND DELAY" item5="QUAD-SERIES" item6="TEN-TAP 
DLY" item7="RHYTHM TAP" item8="DIFFUSOR"/><Parameter 
effectType="MultiTap" effectID="114" paramType="LIN" paramID="36" 
default="21" minimum="0.01" maximum="60" precision="2" unit="sec" 
numVals="255"/>

To:

<Parameter effectType="MultiTap" effectID="114" paramType="INT" 
paramID="35" default="0" minimum="0" maximum="8" precision="0" unit="" 
numVals="9" item0="Quad Tap" item1="Plex Delay" item2="Plex Detune" 
item3="Plex Shift" item4="Band Delay" item5="Quad Series" item6="Ten-Tap 
Delay" item7="RHYTHM TAP" item8="DIFFUSOR"/><Parameter 
effectType="MultiTap" effectID="114" paramType="LIN" paramID="36" 
default="21" minimum="0.01" maximum="60" precision="2" unit="sec" 
numVals="255"/>

I need to perform this scrub easily and repeatedly over time. What do 
you recommend I use to make this change throught the file? RegEx? PERL? 
Something else?

Any tips pointers, or outright assistance will be blatantly rewarded.

Thanks!

-m@




More information about the music-bar mailing list