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 8538409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:06:58+00:00 2026-06-11T11:06:58+00:00

I have created a string <?xml version=’1.0′ encoding=’ISO-8859-1′?> <response> <content>Question – aa.Reply the option

  • 0

I have created a string

<?xml version='1.0' encoding='ISO-8859-1'?>
<response>
  <content>Question - aa.Reply the option corresponding to  your answer(You can vote only once)</content>
  <options>
    <option url="http://localhost/poll/index.php?message=vote%3Aaar1%3Asdy&mobile=9747444565" name="sdy"/>
    <option url="http://localhost/poll/index.php?message=vote%3Aaar1%3Ab&mobile=9747444565" name="b"/>
  </options>
</response>

The url attribute of the option tag is created from the following php code
$appUrl."/poll/index.php?message=".urlencode("vote:".$kwd.":".$oopt)."&mobile=".urlencode($_GET['mobile']);

But when I convert the same to xml ,I am getting the following error.

This page contains the following errors:

error on line 1 at column 240: EntityRef: expecting ‘;’
Below is a rendering of the page up to the first error.

Why is this happening.I am sure that it is problem of url encoding.So what is the correct way of url encoding.I mean
what changes should be applied to the url encoding

 $appUrl."/poll/index.php?message=".urlencode("vote:".$kwd.":".$oopt)."&mobile=".urlencode($_GET['mobile']);

Get parameters and value of them are
$_GET['message'] = "vote:".$kwd.":".$oopt
$_GET['mobile'] = 888888errt434

  • 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-11T11:06:59+00:00Added an answer on June 11, 2026 at 11:06 am

    You have an un-encoded & (ampersand) character in the URLs. & is a special character in all SGML-based forms of markup.

    htmlspecialchars() will fix the problem:

    htmlspecialchars($appUrl."/poll/index.php?message=".urlencode("vote:".$kwd.":".$oopt)."&mobile=".urlencode($_GET['mobile']));
    

    Personally I prefer to use DOM for creating XML documents instead of string concatenation. This will also handle encoding of SGML special characters correctly. I would do something like this:

    // Create the document
    $dom = new DOMDocument('1.0', 'iso-8859-1');
    
    // Create the root node
    $rootEl = $dom->appendChild($dom->createElement('response'));
    
    // Create content node
    $content = 'Question - aa.Reply the option corresponding to your answer (You can vote only once)';
    $rootEl->appendChild($dom->createElement('content', $content));
    
    // Create options container
    $optsEl = $rootEl->appendChild($dom->createElement('options'));
    
    // Add the options - data from wherever you currently get it from, this array is
    // just meant as an example of the mechanism
    $options = array(
      'sdy' => 'http://localhost/poll/index.php?message=vote%3Aaar1%3Asdy&mobile=9747444565',
      'b' => 'http://localhost/poll/index.php?message=vote%3Aaar1%3Ab&mobile=9747444565'
    );
    foreach ($options as $name => $url) {
      $optEl = $optsEl->appendChild($dom->createElement('option'));
      $optEl->setAttribute('name', $name);
      $optEl->setAttribute('url', $url);
    }
    
    // Save document to a string (you could use the save() method to write it
    // to a file instead)
    $xml = $dom->saveXML();
    

    Working example

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

Sidebar

Related Questions

I have created an .hbm.xml file : <xml version=1.0?> <hibernate-mapping package=com.cmp.iard.sinistre.hbm.dossier> <!DOCTYPE hibernate-mapping PUBLIC
I have created an aspx page which dynamicaly creates an xml string and posts
I have created a function which gets an encoded string (possibly UTF-16 not sure)
I have created a function that will return the string path from my DB.
I have created a servlet that passes a string variable strname to a JSP
I want to store data in string form to MySQL. I have created the
Say I have a structure like: class SomeObject Public Name as String Public Created
I have created a PLIST. The structure of the PLIST is like this <?xml
Following on from another question I have asked I have created a new class
I have created an app with a full and a lite version. Lite version:

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.