Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7438041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:29:37+00:00 2026-05-29T10:29:37+00:00

Is the following format correct for XML? I am trying to parse the file

  • 0

Is the following format correct for XML? I am trying to parse the file in PHP using simplexml_load_file but keep receiving an error stating that there is ‘Extra content at the end of the document on line 3’.

Here is the XML file:

<?xml version="1.0"?>
  <title>Test File</title>
  <data>
    <record id="1">
      <department>
        <name>ACME</name>
        <number>5</number>
      </dep_name>
      <floor>
        <name>ACME Floor</name>
        <number>5</number>
      </floor>
    </record>
  </data>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:29:38+00:00Added an answer on May 29, 2026 at 10:29 am

    An XML document must consist of a single root element and its descendants.

    Your first start tag is <title>. It has a text node as its sole descendent. You then have a </title> tag which ends the root element and thus the document.

    <data> and everything following it is therefore an error.

    You probably want to create a new element type to be the root (and wrap the entire document, excluding the XML declaration, with it).

    You also need to correct either <department> or </dep_name> as you appear to have changed the name of the element halfway through creating it.

    You should run your code through a validator or a lint, as that will highlight errors.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to parse XML in the following format (from the European Central Bank
I'm trying to read a text file built with the following format in every
I have a file in the following format: Data Data Data [Start] Data I
So I have some XML in the following format: <somenode> <html xmlns=http://www.w3.org/1999/xhtml> <head> <title/>
I have a filename that has the following format: timestamp-username-1 This file is constantly
I have XML in the following format which I want to reformat: <blocks> <!--
I got a file which has dates stored as the following format (yyyy|dMM|dd). I
I need to construct an XML transaction of the following format: <RateV3Request USERID=MyId> <Package
I have the following xml format <locale id='us'> items here </locale> How do I
I have the following piece of xml: <MyField> <FieldName>Blah</FieldName> <ValueFormatting xsi:type=DateFormatter> <Format>dd/MM/yy</Format> </ValueFormatting> </MyField>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.