I have to edit a large xml file and its contents and it would take me hours. So i was wondering if VS code or any other editor has a function where i could specify a field and multiply it by some value.
CodePudding user response:
You can use the extension Regex Text Generator
- select the field content (the number) in any way you like with Multi Cursor
- Start
Generate text based on regular Expression
- for original regex type:
(\d )
or([\d.] )
for floats - for generator regex type:
{{=N[1]*3.1415}}
change factor for your factor
CodePudding user response:
You could do this as an XSLT transformation.
Or if it's a one-off, you could consider using the Saxon Gizmo tool. To increase all prices by 20%:
>java net.sf.saxon.Gizmo -s:source.xml
/>update //price with .*1.2
/>save source2.xml
/>quit
Further details at https://www.saxonica.com/documentation11/index.html#!gizmo