473,657 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML dom to a file code....

23 New Member
Hi the changes that i am making using dom (see function modify) take place only in memory untill the next reload ..but not in my xml file

I am doing this for a customer and i am unable to install a
server side language to do a submit , how can i save the contents of
xmldoc directly to a file locally ?? I was thnking of active x , but can someone someone post some code? is that the best solution?



Contents of xml file :



<?xml version="1.0" encoding="UTF-8"?>
<Global_Emergen cy activated="off" >
<VDN id="000" Country="GR" ServiceName="CA ">
<Training_Emerg ency>off</Training_Emerge ncy>
<Languages number="0" InitLanguage="E N">
<language/>
<language/>
<language/>
</Languages>
<Opening_Hour s>
<General_Openin g_Hours>
<day name="Monday" Open="08:00" Closed="17:00"/>
</General_Opening _Hours>
</Opening_Hours>
<Menus>
<Menu ID="MM" Name="Main Menu">
<option name="PARTS" type="Transfer" enabled="false"/>
</Menu>
<Menu ID="CLUBUS" Name="CLUB_US" submenuof="MM">
<option name="FORMS" type="Transfer" enabled="TRUE"> 22</
option>
</Menu>
</Menus>


HTML code:

<html>
<head>
<script type="text/javascript" src="js/loadxmldoc.js">
</script>



<form method="POST" onsubmit="retur n modify();">
<p>&nbsp;</p>


<script type="text/javascript">


function modify()


{


if (window.ActiveX Object)
{
xmlDoc=new ActiveXObject(" Microsoft.XMLDO M");


}


// code for Mozilla, Firefox, Opera, etc.
else if (document.imple mentation.creat eDocument)
{
xmlDoc=document .implementation .createDocument ("","",null) ;

}


else
{
alert('Your browser cannot handle this script');

}


xmlDoc.async=fa lse;
xmlDoc.load("co nfig.xml");

y=xmlDoc.getEle mentsByTagName( 'Global_Emergen cy');


alert ("we are in modify");
alert (xmlDoc);
//var x=xmlDoc.docume ntElement.getAt tribute('activa ted');

//alert (x);

for(i=0;i<y.len gth;i++)
{
alert (i);
y.item(i).setAt tribute("activa ted","newvalue" );
}

for (i=0;i<y.length ;i++)
{
document.write( y[i].getAttribute(' activated'));
document.write( "<br />");
}
//xmlDoc.document Element.setAttr ibute('activate d','newvalue');

}


function finalcheck()

{
alert ("hi");



}


function parseXML()
{
try
{//try IE first
xmlDoc=new ActiveXObject(" Microsoft.XMLDO M");
}
catch(e)
{
try
{//try Mozilla, Firefox, Opera, etc.
xmlDoc=document .implementation .createDocument ("","",null) ;
}
catch(e)
{
alert(e.message );
return;
}
}
xmlDoc.async=fa lse;
xmlDoc.load("co nfig.xml");

var y=xmlDoc.getEle mentsByTagName( "VDN");


alert(y.length) ;


var x=xmlDoc.docume ntElement.child Nodes;
alert(x.length) ;
var x=xmlDoc.docume ntElement.getAt tribute('activa ted');


gedrop=document .getElementById ("GE");


alert(x);


/*
for (var i=0; i< getdrop.options .length; i++)
{


alert (getdrop.option s[i].text.toUpperCa se() );
/*
if (getdrop.option s[i].[gedrop.selected Index].value==x)
{
// alert ("found");
// alert (getdrop.option s[i].[gedrop.selected Index]);
}
*/


if (x=="off")
{
alert ("that works"); //do nothing



}


else

{
gedrop.selected Index=1;



}


/*

if (gedrop.options[gedrop.selected Index].value==x)
{
alert ("index is"+gedrop.sele ctedIndex);


alert ("found");



}


else
{
if (gedrop.options[gedrop.selected Index]==0)
{gedrop.selecte dIndex=1};


}


*/
//document.getEle mentById('GE'). selectedIndex=
/*
=x;

document.getEle mentById('dropd ownlistname').s elect edIndex =
indexNumber
alert (x);
*/


/*
document.getEle mentById("to"). innerHTML=
xmlDoc.getEleme ntsByTagName("t o")[0].childNodes[0].nodeValue;
document.getEle mentById("from" ).innerHTML=
xmlDoc.getEleme ntsByTagName("f rom")[0].childNodes[0].nodeValue;
document.getEle mentById("messa ge").innerHTM L=
xmlDoc.getEleme ntsByTagName("b ody")[0].childNodes[0].nodeValue;


*/


}


