It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Character reference "&#26" is an invalid XML character.

Peter Al Jul 05, 2011

Hi, I got above error when I use XmlRpcClient. Here is the way to reproduce on confluence 3.5.7:

1. Add a page (with title contains char "" , e.g. "Test page I subbed it") to a space;
2. Pass the space key and other parameters to following function:

public Object call(String username, String password, String spaceKey, URL serverURL)
{
Object obj=null;
try
{
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(serverURL);
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Object[] parameters = new Object[]{username, password};
String token = (String) client.execute("confluence1.login", parameters);
Vector<Object> args = new Vector<Object>();
args.add(spaceKey);
args.add(0,token);
obj = client.execute("confluence1.getPages", args);
}
catch (XmlRpcException xe)
{
xe.printStackTrace();
}
return obj;
}

then you will get following calling stack:

06/07/2011 10:27:35 [6] org.apache.xmlrpc.client.XmlRpcClientException: Failed to parse server's response: Character reference "&#26" is an invalid XML character.
06/07/2011 10:27:35 [6] at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:180)
06/07/2011 10:27:35 [6] at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:148)
06/07/2011 10:27:35 [6] at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:115)
06/07/2011 10:27:35 [6] at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
06/07/2011 10:27:35 [6] at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
06/07/2011 10:27:35 [6] at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
06/07/2011 10:27:35 [6] at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:158)
06/07/2011 10:27:35 [6] at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:147)

How to resolve this problem?

Thanks in advance!!!

Peter

2 answers

1 vote
Laura Kolker Jul 06, 2011

&#26 is a control character. Control charcters are not legal xml, and confluence's parser is not going to be able to handle it. So, uploading content with this sort of character using the remote api is not going to work. You'll have to excise the character from your content if you are using the remote api.

See also:
http://lists.xml.org/archives/xml-dev/199804/msg00502.html
http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml

Peter Al Jul 10, 2011

Hi Laura, Thanks a lot for your reply! I know &#26 is a control char, but question is: Confluence allows control char in page title and provides an API method "getPages" which could NOT return correct results in this case. Do you know any other ways that "getPages" could be used successfully in this case? Your help is greatly appreciated.

Best wishes,

Peter

0 votes
Qualcomm Support Jan 18, 2012

here is one post which may help you to find control charectors :

for my case i could able to figure out the control charectors with the help of notepad++

https://studio.plugins.atlassian.com/wiki/display/UWC/UWC+F.A.Q. :

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

1,550 views 8 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you