
Quote from ebear on December 9, 2018, 11:05 pmHello All,
I have an question about replacing or changing one or multiple line(s) in an xml file. Below a part of the xml file.
I want to replace or change the value of <FilterColor>0,255,0</FilterColor>. The RGB value can be different everytime, and can be multiple times be in the xlm file.Is there anyway in VisualNEO to open the xlm file and replace the value of these <FilterColor> elements.
Best regards,
Eric Beerhorst
<Command>
<Type>Graphics</Type>
<Description>Graphics: Rectangle.png [SVR134_LOW_2:5EF501039_Present]</Description>
<FileName>Rectangle.png</FileName>
<X>1290</X>
<Y>760</Y>
<Width>70</Width>
<Height>130</Height>
<FilePath>C:\Program Files\Myprogram\Graphics\Rectangle.png</FilePath>
<FilterColor>0,255,0</FilterColor>
</Command>
<Command>
<Type>Graphics</Type>
<Description>Graphics: Rectangle.png [SVR134_LOW_2:5EF501039_Present]</Description>
<FileName>Rectangle.png</FileName>
<X>480</X>
<Y>760</Y>
<Width>70</Width>
<Height>130</Height>
<FilePath>C:\Program Files\Myprogram\Graphics\Rectangle.png</FilePath>
<FilterColor>0,255,0</FilterColor>
</Command>
Hello All,
I have an question about replacing or changing one or multiple line(s) in an xml file. Below a part of the xml file.
I want to replace or change the value of <FilterColor>0,255,0</FilterColor>. The RGB value can be different everytime, and can be multiple times be in the xlm file.
Is there anyway in VisualNEO to open the xlm file and replace the value of these <FilterColor> elements.
Best regards,
Eric Beerhorst
<Command>
<Type>Graphics</Type>
<Description>Graphics: Rectangle.png [SVR134_LOW_2:5EF501039_Present]</Description>
<FileName>Rectangle.png</FileName>
<X>1290</X>
<Y>760</Y>
<Width>70</Width>
<Height>130</Height>
<FilePath>C:\Program Files\Myprogram\Graphics\Rectangle.png</FilePath>
<FilterColor>0,255,0</FilterColor>
</Command>
<Command>
<Type>Graphics</Type>
<Description>Graphics: Rectangle.png [SVR134_LOW_2:5EF501039_Present]</Description>
<FileName>Rectangle.png</FileName>
<X>480</X>
<Y>760</Y>
<Width>70</Width>
<Height>130</Height>
<FilePath>C:\Program Files\Myprogram\Graphics\Rectangle.png</FilePath>
<FilterColor>0,255,0</FilterColor>
</Command>

Quote from as3856 on December 13, 2018, 12:05 amHey.
The XML file can be edited in any text editor, and can also be edited with VisualNeo.Best regards,
as3856
Hey.
The XML file can be edited in any text editor, and can also be edited with VisualNeo.
Best regards,
as3856

Quote from HPW on December 13, 2018, 12:11 amHello,
I assume you are asking to do it by code.
I would check 2 Options.
Find and repace with regular expressions.
XML parsing with newlisp.
Regards
Hans-Peter
Hello,
I assume you are asking to do it by code.
I would check 2 Options.
Find and repace with regular expressions.
XML parsing with newlisp.
Regards
Hans-Peter
Quote from Gaev on December 13, 2018, 4:03 amEric:
This script might help you to understand how to make changes to text files (as stated above, XML files are just plain text files) ...
... these two variables can be populated via script or can be part of variables associated with TextEntry objects SetVar "fromColor]" "!0,255,0" SetVar "[toColor]" "!80,A0,C0" SetVar "[fromString]" "!<FilterColor>[fromColor]</FilterColor>" SetVar "[toString]" "!<FilterColor>[toColor]</FilterColor>" FileRead "[PubDir]myFile.xml" "All" "[myXmlContent]" StrReplace "[myXmlContent]" "[fromString]" "[toString]" "[myXmlContent]" "" FileWrite "[PubDir]myFile.xml" "All" "[myXmlContent]"
Eric:
This script might help you to understand how to make changes to text files (as stated above, XML files are just plain text files) ...
... these two variables can be populated via script or can be part of variables associated with TextEntry objects SetVar "fromColor]" "!0,255,0" SetVar "[toColor]" "!80,A0,C0" SetVar "[fromString]" "!<FilterColor>[fromColor]</FilterColor>" SetVar "[toString]" "!<FilterColor>[toColor]</FilterColor>" FileRead "[PubDir]myFile.xml" "All" "[myXmlContent]" StrReplace "[myXmlContent]" "[fromString]" "[toString]" "[myXmlContent]" "" FileWrite "[PubDir]myFile.xml" "All" "[myXmlContent]"