Trying to output an XML value into the filename
Posted: Sat Dec 15, 2007 12:25 am
I'm trying to get a filter that checks XML files for a specific element value(<CountryofFinalDestinationCode>) then outputs the filename with that element value. For example if file is test1.txt and value is US it appears as test1_US.txt, if file is test2.txt value is AU it outputs test2_AU.txt. I also want the original file deleted so only the newly named one exists.
I created this filter but it (a) doesnt seem to work and (b) claims it cant delete the files because it seems to be trying to access them again
Filter List
-----------
Filter options
| [ ] Log to file
| [X] Append to logfile
| Log filename: textpipe.log
| Threshold 500
|
|--Input from file(s)
| [ ] Confirm before processing each file
| [ ] Confirm before processing read/only files
| [X] Delete input files after processing
| Process binary files
|
|--Restrict to between tags <CountryOfFinalDestinationCode Domain>...</CountryOfFinalDestinationCode Domain>
| | [ ] Include text
| | [ ] Match case
| | Max size: 65536
| |
| +--Capture to variable @CTRY
|
|--Restrict to file name
| |
| +--Perl pattern [TEST1] with [TEST1_@CTRY]
| [ ] Match case
| [ ] Whole words only
| [ ] Case sensitive replace
| [ ] Prompt on replace
| [ ] Skip prompt if identical
| [ ] First only
| [ ] Extract matches
| Maximum text buffer size 4096
| [ ] Maximum match (greedy)
| [ ] Allow comments
| [X] '.' matches newline
| [ ] UTF-8 Support
|
+--Output to file(s)
[ ] Only update date on changed files
[X] Keep original file's date and time
[ ] Append mode
[ ] Change extension to: .txt
[ ] Open output file
Backup mode
Any help appreciated.
thanks
I created this filter but it (a) doesnt seem to work and (b) claims it cant delete the files because it seems to be trying to access them again
Filter List
-----------
Filter options
| [ ] Log to file
| [X] Append to logfile
| Log filename: textpipe.log
| Threshold 500
|
|--Input from file(s)
| [ ] Confirm before processing each file
| [ ] Confirm before processing read/only files
| [X] Delete input files after processing
| Process binary files
|
|--Restrict to between tags <CountryOfFinalDestinationCode Domain>...</CountryOfFinalDestinationCode Domain>
| | [ ] Include text
| | [ ] Match case
| | Max size: 65536
| |
| +--Capture to variable @CTRY
|
|--Restrict to file name
| |
| +--Perl pattern [TEST1] with [TEST1_@CTRY]
| [ ] Match case
| [ ] Whole words only
| [ ] Case sensitive replace
| [ ] Prompt on replace
| [ ] Skip prompt if identical
| [ ] First only
| [ ] Extract matches
| Maximum text buffer size 4096
| [ ] Maximum match (greedy)
| [ ] Allow comments
| [X] '.' matches newline
| [ ] UTF-8 Support
|
+--Output to file(s)
[ ] Only update date on changed files
[X] Keep original file's date and time
[ ] Append mode
[ ] Change extension to: .txt
[ ] Open output file
Backup mode
Any help appreciated.
thanks