[HtmlUnit] [htmlunit:bugs] #2012 Javascript in CDATA block causes EvaluatorException: illegally formed XML syntax

RBRi via HtmlUnit-develop <[email protected]> Sun, 24 Feb 2019 12:20:34 -0000
Newsgroups gmane.comp.java.htmlunit.devel
Message-ID </p/htmlunit/bugs/2012/aa1875e6514182846a9686bb948f640b190e3af8.bugs@htmlunit.p.sourceforge.net>
- **status**: open --> closed
- **assigned_to**: RBRi
- **Comment**:

Should be fixed now. Will inform via twitter (https://twitter.com/HtmlUnit) if a new snapshot is avalialable.
Please check if your problem is gone.

Your cases
`(new net.sourceforge.htmlunit.corejs.javascript.Parser()).parse("<![CDATA[obj1.obj2.func1();]]>", "", 1);`
will still fail, because the CDATA processing is done by the (X)Html parser.

Reopen this if it is still not working.




---

** [bugs:#2012] Javascript in CDATA block causes EvaluatorException: illegally formed XML syntax**

**Status:** closed
**Group:** 2.33
**Created:** Mon Feb 11, 2019 01:16 AM UTC by Ron HD
**Last Updated:** Sun Feb 24, 2019 12:16 PM UTC
**Owner:** RBRi


Javascript code  wrapped in an XML CDATA block within a <script> tag on a web page causes HtmlUnit to throw the following exception:

> net.sourceforge.htmlunit.corejs.javascript.EvaluatorException: illegally formed XML syntax

This can be replicated with the following Java code:

`(new net.sourceforge.htmlunit.corejs.javascript.Parser()).parse("<![CDATA[obj1.obj2.func1();]]>", "", 1);`

This occurs on web pages that use Oracle ADF (I believe this is the same problem reported in Bug #1991). These web pages are accepted by Firefox and other major browsers.

Tracing through the code, I can see that the TokenStream.getNextXMLToken() method successfully scans over the CDATA block, but then rather than processing the contents of the block, it just does:

`parser.addError("msg.XML.bad.form");`

I'm not sure why it does this, or the right way to fix it. With a little guidance, I may be able to provide a fix. Or if someone can give me one, it would be great. Otherwise, I'm being forced to use Selenium with Firefox, which is introducing other problems.


---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/htmlunit/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.

_______________________________________________
HtmlUnit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop