Page 1 of 1

Change xml declaration

Posted: Mon Mar 14, 2022 1:47 am
by panar444
Hi, I am new in xml editing!!

I am currently modifing multiple xml files coming from ECG MUSE system. When I recieved these files, they were not only unidentified but the first 2 lines (declaration) was altered also. See below:

<?xml version="1.0"?>
<RestingECG>
<MuseInfo>
<MuseVersion>9.0.4.16760</MuseVersion>
</MuseInfo>
<PatientDemographics>....etc

Instead of:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE RestingECG SYSTEM "restecg.dtd">
<RestingECG>
<MuseInfo>
<MuseVersion>9.0.4.16760</MuseVersion>
</MuseInfo>
<PatientDemographics>.....etc

How can I correct the xml files with OXYGEN editor? I must do this in ca 1500 files, so to open each file in an editor in going to take a lot of time!!

Thank you in advance
PArvanitis

Re: Change xml declaration

Posted: Mon Mar 14, 2022 7:42 am
by Radu
Hi,

If the XML files have this heading:

Code: Select all

<?xml version="1.0"?>
this means they specify no encoding and the default XML encoding is "UTF-8" which is a better and more flexible encoding than ""ISO-8859-1"". So in my opinion it is not worth specifying the encoding in all XML files to be "ISO-8859-1". Maybe you can google for "utf-8 versus ISO-8859-1". UTF-8 can express a wider character range (for example Japanese, Chinese) than "ISO-8859-1" which is mostly suited for European languages.
If you still want to perform the initial task, you can use the Oxygen main menu "Find->Find/Replace in Files" dialog to search in your specific folder for

Code: Select all

<?xml version="1.0"?>
and replace with

Code: Select all

<?xml version="1.0" encoding="ISO-8859-1"?>
or better yet with

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
Regards,
Radu

Re: Change xml declaration

Posted: Mon Mar 14, 2022 5:28 pm
by panar444
Thanks a lot Radu
Regards
Panagiotis