Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 16th, 2007, 07:30 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default PROBLEM WITH XML DISPLAY IN BROWSER

Hi all, i'm having trouble displaying xml file in internet explorer. I can't find where the problem is. Here's the error message i get please see if you can help. "Switch from current encoding to specified encoding not supported". Thanks

Reply With Quote
  #2 (permalink)  
Old April 16th, 2007, 08:09 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

That means that the encoding declared in the actual XML is not that of the file itself. To fix this you'll need to say how the file is created. (A common cause in ASP for example is using Response.Write which writes UTF-16 when the XML file has UTF-8 declared.)

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #3 (permalink)  
Old April 16th, 2007, 10:33 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Joe, thanks for the prompt reply, i'll just print the whole file here and if its not a problem, you point to me where the problem is please. I'm quite new to XML. thanks for your help.
Here you are
††<?xml version="1.0" encoding="UTF-16" ?>
- <Inventory type="eBookBase" recordcount="1" date="" xmlns:ms="urn:schemas-microsoft-com:xslt">
- <Content lastmodifieddate="3/9/2007">
††<Title>4 Guys and Trouble</Title>
††<SortTitle>4 Guys and Trouble</SortTitle>
††<Publisher>Penguin Group</Publisher>
††<Imprint>Onyx</Imprint>
- <Creator>
††<Name>Major, Marcus</Name>
††<FileAs>Major, Marcus</FileAs>
††<Role>aut</Role>
††</Creator>
††<FullDescription>"feelings in the brothers. When one of them acts on those feelings, acclaimed debut novel--and one certain to win this gifted author a wealth of captivated new readers. "</FullDescription>
††<Image type="cover">4guysandtrouble4.jpg</Image>
††<Language code="EN">EN</Language>
††<Subject BASICCode="FIC000000">General Fiction</Subject>
- <Format type="Mobipocket Reader">
††<Identifier type="ISBN">0786599960</Identifier>
††<Identifier type="PrintISBN">0451410173</Identifier>
††<Identifier type="EBBASEID">37539</Identifier>
††<SRP currency="USD">6.99</SRP>
††<WholesaleCost currency="USD">4.89</WholesaleCost>
††<OnSaleDate>3/3/2007</OnSaleDate>
††<Territory>US, CA, MX</Territory>
††<MinimumSoftwareVersion>Mobipocket Reader Version 4.0</MinimumSoftwareVersion>
††<MinimumFormFactor />
††<RecommendedFormFactor />
††<DownloadFileName>ID2097/4guysandtrouble4.prc</DownloadFileName>
††<SecurityLevel>4</SecurityLevel>
††<ContentFileSize>641</ContentFileSize>
††</Format>
††</Content>
††</Inventory>
Reply With Quote
  #4 (permalink)  
Old April 16th, 2007, 11:28 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well your file states the encoding as UTF-16 (encoding="UTF-16" in header). The error message suggests that it isn't, you need to state in detail how the file is created.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #5 (permalink)  
Old April 18th, 2007, 05:26 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Joe, i download this metadata from a supplier's website which opens up in my web browser. i cut and paste the data into notepad then save as .xml. the reason being, i intend to convert the resultant xml file from notepad into a csv file to store in database for ecommerce site. am i making sense?

Reply With Quote
  #6 (permalink)  
Old April 18th, 2007, 07:35 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

In that case make sure you are saving as UNICODE, there is a combo box in the bottom of the save dialogue. Alternatively save as UTF-8 and modify the XML header
If you're downloading from a web site you can automate all of this by using MSXML2.XmlHttp class.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #7 (permalink)  
Old April 20th, 2007, 11:45 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Joe, how do i use MSXML2.XmlHttp class to to do the automation please? i'm just going to try the UNICODE but i think it would be a lot better if i use MSXML2.XmlHttp class to automate it. thanks for helping.
Reply With Quote
  #8 (permalink)  
Old April 21st, 2007, 04:45 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Well basically you create the object along with the destination URL and call the send method which takes any form parameters. You then use one of the response* properties to examine the output, in your case responseXML. Any tutorial on Ajax will show how this works as this is the foundation for Ajax. Or search for XmlHttpRequest on Google. http://www.w3schools.com/xml/xml_http.asp for instance.
Note that in IE you should use version 6 or 3 as illustrated by this blog posting: http://blogs.msdn.com/xmlteam/archiv...-explorer.aspx

--

Joe (Microsoft MVP - XML)
Reply With Quote
Reply


Thread Tools
Display Modes

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 On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser cannot display fresh image. snowbydave1 PHP FAQs 0 March 1st, 2007 07:11 AM
Problem with xml and layers in different Browser. diptanjan XML 0 March 9th, 2006 09:40 AM
XML Data Island Display Problem marcuslim XML 8 December 7th, 2004 04:00 AM
problem with display of data of xml in excel2002 madhavigun XML 0 August 5th, 2004 11:52 PM



All times are GMT -4. The time now is 10:44 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.