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: 144
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 »

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
Thanks,
vishwa
Radu
Posts: 9049
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 »

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: 144
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 »

Thanks Radu , it's worked for me.

Thanks,
vishwa
Thanks,
vishwa
Post Reply