Click here to Skip to main content
15,867,750 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Guys I have a big XML where I save data this way:

XML
<tabuleiro>
    <linha> <!-- Linha inicial -->
        <coluna1>3</coluna1>
        <coluna2>3</coluna2>
        <coluna3>3</coluna3>
.
....etc


I receive two variables (from XMLHttpRequest)

C#
String str = request.getParameter("local");
String str2 = request.getParameter("cor");


And I need to update the file many times. I did that using php this way:

PHP
$sxe = new SimpleXMLElement('tabuleiro.xml', NULL, TRUE);
    $linha=$sxe->linha;


if($local == 1)
    $linha[0]-> coluna1 =$cor;
    else if($local == 2)
    $linha[0]-> coluna2 =$cor;
.................


The problem is I have no idea how to place those values where I want (in the xml file) with JSP... Anybody can give me an hint?
Posted
Updated 12-Apr-11 7:34am
v2

1 solution

You want do it with JSP?!
you can use java xml/dom api!, see here many tuts http://www.java2s.com/Tutorial/Java/0440__XML/Catalog0440__XML.htm[^]
if you need easy stuff try maybe JSoup, I use it for parsing HTML but you can try it with XML. http://jsoup.org/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900