[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
edit xml config files whith cfengine
From: |
Uli Knauss |
Subject: |
edit xml config files whith cfengine |
Date: |
14 May 2004 09:09:25 -0700 |
Hello,
I have to check and edit many xml-Files with cfengine.
The xml-Files looks like this example:
<< -- snipp -- >>
<datasources>
<data>
<id>foot01</id>
<files>
<filename1>foo-file01</filename1>
<filename2>foo-file02</filename2>
</files>
</data>
<datasource>
<id>foo01</id>
<database>
<user>foo-user01</user>
<pwd>foo-password01</pwd>
<use>true</use>
<connections>
<waittime>2000</waittime>
</connections>
</database>
<id>foo02</id>
<database>
<user>foo-user02</user>
<pwd>foo-password02</pwd>
<use>true</use>
<connections>
<waittime>2000</waittime>
</connections>
</database>
</datasource>
</datasources>
<< -- snapp -- >>
For example: I have to change/check the value "<use> </use>" to
"false" but only in datasource "<id>foo01</id>", not in
"<id>foo02</id>" or on other places in the file.
My solution for now is first to search for "<datasource>". After this
I search for "<id>foo01</id>" and then I look for "<use>...</use>" and
change the line regardless if the line is correct or not. This looks
in the cfengine program like this:
<< -- snipp -- >>
editfiles:
{ /tmp/foo.xml
LocateLineMatching '.*<datasource>'
LocateLineMatching '.*<id>foo01<\/id>'
LocateLineMatching '.*<use>.*<\/use>'
ReplaceLineWith '<use>false</use>'
}
<< -- snapp -- >>
May be somebody have a better idea or a shorter solution to edit
xml-files. Is there a facilty to edit XML-Files in a proper way?
Thanks for any hints
Uli
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- edit xml config files whith cfengine,
Uli Knauss <=