Copy Source | Copy HTML app_xml = xmlp.parse( "base.xml" ) id = app_xml.createElement(att) node = app_xml.createTextNode("simple.App") id .appendChild(node) root.appendChild(id) res = open ( "base.xml" , "w" ) res .writelines(app_xml.toprettyxml()) res .close()
Copy Source | Copy HTML app_xml = xmlp.parse( "base.xml" ) id = app_xml.createElement(att) node = app_xml.createTextNode("simple.App") id .appendChild(node) root.appendChild(id) res = open ( "base.xml" , "w" ) res .writelines(app_xml.toprettyxml()) res .close()
Copy Source | Copy HTML app_xml = xmlp.parse( "base.xml" ) id = app_xml.createElement(att) node = app_xml.createTextNode("simple.App") id .appendChild(node) root.appendChild(id) res = open ( "base.xml" , "w" ) res .writelines(app_xml.toprettyxml()) res .close()
Copy Source | Copy HTML app_xml = xmlp.parse( "base.xml" ) id = app_xml.createElement(att) node = app_xml.createTextNode("simple.App") id .appendChild(node) root.appendChild(id) res = open ( "base.xml" , "w" ) res .writelines(app_xml.toprettyxml()) res .close()
Copy Source | Copy HTML app_xml = xmlp.parse( "base.xml" ) id = app_xml.createElement(att) node = app_xml.createTextNode("simple.App") id .appendChild(node) root.appendChild(id) res = open ( "base.xml" , "w" ) res .writelines(app_xml.toprettyxml()) res .close()
Copy Source | Copy HTML app_xml = xmlp.parse( "base.xml" ) id = app_xml.createElement(att) node = app_xml.createTextNode("simple.App") id .appendChild(node) root.appendChild(id) res = open ( "base.xml" , "w" ) res .writelines(app_xml.toprettyxml()) res .close()
Copy Source | Copy HTML app_xml = xmlp.parse( "base.xml" ) id = app_xml.createElement(att) node = app_xml.createTextNode("simple.App") id .appendChild(node) root.appendChild(id) res = open ( "base.xml" , "w" ) res .writelines(app_xml.toprettyxml()) res .close()
Copy Source | Copy HTML app_xml = xmlp.parse( "base.xml" ) id = app_xml.createElement(att) node = app_xml.createTextNode("simple.App") id .appendChild(node) root.appendChild(id) res = open ( "base.xml" , "w" ) res .writelines(app_xml.toprettyxml()) res .close()
Copy Source | Copy HTML app_xml = xmlp.parse( "base.xml" ) id = app_xml.createElement(att) node = app_xml.createTextNode("simple.App") id .appendChild(node) root.appendChild(id) res = open ( "base.xml" , "w" ) res .writelines(app_xml.toprettyxml()) res .close()
<id> simple.App </ id>
<id>
simple.App
</ id>
Copy Source | Copy HTML
- <? xml version = '1.0' encoding = 'utf-8' ? > < application xmlns = "http://ns.adobe.com/air/application/1.5"> < id > simple.test.program </ id > < version > 0.1 </ version > < filename > testapp </ filename > < name > testapp </ name > < initialWindow > < title > Test AIR Application </ title > < content > test.html </ content > < height > 320 </ height > < width > 240 </ width > < visible > true </ visible > < resizable > true </ resizable > </ initialWindow > </ application >
Copy Source | Copy HTML
- root = etree.Element ( "initialWindow" )
- etree.SubElement (root, "title" ) .text = title
- etree.SubElement (root, "content" ) .text = content
- etree.SubElement (root, "height" ) .text = str (height)
- etree.SubElement (root, "width" ) .text = str (width)
- app_window = etree.tostring (root)
- ...
- root = etree.Element ( "application" , xmlns = "http://ns.adobe.com/air/application/1.5" )
- etree.SubElement (root, "id" ) .text = id
- etree.SubElement (root, "version" ) .text = version
- etree.SubElement (root, "filename" ) .text = filename
- etree.SubElement (root, "name" ) .text = self .name
- root.append (etree.XML (app_window))
- handle = etree.tostring (root, pretty_print = True, encoding = 'utf-8' , xml_declaration = True)
- applic = open ( self .fullpath + "/" + self .name + "-app.xml" , "w" )
- applic.writelines (handle)
- applic.close ()
Copy Source | Copy HTML
- <? xml version = '1.0' encoding = 'utf-8' ? >
- < application xmlns = "http://ns.adobe.com/air/application/1.5">
- < id > simple.test.program </ id >
- < version > 0.1 </ version >
- < testapp </ filename >
- < name > testapp </ name >
- < initialWindow >
- < title > Test AIR Application </ title >
- < content > test.html </ content >
- < height > 320 </ height >
- < width > 240 </ width >
- </ initialWindow >
- </ application >
$ sudo easy_install lxml
Source: https://habr.com/ru/post/61523/
All Articles