</script>
</head>

<body onload="parseXM L()">
<h1>Global Emergency <select size="1" id="GE" name="D1">
<option value="off">Not Active</option>
<option value="on">Acti ve</option>
</select></h1>
<p><input type="submit" value="Submit" name="B1"><inpu t
type="button" onclick="modify ();" value="Button" name="B2"></p>
</form>
</body>
</html>
Mar 27 '08 #1
2 1937
panos100m
23 New Member
This is solved..
I used active x to save the file and it works fine.
Mar 27 '08 #2
icesh
15 New Member
hello,, I have same problem as panos100m..
can anyone help me?
how can we save the file using active x?
thank you very much
Apr 6 '08 #3

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

Similar topics

5
6113
by: Brandon Walters | last post by:
I wrote a file download module for my website. The reason for the file download module is that my website downloads work on a credit based system. So I need to keep track of and limit daily downloads. It uses fpassthru() and some headers() to send a file to the requesting user. The get.php file that I wrote (the file download module if you will) works like a charm for .ZIP files and .TXT files. However, when .EXE files are downloaded...
3
4599
by: Pernell Williams | last post by:
Hi all: I am new to Python, and this is my first post (and it won't be my last!), so HELLO EVERYONE!! I am attempting to use "xreadlines", an outer loop and an inner loop in conjunction with "file.tell() and file.seek() in order to navigate through a file in order to print specific lines (for example, every 5th line). Allow me to illustrate by example:
9
3198
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is indeed also true for our language of choice, Python. Its file type allows some extraordinary convenient access like: for line in open("blah"): handle_line(line)
7
12960
by: A_StClaire_ | last post by:
hi, I'm working on a project spanning five .cpp files. each file was used to define a class. the first has my Main and an #include for each of the other files. problem is my third file needs to access the class defined in my second file and I can't figure out how to work this right. if I use an #include in my third file, my Main gives me a compile-time class redefinition error. if I don't, the third file can't "see" the second
1
19919
by: ABCL | last post by:
Hi All, I am working on the situation where 2 different Process/Application(.net) tries to open file at the same time....Or one process is updating the file and another process tries to access it, it throws an exception. How to solave this problem? So second process can wait until first process completes its processing on the file. Thanks in advance
1
64094
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this article “How to Parse a File in C++”, we are actually mostly lexing a file which is the breaking down of a stream in to its component parts, disregarding the syntax that stream contains. Parsing is actually including the syntax in order to make...
6
248944
Atran
by: Atran | last post by:
Hello: In this article: You will learn to Write or Read A Text File. Let's Begin: First Create a new project (ConsoleApp or WinApp). And Make sure your program uses these namespaces: using System; using System.IO; using System.Diagnostics;
4
6901
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the function creates the file as expected. When I loop through my array I get the error - "ArgumentException was unhandled - Illegal characters in path" The value "C:\Temp.txt" is the first value in the array - as it works
1
2104
roswara
by: roswara | last post by:
Dear all, Currently, I am working on a project to make a web-based application using ASP 2.0 and C#. This application will ask user to input for an excel file which has graphs in it. Then the application will grab the graph as image file, and this image will be displayed as thumbnail in the page. Is it possible to accomplish this feature? If it is possible, would you please tell me how? And if it is not possible, why?
1
47442
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as “open” or “save“. I’m going to show you how to do that using a perl script. What You Need Any recent...
0
8394
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8732
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
8503
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
8605
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...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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

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.