how to fix the error The content of elements must consist of well-formed character data or markup for <codeblock>

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
vishwavaranasi
Posts: 13
Joined: Fri Feb 28, 2020 4:02 pm

how to fix the error The content of elements must consist of well-formed character data or markup for <codeblock>

Post by vishwavaranasi » Thu May 07, 2020 9:54 am

Hello team , i am getting the following error when i try to insert the clipboardData content.

my insert code is :fragment="<codeblock>"+clipboardData+"</codeblock>";

Error : The content of elements must consist of well-formed character data or markup.

and the clipboardData is

Code: Select all

int main() {
    double scores[5] = {0.5, 1.5, 2.5, 3.5, 4.5};

    for(int i = 0; i < 5; i++) {
        cout << scores[i] >> "  ";
    }
    system("PAUSE");
    return 0;
}
when my clipboardData is the below one , the insert works fine

/* a long sample program */
Do forever
Say "Hello, World"
End


Thanks,
vishwa

Radu
Posts: 6981
Joined: Fri Jul 09, 2004 5:18 pm

Re: how to fix the error The content of elements must consist of well-formed character data or markup for <codeblock>

Post by Radu » Thu May 07, 2020 10:27 am

Hi,

The "<" is illegal inside XML text and needs to be escaped as

Code: Select all

&lt;
.
We have Java API to help you with this: ro.sync.exml.workspace.api.util.XMLUtilAccess.escapeTextValue(String).

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

vishwavaranasi
Posts: 13
Joined: Fri Feb 28, 2020 4:02 pm

Re: how to fix the error The content of elements must consist of well-formed character data or markup for <codeblock>

Post by vishwavaranasi » Thu May 07, 2020 12:02 pm

Thanks Radu , it's worked for me.

Thanks,
vishwa

Post Reply