Page 1 of 1
Making Search and Replace Scripts, Buttons, and Macros
Posted: Wed Mar 05, 2025 5:45 am
by wrenloren
Hello! To convert DOCX files to XML for Braille creation, I'm using Oxygen XML 24.1. To search for and replace particular characters and groups of characters based on predetermined rules, I would love to write some scripts, buttons, or macros. For instance, when a "+" is followed by spaces or other combinations and just digits remain.
Are there any videos, tutorials, or other resources that anyone knows of that could be useful for these tasks? Since I occasionally handle up to 20 documents per day, each with a variety of permutations, I wish to speed this procedure. I'm grateful.
Re: Making Search and Replace Scripts, Buttons, and Macros
Posted: Wed Mar 05, 2025 12:27 pm
by Radu
Hi,
The ".docx" file is an archive, it can be opened in the Oxygen Archive browser view and contains inside a "document.xml". I assume you are converting it to your own XML vocabulary. How did you do that? Did you create an XSLT stylesheet which when applied on the document.xml creates the XML document you are interested in?
Oxygen's free batch documents converter add-on can convert Word to XHTML or DITA XML if you want to get to an XML format which may be closer to your target XML vocabulary and easier to process:
https://www.oxygenxml.com/doc/ug-addons ... addon.html
About your search/replace needs, do you need those in order to further post process the text in the converted XML document.
Oxygen's Find/Replace dialog has support to enable regular expression matching:
https://www.oxygenxml.com/doc/versions/ ... ialog.html
If you are not familiar with regexp matching maybe you can use ChatGPT to generate regular expressions based on your needs, give it an example of what you want to match, ask for a regular expression pattern and then use it in Oxygen's Find/Replace dialogs.
Regards,
Radu