:: Forum >> Version 1 >>

Going from Table to XML file

I can't seem to find any info on going from grid to saving XML file.
Would I have to make a function to read each node on the grid, and put the <quoteNum> nodefromgird </quoteNum> around each line, or is there an easier way to do this?
Phoenix
Friday, September 3, 2004
If you use the editable cell template like described here:

/javascript.forum.1621.1/

- the XML data will be updated automatically thanks to the table.setText() method. But you still have to serialise the XML and send back to the server somehow.
Alex (ActiveWidgets)
Friday, September 3, 2004
I just made this function, which a button calls it.

<script type="text/javascript">

  var 
dumpXML = function(){
     var 
dumptemp "<root> \n";

     for (
0<=table.getCount(); i++){
    if (
table.getText(i10) == "C") {
    
dumptemp += "<QuoteFeedback OrderInfo='" table.getText(i,4) + "'"    " OrderDate='" table.getText(i,5) + "'" " OrderStatus='" table.getText(i,6) + "'" " LostOrderCode='" table.getText(i,7) + "'" " CompetitorCode='" table.getText(i,8) + "'"    " Comments='" table.getText(i,9) + "'" "/> \n";
             }
     }
    
dumptemp += "</root>"
    
document.getElementById("debugConsole1").value dumptemp;
  }

</
script>
 
So my debug console will look like the XML file. (Just so i can visually see it, I will take out the debug console when I finish the project. And from there, I just send the 'dumptemp' to an URL template and off she goes.

I just wanted to know if I had to make up the function (like I did above, or if there was a commmand like

var newXML = table.returnValues

But from the looks of things, the function is good enough for what I need.
Phoenix
Friday, September 3, 2004
You can try

var xml = table.getXML();

to get access to XML object.
Alex (ActiveWidgets)
Friday, September 3, 2004
All that returns is

[object]


What can I do with that?
Phoenix
Thursday, September 9, 2004
My first way, looks like its doing the trick, unless there is an easier way, but all and all, it's alright.

To populate select boxes from an XML file, would you first load the XML file into a table, and then do the....

.addOption( "table.getText(1,1)", "table.getText(1,0)");

??
Phoenix
Thursday, September 9, 2004
Is there a way to loop until the xml grid is finished loading?
If I make a button and put the .addOption codes in there, it works fine, because by the time I go and click the button, the xml data is loaded.

But I don't want the user to click a button evertime the page gets loaded.
Phoenix
Monday, September 20, 2004
I know this would be one chessy way of doing it.. but what if you put all of the .addOptions into a function, then called it with..

obj.setAction("click"clickaction);  and within your function, make a boolean varible, so it only loads the function once.
Monday, September 20, 2004
I don't want the user to click on the grid first, and then click on the dropdown boxes.

It would be nice if the grid waited for the dropdown talbes to load first, before it will display. Is it something to do with the table.request ?
Phoenix
Monday, September 27, 2004

hai I need the the proper code for display the xml file using jsp.

how can i do it ?

I have one table. ex. employee.xml I have to display this xml file in jsp. kindly send
the code in apandianmca@yahoo.com. Please.......
A.Pandian
Thursday, November 30, 2006



This topic is archived.

Back to support forum

Forum search