Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 16th, 2007, 06:30 AM
Registered User
 
Join Date: Apr 2007
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

 
Old April 16th, 2007, 07:09 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old April 16th, 2007, 09:33 AM
Registered User
 
Join Date: Apr 2007
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>
 
Old April 16th, 2007, 10:28 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old April 18th, 2007, 04:26 AM
Registered User
 
Join Date: Apr 2007
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?

 
Old April 18th, 2007, 06:35 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old April 20th, 2007, 10:45 AM
Registered User
 
Join Date: Apr 2007
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.
 
Old April 21st, 2007, 03:45 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)





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 10:52 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.