473,395 Members | 1,460 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Loading UCS-2(UTF-16) XML file

Hi everyone,
I'm a noob with a problem...
In non-IE browsers, I'm trying to load a UCS-2 (UTF-16) encoded file using the following lines:
xmlDoc=document.implementation.createDocument("set tings.xml","",null);
xmlDoc.async=false;
xmlDoc.load("");
I get an error on the last line that says "Value Undefined (result expression xmlDoc.load) is not an object."
1.) Do I have to specify an encoding type when loading a an XML file? (There already is an encoding line on the first line of my XML file which says <?xml version="1.0" encoding="ucs-2"?>
2.) The XML has no text elements (i.e. all the values are stored as attributes for each element). Should I use another method for loading this file?
Mar 10 '08 #1
3 2335
rnd me
427 Expert 256MB
1.) Do I have to specify an encoding type when loading a an XML file? (There already is an encoding line on the first line of my XML file which says <?xml version="1.0" encoding="ucs-2"?>
2.) The XML has no text elements (i.e. all the values are stored as attributes for each element). Should I use another method for loading this file?

1. no, it will be detected automatically. if the BOM is incorrect however, you will run into problems.

2. i would use another method yes, but not because of the structure of the XML data, that shouldn't matter.
Mar 10 '08 #2
Thank you for answering my 2 questions, but can you tell me what I'm doing wrong? Why do I get that error when trying to load the file?
Mar 11 '08 #3
rnd me
427 Expert 256MB
your syntax is incorrect. you pass filename upon calling the load function.


here is an example from w3schools


Expand|Select|Wrap|Line Numbers
  1. xmlDoc=document.implementation.createDocument("","",null);
  2. xmlDoc.async="false";
  3. xmlDoc.load("books.xml");
  4.  
  5.  
Mar 11 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Philippe C. Martin | last post by:
This is a basic question I'm sure but I do not know wether to use __builtin__, global, or a static method: I have a very large XML file that I load into dictionnaries defined in a class located...
1
by: Chris | last post by:
I have seen the posts on various places on the internet about .NET framework mismatch issues and I don't think that is my problem. ; ) When I execute the following C++.NET code: String...
3
by: Sai Pavan | last post by:
Error loading XML file c:\winnt\microsoft.net\framework\v1.0.3705\Config\machine.config Request for the permission of type System.Security.Permissions.StrongNameIdentityPermission, mscorlib,...
2
by: Gustaf Liljegren | last post by:
I'm writing a program that will query an XML file with the XmlTextReader class (the question is not specifically about XML, however). This file is very large (maybe 20 MB at most), and during...
0
by: Nic Butler | last post by:
Hi, I've got a win form app that takes an arbitrary file from the local drive, calls a webservice function, passing the file's byte array plus an number of other params. About half the time I...
9
by: MSDousti | last post by:
Hi How can I load a text file into a TextBox? I have used System.Text.StringBuilder for fast loading. This method works fine under windows XP, but it does not work in windows 98. Any idea...
5
by: Bill Q | last post by:
Hello, this may not be the correct group for the post although I am using c# to follow one of the code4fun directx tutorial. Anyway the author is loading a texture file using the following ...
4
by: basha9 | last post by:
Hi everybody , Can u tell me how to load .xml file from javascript in IE.If u can provide the code it's very greatefull to u.. ---Tq.
3
by: mintominto82 | last post by:
Hello, I am a very newbie (big emphasis on being a newbie) to c++. I read c++PRIMER but apparently, it did not provide much help. I need a bit of help in codes loading txt file in C++. My...
2
by: joe | last post by:
I am loading a text file to a variable with XMLHttpRequest() There seems to be some sort of timing issue since loadXML (source code below) returns the contents of the file on seconds try. In...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.