实际上,我已经得到了XML字符串并解析了该字符串以从中获取属性。现在我想更改我的XML文件,查看属性。就像我想改变笔划的颜色。有什么办法吗?我将如何更改并再次保存文件。在
import requests
from xml.dom import minidom
response = requests.get('http://localhost:8080/geoserver/rest/styles/pakistan.sld',
auth=('admin', 'geoserver'))
fo=open("/home/adeel/Desktop/untitled1/yes.xml", "wb")
fo.write(response.text)
fo.close()
xmldoc = minidom.parse('yes.xml')
itemlist = xmldoc.getElementsByTagName('CssParameter')
print "Len : ", len(itemlist)
#print "Attribute Name : ", \
itemlist[0].attributes['name'].value
print "Text : ", itemlist[0].firstChild.nodeValue
for s in itemlist :
print "Attribute Name : ", s.attributes['name'].value
print "Text : ", s.firstChild.nodeValue
您可能应该通读SLD Cook book以获得有关如何更改SLD中线条颜色等内容的提示。一旦您更改了它,您需要创建一个^{} request 来将文件放回服务器上。在
相关问题 更多 >
编程相关推荐