question

anilsingh avatar image
anilsingh asked anilsingh posted

Error message :: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.

Hi,

I am developing a plug-in over iTest.

In one of my requirements, I need to put some data in structured format (in a table format to be exact) on the console.

I am using the data structures provided by the Fanfare like Table (com.fnfr.open.common.interfaces.renderer.impl.Table), and utility methods from other packages like com.fnfr.open.common.interfaces.renderer.ITableRenderInfo, etc.


I am getting the correct output, but subsequenly I get this runtime error message "An internal error occurred during: "s29: show: stream". INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified"

(here "show stream" is my command that I am implementing.)

I am curious to know, what this error is about.


This happens while I call the build method on the ResponseBuilder instance inside the performRequest method.




The stack trace is ::

org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createElement(Unknown Source)
at com.fnfr.open.common.util.StructuredDataBuilder.createElement(StructuredDataBuilder.java:82)
at com.fnfr.open.common.interfaces.renderer.impl.Table.renderToStructure(Table.java:114)
at com.fnfr.open.common.interfaces.renderer.impl.Table.render(Table.java:201)
at com.fnfr.open.common.interfaces.renderer.impl.RenderItem.render(RenderItem.java:113)
at com.fnfr.open.automation.tool.helpers.ResponseBuilder.build(ResponseBuilder.java:53)
at com.mycorp.n2xtest.ShowRequestHandler.performRequest(ShowRequestHandler.java:108)
at com.fnfr.open.automation.tool.session.SessionController.performRequest(SessionController.java:291)
at com.fnfr.open.automation.tool.session.SessionController$2.run(SessionController.java:483)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

 

 

Thanks,

Anil

 

iTestsdk
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
PaulD avatar image
PaulD answered PaulD posted

This will happen if you have a name for your table or for a column in your table that is not legal as an XML element name.  For example, these things cannot contain spaces.

7 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

anilsingh avatar image anilsingh commented ·

Thanks Paul,

It helped.

I had my table table name as "Stream Table", and that's why it was giving problem. I chnaged it to "StreamTable" and it is working fine.

0 Likes 0 ·
PaulD avatar image PaulD anilsingh commented ·

The table renderer could probably be enhanced to allow you to have column IDs and names that are separate, so that you can title your columns however you want.  We'll consider that for future.

0 Likes 0 ·
anilsingh avatar image anilsingh PaulD commented ·

In my implementation, I need to show statististics against particular ports, in tabular format.

The port names are like "101:1", "101:2".


Here I am getting similar error (i.e. java.lang.IllegalArgumentException: Invalid or illegal XML character encountered when creating node with name '101:1'),  but I cannot change the column name to something else.


The stack trace is as follows::

java.lang.IllegalArgumentException: Invalid or illegal XML character encountered when creating node with name '101:1'
at com.fnfr.open.common.interfaces.renderer.impl.Table.renderToStructure(Table.java:122)
at com.fnfr.open.common.interfaces.renderer.impl.Table.render(Table.java:201)
at com.fnfr.open.common.interfaces.renderer.impl.RenderItem.render(RenderItem.java:113)
at com.fnfr.open.automation.tool.helpers.ResponseBuilder.build(ResponseBuilder.java:53)
at com.mycorp.n2xtest.ShowRequestHandler.performRequest(ShowRequestHandler.java:186)
at com.fnfr.open.automation.tool.session.SessionController.performRequest(SessionController.java:291)
at com.fnfr.open.automation.tool.session.SessionController$2.run(SessionController.java:483)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


What needs to be done here?

0 Likes 0 ·
KumarS avatar image KumarS anilsingh commented ·

Change your column name to 101_1 or 101_2. You have to replace the non-XML characters out of your names into XML characters and I find that replacing those with "_" works well.

0 Likes 0 ·
anilsingh avatar image anilsingh KumarS commented ·

Replacing ":" with "_" does not help, and I get the same error.

The stack trace is as attached::


java.lang.IllegalArgumentException: Invalid or illegal XML character encountered when creating node with name '102_1'
at com.fnfr.open.common.interfaces.renderer.impl.Table.renderToStructure(Table.java:122)
at com.fnfr.open.common.interfaces.renderer.impl.Table.render(Table.java:201)
at com.fnfr.open.common.interfaces.renderer.impl.RenderItem.render(RenderItem.java:113)
at com.fnfr.open.automation.tool.helpers.ResponseBuilder.build(ResponseBuilder.java:53)
at com.mycorp.n2xtest.ShowRequestHandler.performRequest(ShowRequestHandler.java:151)
at com.fnfr.open.automation.tool.session.SessionController.performRequest(SessionController.java:291)
at com.fnfr.open.automation.tool.session.SessionController$2.run(SessionController.java:483)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


Besides my primary requirement remains that, I want to show the ports in the format like "101:1".

This is the way N2X customers have been accustomed to, and also, the existing Fanfare integration for "Agilent Traffic" shows this way.

0 Likes 0 ·
AdamB avatar image AdamB anilsingh commented ·

Hi anilsingh,

 

Sorry this isn't all just working.  Can you try putting an alphabetic character in front of the column name, so p102_1.  To see if that works. 

 

I'll look into why this isn't working and if we can improve the naming as Paul mentioned earlier.

 

-Adam

0 Likes 0 ·
anilsingh avatar image anilsingh AdamB commented ·

Hi Adam,

Thanks for your reply.


Changing it to something like "Port102_1" works.

You are right, implementing Paul's suggestion should remove all such ambiguities.


Thanks,

Anil

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.