Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
cda80744
Commit
cda80744
authored
Jul 22, 1999
by
joey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Syntax modification made.
parent
5a584914
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
lib/python/Shared/DC/xml/xyap.py
lib/python/Shared/DC/xml/xyap.py
+24
-14
No files found.
lib/python/Shared/DC/xml/xyap.py
View file @
cda80744
...
...
@@ -21,14 +21,12 @@ Oh well.
import
string
from
pickle
import
*
import
xmllib
class
XY
ap
:
class
xy
ap
:
start_handlers
=
{}
end_handlers
=
{}
def
__init__
(
self
,
parser
):
parser
.
__init__
(
self
)
def
__init__
(
self
):
top
=
[]
self
.
_stack
=
_stack
=
[
top
]
self
.
push
=
_stack
.
append
...
...
@@ -37,6 +35,13 @@ class XYap:
def
handle_data
(
self
,
data
):
self
.
append
(
data
)
def
unknown_starttag
(
self
,
tag
,
attrs
):
if
type
(
attrs
)
is
ListType
:
x
=
0
temp
=
{}
while
x
<
len
(
attrs
):
temp
[
attrs
[
x
]]
=
attrs
[
x
+
1
]
x
=
x
+
2
attrs
=
temp
start
=
self
.
start_handlers
if
start
.
has_key
(
tag
):
tag
=
start
[
tag
](
self
,
tag
,
attrs
)
else
:
tag
=
[
tag
,
attrs
]
...
...
@@ -53,10 +58,11 @@ class XYap:
append
(
top
)
class
NoBlanks
:
def
handle_data
(
self
,
data
):
if
string
.
strip
(
data
):
self
.
append
(
data
)
import
xmllib
def
struct
(
self
,
tag
,
data
):
r
=
{}
...
...
@@ -68,6 +74,13 @@ def name(self, tag, data, join=string.join, strip=string.strip):
def
tuplef
(
self
,
tag
,
data
):
return
tuple
(
data
[
2
:])
class
XYap
(
xyap
,
xmllib
.
XMLParser
):
def
__init__
(
self
):
xmllib
.
XMLParser
.
__init__
(
self
)
top
=
[]
self
.
_stack
=
_stack
=
[
top
]
self
.
push
=
_stack
.
append
self
.
append
=
top
.
append
class
xmlrpc
(
NoBlanks
,
XYap
,
xmllib
.
XMLParser
):
end_handlers
=
{
...
...
@@ -78,7 +91,7 @@ class xmlrpc(NoBlanks, XYap, xmllib.XMLParser):
'value'
:
lambda
self
,
tag
,
data
:
data
[
2
],
'i4'
:
lambda
self
,
tag
,
data
,
atoi
=
string
.
atoi
,
name
=
name
:
atoi
(
name
(
self
,
tag
,
data
)),
atoi
(
name
(
self
,
tag
,
data
)),
'int'
:
lambda
self
,
tag
,
data
,
atoi
=
string
.
atoi
,
name
=
name
:
atoi
(
name
(
self
,
tag
,
data
)),
...
...
@@ -101,6 +114,7 @@ class xmlrpc(NoBlanks, XYap, xmllib.XMLParser):
}
def
test
():
data
=
"""<?xml version="1.0"?>
<methodCall>
<methodName>examples.getStateName
...
...
@@ -137,15 +151,11 @@ def test():
</params>
</methodCall>
"""
data
=
string
.
split
(
data
,
'
\
n
'
)
class
xyap
(
XYap
,
xmllib
.
XMLParser
):
pass
data
=
string
.
split
(
data
,
'
\
n
'
)
r
=
[]
for
C
in
xy
ap
,
xmlrpc
:
p
=
C
(
xmllib
.
XMLParser
)
for
C
in
XY
ap
,
xmlrpc
:
p
=
C
()
for
l
in
data
:
p
.
feed
(
l
)
p
.
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