Page 1 of 1

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

Posted: Thu May 07, 2020 9:54 am
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

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

Posted: Thu May 07, 2020 10:27 am
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

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

Posted: Thu May 07, 2020 12:02 pm
by vishwavaranasi
Thanks Radu , it's worked for me.

Thanks,
vishwa