ó
îRac @ sÖ d d l Z d d l Z d d l Z d d l m Z d e d „ Z d d „ Z d e e d „ Z i d d 6d
d 6d d
6d d 6d d 6d d 6d d 6Z e j
d d j e e j
e j ƒ ƒ ƒ ƒ Z e d „ Z d S( iÿÿÿÿN( t reduces utf-8c C s@ d | g } | r# | j d ƒ n t | | | ƒ d j | ƒ S( sy Writes the XML content to disk, touching the file only if it has changed.
Visual Studio files have a lot of pre-defined structures. This function makes
it easy to represent these structures as Python data structures, instead of
having to create a lot of function calls.
Each XML element of the content is represented as a list composed of:
1. The name of the element, a string,
2. The attributes of the element, a dictionary (optional), and
3+. The content of the element, if any. Strings are simple text nodes and
lists are child elements.
Example 1:
becomes
['test']
Example 2:
This is
it!
becomes
['myelement', {'a':'value1', 'b':'value2'},
['childtype', 'This is'],
['childtype', 'it!'],
]
Args:
content: The structured content to be converted.
encoding: The encoding to report on the first XML line.
pretty: True if we want pretty printing with indents and new lines.
Returns:
The XML content as a string.
s# s
t ( t appendt _ConstructContentListt join( t contentt encodingt prettyt xml_parts( ( sj /opt/alt/alt-nodejs8/root/usr/lib/node_modules/npm/node_modules.bundled/node-gyp/gyp/pylib/gyp/easy_xml.pyt XmlToString s
'
i c
C sÉ | r d | } d } n d } d } | d } t | t ƒ sW t d t | ƒ ƒ ‚ n | j | d | ƒ | d } | ræ t | d t ƒ ræ xG t | d j ƒ ƒ D]/ \ } } | j d | t | d t ƒf ƒ q¦ W| d } n | r´| j d
ƒ t d „ | t ƒ }
|
} | r1| r1| j | ƒ n xJ | D]B } t | t ƒ rc| j t | ƒ ƒ q8t
| | | | d ƒ q8W| rš| rš| j | ƒ n | j d | | f ƒ n | j d
| ƒ d S( s+ Appends the XML parts corresponding to the specification.
Args:
xml_parts: A list of XML parts to be appended to.
specification: The specification of the element. See EasyXml docs.
pretty: True if we want pretty printing with indents and new lines.
level: Indentation level.
s s
R i sR The first item of an EasyXml specification should be a string. Specification was t