在服务器上这么修改xml,javascript在服务器上更改xml文件

本文介绍了如何在Eclipse的DesignStudio中通过JavaScript动态改变contribution.xml文件中的backgroundColor属性,并探讨了如何实现客户端更改后在服务器上的同步问题,以确保实时更新。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我在Eclipse中制作Design Studio自定义组件。我在我的contribution.xml文件中创建了一个属性'backgroundColor'。我可以在我的JavaScript内部调用这个xml文件并在本地进行调整,但有没有办法将这些更改再次上传到服务器xml文件?因为目前我的警报会返回所有新数据,但在服务器端没有任何反应。javascript在服务器上更改xml文件

的代码,我有:

Contribution.xml:

id="backgroundColor"

title="BackgroundColor"

type="Color"

group="Display"

visible="true"

bindable="true"/>

component.js:

var xhttp = new XMLHttpRequest();

xhttp.onreadystatechange = function() {

if (this.readyState == 4 && this.status == 200) {

myFunction(this);

}

};

xhttp.open("GET", "serverpath/contribution.xml", true);

xhttp.send();

function myFunction(xml) {

xml.responseXML.getElementsByTagName('property')[0].setAttribute("visible",false);

//this returns BackgroundColor so the call does work

alert(xml.responseXML.getElementsByTagName('property')[0].getAttribute("title"));

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值