At several ocassions while XOG'ing between environments, you face an issue of XOG returning an error because of special characters inside the XOG XML file being pushed. Mostly these are special characters that XOG doesn't like and those are mostly not detected via Visual inspection. For quite some time, I have been using simple but effective method to Remove those special characters from XOG file(s).
Step 1 : Open XOG file in TextPad (or any Text editor supporting Regular Expression Search/Replace feature)
Step 2 : Press F8 to open Replace window and Do Find/Replace as :-
Find : [^&;:()a-zA-Z0-9" =./><_-~-]
Note : If you find any other character which should be there but found in search, include in above expression after &. Be careful if you are choosing "Replace All" option as you may blank out character(s) which were actually needed to be XOG file. Secondly, if you have many files to 'Sanitize' then load all those document in Textpad and set the 'Scope' to 'All documents' in Find/Replace search dialog box.
As per Martti's question/suggestion I am sharing method for removing Non-English Language codes from XOG file.
Step 1 : In Textpad > Configure > Preferences .. > Editor > Check "Use POSIX Regular Expression Syntax"
Step 2 : Search and Replace blank for .*<nls.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in Single line)
Step 3 : Search and Replace blank for .*<nls.*\n.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in 2 lines)
Step 4 : Search and Replace blank for .*<nls.*\n.*\n.*languageCode="([^e].|.[^n]).*\n (This will remove languageCode appearing in 3 lines)
To Test you can try this sample XOG file. These regular expression examples above are for "en" languageCode and include/exclude other Language codes by making changes in above regular expressions. Explaining these expression would be lengthy so just leave your comments if you have any specific question or need, I would reply your queries.
3 years ago