Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pyMKcam
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
machinery
pyMKcam
Commits
6319da36
Commit
6319da36
authored
Feb 03, 2012
by
Lars Kruse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unfinished changes, don't push me
parent
31c4d85e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
49 deletions
+0
-49
xml_handling.py
pycam/Utils/xml_handling.py
+0
-49
No files found.
pycam/Utils/xml_handling.py
View file @
6319da36
...
...
@@ -21,53 +21,4 @@ You should have received a copy of the GNU General Public License
along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
"""
import
xml.etree.ElementTree
as
ET
def
get_xml
(
item
,
name
=
None
):
if
name
is
None
:
if
hasattr
(
item
,
"node_key"
):
name
=
item
.
node_key
else
:
name
=
"value"
if
isinstance
(
item
,
(
list
,
tuple
,
set
)):
leaf
=
ET
.
Element
(
name
)
for
single
in
item
:
leaf
.
append
(
get_xml
(
single
))
return
leaf
elif
isinstance
(
item
,
dict
):
leaf
=
ET
.
Element
(
name
)
for
key
,
value
in
item
.
iteritems
():
leaf
.
append
(
get_xml
(
value
,
name
=
key
))
return
leaf
else
:
leaf
=
ET
.
Element
(
name
)
leaf
.
text
=
str
(
item
)
return
leaf
def
parse_xml_dict
(
item
):
pass
def
get_xml_lines
(
item
):
lines
=
[]
content
=
ET
.
tostring
(
item
)
content
=
content
.
replace
(
"><"
,
">
\n
<"
)
indent
=
0
for
line
in
content
.
split
(
"
\n
"
):
indented
=
False
if
line
.
startswith
(
"</"
):
indent
-=
2
indented
=
True
lines
.
append
(
" "
*
indent
+
line
)
if
indented
:
pass
elif
line
.
endswith
(
"/>"
):
pass
elif
line
.
startswith
(
"</"
):
indent
-=
2
elif
"</"
in
line
:
pass
else
:
indent
+=
2
return
lines
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