 |
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
|
|
|

April 16th, 2007, 06:30 AM
|
Registered User
|
|
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

April 16th, 2007, 07:09 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
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)
|

April 16th, 2007, 09:33 AM
|
Registered User
|
|
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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>
|

April 16th, 2007, 10:28 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
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)
|

April 18th, 2007, 04:26 AM
|
Registered User
|
|
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|

April 18th, 2007, 06:35 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
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)
|

April 20th, 2007, 10:45 AM
|
Registered User
|
|
Join Date: Apr 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

April 21st, 2007, 03:45 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
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)
|
|
 |