473,770 Members | 5,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loading UCS-2(UTF-16) XML file

2 New Member
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 ("settings.xml" ,"",null);
xmlDoc.async=fa lse;
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 2366
rnd me
427 Recognized Expert Contributor
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
sm0a9f4
2 New Member
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 Recognized Expert Contributor
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
1202
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 in a module that is imported in many places. Since the loading process is very slow, I would like the file not to be loaded on import or class instantiation, but only once (on first import or class instantiation).
1
4394
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 *ipAddress = S""; IDictionary *server_config = dynamic_cast<IDictionary*>(ConfigurationSettings::GetConfig("ServerAddress") ); ipAddress = dynamic_cast<String*>(server_config->get_Item(S"IP"));
3
364
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, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed. (c:\winnt\microsoft.net\framework\v1.0.3705\Config\machine.config) I have 2 frameworks installed in my system v1.0.3705 and v1.1.4322
2
3457
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 extreme conditions, it'll have to be queried thousands of times (maybe 20,000 times at most). Small fragments of this file are used to construct another file. What is most economical, in terms of system resources? Opening and closing the file +...
0
1483
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 get the following error: Error loading XML file c:\winnt\microsoft.net\framework\v1.14322\Config\machine.config Request for the permission of type System.Security.Permissions.StrongNameIdentityPermission, mscorlib,
9
2260
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 is appreciated. thnx in advance.
5
2233
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 TextureLoader.FromFile ( _device, @"..\..\..\Resources\Left.tga" I am not sure what the ..\..\..\ means when loading the file. I know the directory the file lives in is C:\Documents and Settings\Bill\My Documents\MSDN\BattleTank2005 (C#)\Resources
4
2053
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
2009
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 frustration is that the file does not have any names of variables. The data looks as follows: 01/02/2004,1108.48 01/05/2004,1122.22 How do I assign the name to the variables in C++? (ie. how do I let C++ know that "Date" is the first column and "price" is...
2
1296
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 Firefox I get an empty string. No errors are reported. If I look at the code with Firefox debugger (Venkman) everything works fine. I should probably put a loop somewhere to check when loading the file is finished. var xmlhttp;
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10225
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10053
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.