Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 30th, 2008, 07:44 AM
freddieMaize's Avatar
Member
 
Join Date: Aug 2008
Age: 22
Posts: 52
Default encoding problem

Hi,

I'm need to build an XML which i'd use to feed datas to a Search Engine Server for Indexing purpose.

Below is a valid XML that i have,
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <documents>
  3. <document>
  4. <title>Brazil</title>
  5. <element name="body">
  6. <value>Brazil (Portuguese: Brasil), officially the Federative Republic of Brazil (Portuguese: República Federativa do Brasil) is a country...value>
  7. </element>
  8. <element name="url">
  9. <value>http://uxm-searchsrv.corp.satyam.ad:8082/ESP/Geo_Docs/Countries_Info/Brazil.html</value>
  10. </element>
  11. <element name="urls">
  12. <value>http://uxm-searchsrv.corp.satyam.ad:8082/ESP/Geo_Docs/Countries_Info/Brazil.html</value>
  13. </element>
  14. <element name="lat">
  15. <value>15.40</value>
  16. </element>
  17. <element name="lon">
  18. <value>47.57</value>
  19. </element>
  20. </document>
But i tried the below,
copy all the content from http://en.wikipedia.org/wiki/Brazil and paste it in the <value> tag...

The parse was showing error after error (I mean, it'd show an error, i would make the correction, and this would repeat...)

I also took off the "encoding="utf-8" and tried... then too it was showing some error... I'm not mentioning the exact errors becasue they were many in numbers. But all were general errors like, "invalid char", "white space" etc.....

Right now, after taking off the encoding, i'm getting, "Whitespace is not allowed at this location. Error processing resource 'file:///D:/MyFolder/Fast/Geo_Docs/Countries_Info/Cou..."

Can any one help me out...

Thank you
Reply
  #2  
Old August 30th, 2008, 12:04 PM
freddieMaize's Avatar
Member
 
Join Date: Aug 2008
Age: 22
Posts: 52
Default

Okay Fine... I some how managed and right now when i open my XML file with IE, its showing the whole XML... This is one way to check the well formness of XML. Am I correct?? Sorry if this is very trival!

Now, when I tried to use this XML (as mentioned above), I get an exception saying,
Expand|Select|Wrap|Line Numbers
  1. [2008-08-30 16:11:39.625] ERROR      systemmsg A fatal error occurred while pars
  2. ing 'F:\Docs\ESP\Geo_Docs\Cities\Cities2.xml': SAXParseException: F:
  3. \Docs\ESP\Geo_Docs\Cities\Cities2.xml:1:1: not well-formed (invalid
  4. token)

Any Suggestions???
-------------------------------------------------
I hate working on the weekends (especially being a novice at the work which I’m assigned to)... See... There would be none to help when one is stuck...
Reply
  #3  
Old August 31st, 2008, 09:19 PM
Dormilich's Avatar
Expert
 
Join Date: Aug 2008
Location: Leipzig, Germany
Age: 31
Posts: 637
Default

some links where you can do validation:
w3c validator
xmlvalidation
by using the xml you put as an example:
- closing root element missing (</documents>)
- (writing mistake, line 6) missing closing element (</value> was truncated)
Reply
  #4  
Old September 1st, 2008, 12:28 PM
freddieMaize's Avatar
Member
 
Join Date: Aug 2008
Age: 22
Posts: 52
Default

Thanks pal.

Got my problem fixed. Thanks
fREDDIE mAIZE
Reply
Reply

Bookmarks

Thread Tools

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

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles