CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • REST returns illegal XML
Pages: [1]

Author Topic: REST returns illegal XML  (Read 520 times)

pederb

  • I’m new here
  • *
  • Posts: 27
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.22
  • MySQL version: MySql 5.1
  • PHP version: 5.3
REST returns illegal XML
July 07, 2012, 07:18:59 am
The records are numbered, but an XML-element name must allways start with a letter so the resulting XML will not load into MSXML.DomDocumet and other tools...

  <Result>
    <20>
        <contact_id>20</contact_id>
        <contact_type>Individual</contact_type>


Is there an easy fix for prefixing these elements, eg. <20> could be changed to <num_20>?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: REST returns illegal XML
July 07, 2012, 07:38:35 am

Can you tweak the code here:


CRM/Utils/Array.php, function xml

can you also file an issue and attach a patch if you have fixed the above. Please also include a link to the xml spec which says that an element name cannot be numeric

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

pederb

  • I’m new here
  • *
  • Posts: 27
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: Drupal 7.22
  • MySQL version: MySql 5.1
  • PHP version: 5.3
Re: REST returns illegal XML
July 07, 2012, 08:12:04 am
Thx lobo.

The xml function looks OK... very generic, so patching here would involve something like "if (isnumeric ( $name ))...". Not pretty.

Aren't the numbers returned from the actual query... on a deeper level?

PS. I know a lot about .NET, but have decided to upgrade to PHP/Drupal, so I still have much to learn... :-)

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: REST returns illegal XML
July 07, 2012, 08:36:19 am

I think we need to do it at that level, since the underlying code returns nice associative arrays that are reused in other parts of the codebase

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • REST returns illegal XML

This forum was archived on 2017-11-26.