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
87432f42
Kaydet (Commit)
87432f42
authored
Nis 04, 2001
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add support for the CharacterData methods, CDATASection.
üst
c6a3cb4b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
7 deletions
+73
-7
minidom.py
Lib/xml/dom/minidom.py
+73
-7
No files found.
Lib/xml/dom/minidom.py
Dosyayı görüntüle @
87432f42
...
...
@@ -613,24 +613,76 @@ class ProcessingInstruction(Node):
def
writexml
(
self
,
writer
,
indent
=
""
,
addindent
=
""
,
newl
=
""
):
writer
.
write
(
"
%
s<?
%
s
%
s?>
%
s"
%
(
indent
,
self
.
target
,
self
.
data
,
newl
))
class
Text
(
Node
):
nodeType
=
Node
.
TEXT_NODE
nodeName
=
"#text"
attributes
=
None
childNodeTypes
=
()
class
CharacterData
(
Node
):
def
__init__
(
self
,
data
):
if
type
(
data
)
not
in
_StringTypes
:
raise
TypeError
,
"node contents must be a string"
Node
.
__init__
(
self
)
self
.
data
=
self
.
nodeValue
=
data
def
__getattr__
(
self
,
name
):
if
name
==
"length"
:
return
len
(
self
.
data
)
def
__repr__
(
self
):
if
len
(
self
.
data
)
>
10
:
dotdotdot
=
"..."
else
:
dotdotdot
=
""
return
"<DOM Text node
\"
%
s
%
s
\"
>"
%
(
self
.
data
[
0
:
10
],
dotdotdot
)
return
"<DOM
%
s node
\"
%
s
%
s
\"
>"
%
(
self
.
__class__
.
__name__
,
self
.
data
[
0
:
10
],
dotdotdot
)
def
substringData
(
self
,
offset
,
count
):
if
offset
<
0
:
raise
xml
.
dom
.
IndexSizeErr
(
"offset cannot be negative"
)
if
offset
>=
len
(
self
.
data
):
raise
xml
.
dom
.
IndexSizeErr
(
"offset cannot be beyond end of data"
)
if
count
<
0
:
raise
xml
.
dom
.
IndexSizeErr
(
"count cannot be negative"
)
return
self
.
data
[
offset
:
offset
+
count
]
def
appendData
(
self
,
arg
):
self
.
data
=
self
.
data
+
arg
self
.
nodeValue
=
self
.
data
def
insertData
(
self
,
offset
,
arg
):
if
offset
<
0
:
raise
xml
.
dom
.
IndexSizeErr
(
"offset cannot be negative"
)
if
offset
>=
len
(
self
.
data
):
raise
xml
.
dom
.
IndexSizeErr
(
"offset cannot be beyond end of data"
)
if
arg
:
self
.
data
=
"
%
s
%
s
%
s"
%
(
self
.
data
[:
offset
],
arg
,
self
.
data
[
offset
:])
self
.
nodeValue
=
self
.
data
def
deleteData
(
self
,
offset
,
count
):
if
offset
<
0
:
raise
xml
.
dom
.
IndexSizeErr
(
"offset cannot be negative"
)
if
offset
>=
len
(
self
.
data
):
raise
xml
.
dom
.
IndexSizeErr
(
"offset cannot be beyond end of data"
)
if
count
<
0
:
raise
xml
.
dom
.
IndexSizeErr
(
"count cannot be negative"
)
if
count
:
self
.
data
=
self
.
data
[:
offset
]
+
self
.
data
[
offset
+
count
:]
self
.
nodeValue
=
self
.
data
def
replaceData
(
self
,
offset
,
count
,
arg
):
if
offset
<
0
:
raise
xml
.
dom
.
IndexSizeErr
(
"offset cannot be negative"
)
if
offset
>=
len
(
self
.
data
):
raise
xml
.
dom
.
IndexSizeErr
(
"offset cannot be beyond end of data"
)
if
count
<
0
:
raise
xml
.
dom
.
IndexSizeErr
(
"count cannot be negative"
)
if
count
:
self
.
data
=
"
%
s
%
s
%
s"
%
(
self
.
data
[:
offset
],
arg
,
self
.
data
[
offset
+
count
:])
self
.
nodeValue
=
self
.
data
class
Text
(
CharacterData
):
nodeType
=
Node
.
TEXT_NODE
nodeName
=
"#text"
attributes
=
None
childNodeTypes
=
()
def
splitText
(
self
,
offset
):
if
offset
<
0
or
offset
>
len
(
self
.
data
):
...
...
@@ -648,6 +700,15 @@ class Text(Node):
def
writexml
(
self
,
writer
,
indent
=
""
,
addindent
=
""
,
newl
=
""
):
_write_data
(
writer
,
"
%
s
%
s
%
s"
%
(
indent
,
self
.
data
,
newl
))
class
CDATASection
(
Text
):
nodeType
=
Node
.
CDATA_SECTION_NODE
nodeName
=
"#cdata-section"
def
writexml
(
self
,
writer
,
indent
=
""
,
addindent
=
""
,
newl
=
""
):
_write_data
(
writer
,
"<![CDATA[
%
s]]>"
%
self
.
data
)
def
_nssplit
(
qualifiedName
):
fields
=
_string
.
split
(
qualifiedName
,
':'
,
1
)
if
len
(
fields
)
==
2
:
...
...
@@ -781,6 +842,11 @@ class Document(Node):
t
.
ownerDocument
=
self
return
t
def
createCDATASection
(
self
,
data
):
c
=
CDATASection
(
data
)
c
.
ownerDocument
=
self
return
c
def
createComment
(
self
,
data
):
c
=
Comment
(
data
)
c
.
ownerDocument
=
self
...
...
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