Posts Tagged ‘xml’

Fixing “XML Parsing Error: XML or text declaration not at start of entity” in Wordpress

This is one of the more annoying bugs in Wordpress. Wordpress is working fine, but when you check the RSS feed you get the following error:

XML Parsing Error: XML or text declaration not at start of entity
Location: http://domain.com/feed/
Line Number 3, Column 1:<?xml version="1.0" encoding="UTF-8"?>
^

The most common explanation for its cause is blank spaces leading and ending the PHP pages caused by editing the theme. There are two solutions for this problem. The first is the easiest and I would recommend trying this first.

Solution 1:

Step 1)

Install the fix-rss-feed plugin. http://wordpress.org/extend/plugins/fix-rss-feed/

Step 2)

Go to Admin > settings > fix RSS Feed

Step 3)

Click on the “Fix wordpress rss feed error” button

This might or might not fix your problem. I have had it work on some themes and it failed on others. If it fails I would recommend the following solution:

Solution 2:

The “Wordpress leading whitespace fix” is slightly more involved than the plugin, albeit a very good solution when the plugin fails. The fix is well documented so I will not bother to repeat the steps here. You can read installation instructions and download from here: http://wejn.org/stuff/wejnswpwhitespacefix.php.html

Tags: , , ,

25

11 2009

Automate tests for XML APIs

With the impressive growth of web services and the inter-connectivity that this implies, it is very common that web applications and websites include APIs that offer XML output, like SOAP, XML-RPC and REST. Symfony itself is a great framework to create APIs that generate different types of output, but Zend Framework and most other frameworks also offer these possibilities.

Selenium IDE has become a standard to automate testing of web applications, if you are not using it, wait no more!

It can also be used to test APIs. How?

Well, there is a kind of patch to it that adds the ability to assert the presence of an XML node and its value. Download and check out the example.

So, after you downloaded the attachment, append the content or create a new file user-extensions.js and place it somewhere of your preference. Then go to Firefox, open Selenium IDE in Tools, then go to Options and browse the location of your file user-extensions.js

Make sure you restart Selenium IDE so it picks up the changes. Once you restarted it, you will see the action assertTextPresentXML.

I am not sure why this has not been added to the main distribution, but it is one of the features that we most use.

In a future post, I will explain step by step how to use it.

Tags: , , , , ,

29

01 2009