使用JSP用XML编写(从PHP迁移) [英] Writing in XML with JSP (Migration from PHP)

查看:105
本文介绍了使用JSP用XML编写(从PHP迁移)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,我有一个很大的XML,可以这样保存数据:

Guys I have a big XML where I save data this way:

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



我收到两个变量(来自XMLHttpRequest)



I receive two variables (from XMLHttpRequest)

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



而且我需要多次更新文件.我是这样用php做到的:



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

$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;
.................



问题是我不知道如何使用JSP将这些值放在我想要的位置(在xml文件中).有人可以给我提示吗?



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?

推荐答案

sxe = SimpleXMLElement(' tabuleiro. xml',NULL,TRUE);
sxe = new SimpleXMLElement('tabuleiro.xml', NULL, TRUE);


linha =


sxe-> linha; if(
sxe->linha; if(


这篇关于使用JSP用XML编写(从PHP迁移)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