Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
xml.dom.xmlbuilder.DOMEntityResolver Class Reference
Inheritance diagram for xml.dom.xmlbuilder.DOMEntityResolver:
Inheritance graph
[legend]
Collaboration diagram for xml.dom.xmlbuilder.DOMEntityResolver:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def resolveEntity

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Member Functions

def _get_opener
def _create_opener
def _guess_media_encoding

Private Attributes

 _opener

Static Private Attributes

string __slots__ = '_opener'

Detailed Description

Definition at line 212 of file xmlbuilder.py.


Member Function Documentation

Definition at line 244 of file xmlbuilder.py.

00244 
00245     def _create_opener(self):
00246         import urllib.request
00247         return urllib.request.build_opener()

Here is the call graph for this function:

Definition at line 237 of file xmlbuilder.py.

00237 
00238     def _get_opener(self):
00239         try:
00240             return self._opener
00241         except AttributeError:
00242             self._opener = self._create_opener()
00243             return self._opener

Here is the caller graph for this function:

def xml.dom.xmlbuilder.DOMEntityResolver._guess_media_encoding (   self,
  source 
) [private]

Definition at line 248 of file xmlbuilder.py.

00248 
00249     def _guess_media_encoding(self, source):
00250         info = source.byteStream.info()
00251         if "Content-Type" in info:
00252             for param in info.getplist():
00253                 if param.startswith("charset="):
00254                     return param.split("=", 1)[1].lower()
00255 

Here is the caller graph for this function:

def xml.dom.xmlbuilder.DOMEntityResolver.resolveEntity (   self,
  publicId,
  systemId 
)

Definition at line 215 of file xmlbuilder.py.

00215 
00216     def resolveEntity(self, publicId, systemId):
00217         assert systemId is not None
00218         source = DOMInputSource()
00219         source.publicId = publicId
00220         source.systemId = systemId
00221         source.byteStream = self._get_opener().open(systemId)
00222 
00223         # determine the encoding if the transport provided it
00224         source.encoding = self._guess_media_encoding(source)
00225 
00226         # determine the base URI is we can
00227         import posixpath, urllib.parse
00228         parts = urllib.parse.urlparse(systemId)
00229         scheme, netloc, path, params, query, fragment = parts
00230         # XXX should we check the scheme here as well?
00231         if path and not path.endswith("/"):
00232             path = posixpath.dirname(path) + "/"
00233             parts = scheme, netloc, path, params, query, fragment
00234             source.baseURI = urllib.parse.urlunparse(parts)
00235 
00236         return source

Here is the call graph for this function:


Member Data Documentation

Definition at line 213 of file xmlbuilder.py.

Definition at line 241 of file xmlbuilder.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


The documentation for this class was generated from the following file: