XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 6th, 2010, 06:26 AM
shariqnitt shariqnitt is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 58 shariqnitt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 17 m 56 sec
Reputation Power: 4
XML 'CDATA' Error

Hi folk,
I m new to XML,
I tried making XML and got error in initial stage because of non-ascii char.
I searched on web and find CDATA to hide the data from parsing.
but this also dont help for me and I am not able to make the XML works.

below is my XML which creates the problem.

XML Code:
Original - XML Code
  1. <?xml version="1.0"?>
  2. <add>
  3. <doc>
  4. <field name="postid">342</field>
  5. <field name="userid">501</field>
  6. <field name="bucketid">3</field>
  7. <field name="title"><![CDATA[Flirting with Apple ]]></field>
  8. <field name="description"><![CDATA[As the title suggest, I'm kicking around the idea of purchasing an Apple computer.  �  Models in the  the 13" MacBook Air, and the Mac Mini.  .  �  There are some issues I do have. The whole internal battery high tech, but still....  �  Anyways, I'd appreciate any feedback/comments on which way I should go. Thanks!  �  �  �  �  �  � ]]></field>
  9. </doc>
  10. </add>


Please help.

Thanks is advance

Reply With Quote
  #2  
Old December 6th, 2010, 03:25 PM
requinix's Avatar
requinix requinix is online now
Still alive
Dev Shed God 16th Plane (12500 - 12999 posts)
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,859 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 5 Days 5 h 22 m
Reputation Power: 8977
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Quote:
Originally Posted by shariqnitt
CDATA to hide the data from parsing.

That's not quite what it does. There's two phases to "parsing" XML, if you will: 1) reading the characters, and 2) parsing it. A CDATA will only prevent #2 from happening (and even then, not all parsing); you still have to pass #1.

Set an encoding for your XML.
Code:
<?xml version="1.0" encoding="???"?>

The encoding can be whatever you want - popular choices are UTF-8 ("utf-8") and ISO 8859-1 ("iso-8859-1").
Once you've picked one, make sure everything in your XML is in that encoding.

Reply With Quote
  #3  
Old December 7th, 2010, 05:14 AM
xml-profi xml-profi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2009
Posts: 190 xml-profi User rank is Sergeant Major (2000 - 5000 Reputation Level)xml-profi User rank is Sergeant Major (2000 - 5000 Reputation Level)xml-profi User rank is Sergeant Major (2000 - 5000 Reputation Level)xml-profi User rank is Sergeant Major (2000 - 5000 Reputation Level)xml-profi User rank is Sergeant Major (2000 - 5000 Reputation Level)xml-profi User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 7 h 8 m 25 sec
Reputation Power: 48
Send a message via ICQ to xml-profi
at first look at your editor which generated the xml file
which encoding the editor used.

with decodeunicode
search your sign
example Euro sign &#x20AC;

then use in xml file
Code:
<field name="euro">The Euro Sign &#x20AC;</field>

after &# used a small x to say is a hex number
so euro sign is display


Code:
<?xml version='1.0' encoding='unicode' ?>
<root>
  <item>The Euro Sign €</item>
</root>
__________________
Helmut Hagemann Germany

fallen to the bottom of the facts?
I reach my hand and we go together


wer lesen und google kann ist klar im Vorteil
who read and google is able is clear in the advantage

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XML 'CDATA' Error

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap