Sublime Forum

Data Validation for a Batch of XML Files?



I am new to sublime text and was wondering if it is the right tool for one of my problems.

I would like to examine a batch of XML files and see if values within some tags are <= to certain values, all at once.

The find-all feature works great, though I wonder if it can find values <= to other values, and only show that and not all the instances of the find. I’ve looked into some plugins but most I find that may help aren’t for XML, usually for Python.

Finally, I was thinking maybe I could run some PHP code to do this…? Maybe I’m way off there. Again, I’m new to Sublime Text:)

Thanks for any suggestions or help you can offer,



are you able to show some examples? maybe the xpath or Exalt plugins will be of use. Writing PHP code is potentially possible, but I guess you’d still need Python to update the selections based on the output from your PHP script…



thanks for sharing,



Thanks for the quick response!

My XML files have sensitive information in them, but below is a screenshot of what I’m currently doing. In the screenshot you can see I use the find-in-files feature to find all the instances of variable. I’d like to evaluate the value associated with variable and see if it is less than or equal to 70, do some light math like add, subtract, multiply, and divide the values, and get only the values that do not meet certain conditions to appear in the Find Results file, or another file or format. I would be doing the evaluation on around 100 XML files at a time.

I have limited knowledge on how to use python to update the selections like you mentioned KingKeith. I can figure it out but can you provide a bit more information about it to get me started?

Thanks for the help!