сохраняю наработки связанные с работой над xml документами
This commit is contained in:
parent
cf255b7b1b
commit
91b91a867d
|
|
@ -0,0 +1,18 @@
|
|||
import xml.etree.ElementTree as eT
|
||||
|
||||
androidNs = 'http://schemas.android.com/apk/res/android'
|
||||
eT.register_namespace('android', androidNs)
|
||||
|
||||
tree = eT.parse('data.xml')
|
||||
root = tree.getroot()
|
||||
|
||||
print root.attrib
|
||||
|
||||
root.set('myAtr', 'myValue')
|
||||
root.set('{{{0}}}myAtr'.format(androidNs), '777')
|
||||
root.set('android:MyAttribute', 'Rustam')
|
||||
|
||||
tree.write('output.xml', xml_declaration=True, encoding='utf-8', method="xml")
|
||||
|
||||
print root.tag
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="DroidApp.DroidApp">
|
||||
<uses-sdk />
|
||||
<application android:label="DroidApp">
|
||||
</application>
|
||||
</manifest>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:MyAttribute="Rustam" myAtr="myValue" package="DroidApp.DroidApp" android:myAtr="777" android:versionCode="1" android:versionName="1.0">
|
||||
<uses-sdk />
|
||||
<application android:label="DroidApp">
|
||||
</application>
|
||||
</manifest>
|
||||
Loading…
Reference in New Issue