Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
cf0a1cc4
Kaydet (Commit)
cf0a1cc4
authored
Eki 03, 2000
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Support non-namespace elements in *ElementNS of XMLGenerator.
üst
1654b43e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
test_sax.py
Lib/test/test_sax.py
+5
-1
saxutils.py
Lib/xml/sax/saxutils.py
+10
-2
No files found.
Lib/test/test_sax.py
Dosyayı görüntüle @
cf0a1cc4
...
...
@@ -112,11 +112,15 @@ def test_xmlgen_ns():
gen
.
startDocument
()
gen
.
startPrefixMapping
(
"ns1"
,
ns_uri
)
gen
.
startElementNS
((
ns_uri
,
"doc"
),
"ns1:doc"
,
{})
# add an unqualified name
gen
.
startElementNS
((
None
,
"udoc"
),
None
,
{})
gen
.
endElementNS
((
None
,
"udoc"
),
None
)
gen
.
endElementNS
((
ns_uri
,
"doc"
),
"ns1:doc"
)
gen
.
endPrefixMapping
(
"ns1"
)
gen
.
endDocument
()
return
result
.
getvalue
()
==
start
+
(
'<ns1:doc xmlns:ns1="
%
s"></ns1:doc>'
%
return
result
.
getvalue
()
==
start
+
\
(
'<ns1:doc xmlns:ns1="
%
s"><udoc></udoc></ns1:doc>'
%
ns_uri
)
# ===== XMLFilterBase
...
...
Lib/xml/sax/saxutils.py
Dosyayı görüntüle @
cf0a1cc4
...
...
@@ -62,7 +62,12 @@ class XMLGenerator(handler.ContentHandler):
self
.
_out
.
write
(
'</
%
s>'
%
name
)
def
startElementNS
(
self
,
name
,
qname
,
attrs
):
name
=
self
.
_current_context
[
name
[
0
]]
+
":"
+
name
[
1
]
if
name
[
0
]
is
None
:
# if the name was not namespace-scoped, use the unqualified part
name
=
name
[
1
]
else
:
# else try to restore the original prefix from the namespace
name
=
self
.
_current_context
[
name
[
0
]]
+
":"
+
name
[
1
]
self
.
_out
.
write
(
'<'
+
name
)
for
pair
in
self
.
_undeclared_ns_maps
:
...
...
@@ -75,7 +80,10 @@ class XMLGenerator(handler.ContentHandler):
self
.
_out
.
write
(
'>'
)
def
endElementNS
(
self
,
name
,
qname
):
name
=
self
.
_current_context
[
name
[
0
]]
+
":"
+
name
[
1
]
if
name
[
0
]
is
None
:
name
=
name
[
1
]
else
:
name
=
self
.
_current_context
[
name
[
0
]]
+
":"
+
name
[
1
]
self
.
_out
.
write
(
'</
%
s>'
%
name
)
def
characters
(
self
,
content
):
...
...
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