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
bb757136
Kaydet (Commit)
bb757136
authored
Eyl 24, 2000
tarafından
Lars Gustäbel
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Improvements to doco strings.
Tiny bug fix to expatreader.py (endDocument was only called after errors).
üst
33315b18
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
14 deletions
+27
-14
__init__.py
Lib/xml/sax/__init__.py
+1
-3
expatreader.py
Lib/xml/sax/expatreader.py
+7
-4
handler.py
Lib/xml/sax/handler.py
+8
-7
xmlreader.py
Lib/xml/sax/xmlreader.py
+11
-0
No files found.
Lib/xml/sax/__init__.py
Dosyayı görüntüle @
bb757136
...
@@ -16,9 +16,7 @@ saxutils -- Implementation of the convenience classes commonly used to
...
@@ -16,9 +16,7 @@ saxutils -- Implementation of the convenience classes commonly used to
xmlreader -- Base classes and constants which define the SAX 2 API for
xmlreader -- Base classes and constants which define the SAX 2 API for
the parsers used with SAX for Python.
the parsers used with SAX for Python.
expatreader -- Driver that allows use of the Expat parser with the
expatreader -- Driver that allows use of the Expat parser with SAX.
classes defined in saxlib.
"""
"""
from
xmlreader
import
InputSource
from
xmlreader
import
InputSource
...
...
Lib/xml/sax/expatreader.py
Dosyayı görüntüle @
bb757136
"""
"""
SAX driver for the Pyexpat C module. This driver works with
SAX driver for the Pyexpat C module. This driver works with
pyexpat.__version__ == '
1.5
'.
pyexpat.__version__ == '
2.22
'.
"""
"""
version
=
"0.20"
version
=
"0.20"
...
@@ -28,7 +28,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
...
@@ -28,7 +28,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
# XMLReader methods
# XMLReader methods
def
parse
(
self
,
source
):
def
parse
(
self
,
source
):
"Parse an XML document from a URL."
"Parse an XML document from a URL
or an InputSource
."
source
=
saxutils
.
prepare_input_source
(
source
)
source
=
saxutils
.
prepare_input_source
(
source
)
self
.
_source
=
source
self
.
_source
=
source
...
@@ -40,7 +40,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
...
@@ -40,7 +40,7 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
error_code
=
self
.
_parser
.
ErrorCode
error_code
=
self
.
_parser
.
ErrorCode
raise
SAXParseException
(
expat
.
ErrorString
(
error_code
),
None
,
self
)
raise
SAXParseException
(
expat
.
ErrorString
(
error_code
),
None
,
self
)
self
.
_cont_handler
.
endDocument
()
self
.
_cont_handler
.
endDocument
()
def
prepareParser
(
self
,
source
):
def
prepareParser
(
self
,
source
):
if
source
.
getSystemId
()
!=
None
:
if
source
.
getSystemId
()
!=
None
:
...
@@ -108,7 +108,10 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
...
@@ -108,7 +108,10 @@ class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator):
# self._parser.DefaultHandlerExpand =
# self._parser.DefaultHandlerExpand =
# self._parser.NotStandaloneHandler =
# self._parser.NotStandaloneHandler =
self
.
_parser
.
ExternalEntityRefHandler
=
self
.
external_entity_ref
self
.
_parser
.
ExternalEntityRefHandler
=
self
.
external_entity_ref
self
.
_parsing
=
0
self
.
_entity_stack
=
[]
# Locator methods
# Locator methods
def
getColumnNumber
(
self
):
def
getColumnNumber
(
self
):
...
...
Lib/xml/sax/handler.py
Dosyayı görüntüle @
bb757136
...
@@ -20,13 +20,14 @@ version = '2.0beta'
...
@@ -20,13 +20,14 @@ version = '2.0beta'
# ===== ERRORHANDLER =====
# ===== ERRORHANDLER =====
class
ErrorHandler
:
class
ErrorHandler
:
"""Basic interface for SAX error handlers. If you create an object
"""Basic interface for SAX error handlers.
that implements this interface, then register the object with your
Parser, the parser will call the methods in your object to report
If you create an object that implements this interface, then
all warnings and errors. There are three levels of errors
register the object with your XMLReader, the parser will call the
available: warnings, (possibly) recoverable errors, and
methods in your object to report all warnings and errors. There
unrecoverable errors. All methods take a SAXParseException as the
are three levels of errors available: warnings, (possibly)
only parameter."""
recoverable errors, and unrecoverable errors. All methods take a
SAXParseException as the only parameter."""
def
error
(
self
,
exception
):
def
error
(
self
,
exception
):
"Handle a recoverable error."
"Handle a recoverable error."
...
...
Lib/xml/sax/xmlreader.py
Dosyayı görüntüle @
bb757136
...
@@ -6,6 +6,17 @@ import handler
...
@@ -6,6 +6,17 @@ import handler
# ===== XMLREADER =====
# ===== XMLREADER =====
class
XMLReader
:
class
XMLReader
:
"""Interface for reading an XML document using callbacks.
XMLReader is the interface that an XML parser's SAX2 driver must
implement. This interface allows an application to set and query
features and properties in the parser, to register event handlers
for document processing, and to initiate a document parse.
All SAX interfaces are assumed to be synchronous: the parse
methods must not return until parsing is complete, and readers
must wait for an event-handler callback to return before reporting
the next event."""
def
__init__
(
self
):
def
__init__
(
self
):
self
.
_cont_handler
=
handler
.
ContentHandler
()
self
.
_cont_handler
=
handler
.
ContentHandler
()
...
...
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