Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
4315ee3b
Commit
4315ee3b
authored
Mar 24, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(python): Заменил в UniXML использование 'xml.dom.minidom' на 'lxml',
т.к. xml.dom.minidom портит список свойст (пересортировывает при сохранении)
parent
ca698118
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
UniXML.py
python/lib/UniXML.py
+4
-4
No files found.
python/lib/UniXML.py
View file @
4315ee3b
...
...
@@ -3,7 +3,7 @@
import
sys
import
libxml2
import
xml.dom.minidom
as
md
from
lxml
import
etree
import
re
import
os
# -----------------------------
...
...
@@ -162,13 +162,13 @@ class UniXML():
def
pretty_save
(
self
,
filename
):
context
=
self
.
doc
.
serialize
(
encoding
=
"utf-8"
)
mdoc
=
md
.
parseString
(
context
)
s
=
mdoc
.
toprettyxml
(
encoding
=
"utf-8"
)
.
split
(
"
\n
"
)
mdoc
=
etree
.
XML
(
context
)
s
=
etree
.
tostring
(
mdoc
,
pretty_print
=
True
,
encoding
=
"UTF-8"
,
method
=
'xml'
,
xml_declaration
=
True
)
.
split
(
"
\n
"
)
out
=
open
(
filename
,
"w"
)
p
=
re
.
compile
(
r'\ [^\s]{1,}=""'
)
for
l
in
s
:
if
l
.
strip
():
# удаяем пустые свойства prop=""
# уда
л
яем пустые свойства prop=""
l
=
p
.
sub
(
''
,
l
)
out
.
write
(
l
+
"
\n
"
)
out
.
close
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment