7

Firstly , good day to everyone. I have this script which handles the login to my database : http://pastebin.com/ctUEczRf I used pastebin because it was too long to use code tags. When I run it It returns me this :

This page contains the following errors:

error on line 2 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error.

I don't know how to solve it , I never used XML before. This was given to me along with the CMS.

user1640328
  • 67
  • 1
  • 1
  • 2
  • 1
    First guess would be that your XML document is invalid. Copy&Paste to [http://validator.w3.org/](http://validator.w3.org/) and find it out. – Akos K Sep 01 '12 at 19:23

4 Answers4

6

Pasting the XML that's generated is probably what you'd need to do. My guess is that you are generating XML with multiple top-level elements; XML requires that you have a single wrapper element at the top level and have all other elements inside it: it's a tree, not a forest.

My second guess is that you are seeing the error in your Web browser, and it is not being generated by php at all; check your Web server error logs to make sure.

barefootliam
  • 619
  • 3
  • 7
  • The problem is that I don't know if I even have a root element. I specified I don't know XML , I received this along with the CMS. – user1640328 Sep 02 '12 at 07:56
3

Look at the XML. It should look something like the following:

<block>
    <item>Here's an item</item>
    <item>Here's another item</item>
    <item>Here's an item with some sub-items
        <subitem>one</subitem>
        <subitem>two</subitem>
    </item>
</block>

The root of the XML document is the block item; it's the item that encloses and surrounds all of the other items.

If you don't have a root - ie, if the code looks something like this:

<item>Here's a list of items</item>
<item>But there's no root element</item>

Then you'll get the error you describe.

piersb
  • 609
  • 9
  • 22
0

Two possible options. It might be because the rendered XML is not valid. Sometimes, it might be because you don't have enough permissions to access the XML.

subbu
  • 524
  • 6
  • 16
0

I had this error message "Extra content at the end of the document". Turned out the issue was in one of the tags there was no space between two attributes.

hugh
  • 1