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

  • SEARCH
  • Home
  • 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 9213955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:52:07+00:00 2026-06-18T01:52:07+00:00

am trying to pass xml to a rest API am building with cakephp 2.3.0

  • 0

am trying to pass xml to a rest API am building with cakephp 2.3.0 and am getting an error yet i made it work with cakephp 1.3. Am wondering whether the problem is with the XML core utility of cakephp.

The XML string am posting is as below

<?xml version="1.0" encoding="UTF-8"?>
<username>my username</username>
<password>mypassword</password>
<name>Namanya Hillary</name>
<title>mytitle</title>

And the Error is as below

2013-01-31 07:32:25 Error: [Exception] String could not be parsed as XML
#0 E:\wamp\www\cakephp2.3.0\lib\Cake\Utility\Xml.php(131): SimpleXMLElement->__construct('<?xml version="...', 16384)
#1 E:\wamp\www\cakephp2.3.0\lib\Cake\Utility\Xml.php(100): Xml::_loadXml('<?xml version="...', Array)
#2 E:\wamp\www\cakephp2.3.0\lib\Cake\Controller\Component\RequestHandlerComponent.php(222): Xml::build('<?xml version="...')
#3 [internal function]: RequestHandlerComponent->convertXml('<?xml version="...')
#4 E:\wamp\www\cakephp2.3.0\lib\Cake\Network\CakeRequest.php(828): call_user_func_array(Array, Array)
#5 [internal function]: CakeRequest->input(Array)
#6 E:\wamp\www\cakephp2.3.0\lib\Cake\Controller\Component\RequestHandlerComponent.php(207): call_user_func_array(Array, Array)
#7 [internal function]: RequestHandlerComponent->startup(Object(CompaniesController))
#8 E:\wamp\www\cakephp2.3.0\lib\Cake\Utility\ObjectCollection.php(131): call_user_func_array(Array, Array)
#9 [internal function]: ObjectCollection->trigger(Object(CakeEvent))
#10 E:\wamp\www\cakephp2.3.0\lib\Cake\Event\CakeEventManager.php(247): call_user_func(Array, Object(CakeEvent))
#11 E:\wamp\www\cakephp2.3.0\lib\Cake\Controller\Controller.php(670): CakeEventManager->dispatch(Object(CakeEvent))
#12 E:\wamp\www\cakephp2.3.0\lib\Cake\Routing\Dispatcher.php(183): Controller->startupProcess()
#13 E:\wamp\www\cakephp2.3.0\lib\Cake\Routing\Dispatcher.php(161): Dispatcher->_invoke(Object(CompaniesController), Object(CakeRequest), Object(CakeResponse))
#14 E:\wamp\www\forex\webroot\index.php(102): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#15 {main}

I tried passing the XML directly in the core XML utility file in the utility folder as below on line 130

$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><username>my username</username><password>mypassword</password><name>Namanya Hillary</name><title>mytitle</title>', LIBXML_NOCDATA);

but the same exception is being raised. Please help me if u have encountered such a problem or if u see any mistake made. Reference links to solutions will be useful. Thanks in-advance.

  • 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-06-18T01:52:09+00:00Added an answer on June 18, 2026 at 1:52 am

    Properly formed XML must have a single root element. You do not have that. Try making the request format something like:

    <?xml version="1.0" encoding="UTF-8"?>
    <request>
        <username>my username</username>
        <password>mypassword</password>
        <name>Namanya Hillary</name>
        <title>mytitle</title>
    </request>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to pass a .xml file from my res folder to an
I'm trying to pass a object via REST web service. Following are my classes
I am trying to pass an XML string from a server into a parser
I am trying to pass data from a model into a XML file. I
I am trying to pass data from the database in XML format to an
I am having a problem in trying to pass a ArrayList Object from Activity
I'm trying to pass an XML document to an XSLT stylesheet as a parameter.
I am trying to pass the XML code below, in the first instance using
I'm trying to pass a parameter to an XSLT stylesheet, but all i'm getting
I am trying to POST a sample data to a server using REST api

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.