8526 lines · 313.2 KB · Python
RawDownload
## Functions from module HTMLparser# def htmlCreateMemoryParserCtxt(buffer, size):    """Create a parser context for an HTML in-memory document. """    ret = libxml2mod.htmlCreateMemoryParserCtxt(buffer, size)    if ret is None:raise parserError('htmlCreateMemoryParserCtxt() failed')    return parserCtxt(_obj=ret) def htmlHandleOmittedElem(val):    """Set and return the previous value for handling HTML omitted       tags. """    ret = libxml2mod.htmlHandleOmittedElem(val)    return ret def htmlIsScriptAttribute(name):    """Check if an attribute is of content type Script """    ret = libxml2mod.htmlIsScriptAttribute(name)    return ret def htmlNewParserCtxt():    """Allocate and initialize a new parser context. """    ret = libxml2mod.htmlNewParserCtxt()    if ret is None:raise parserError('htmlNewParserCtxt() failed')    return parserCtxt(_obj=ret) def htmlParseDoc(cur, encoding):    """parse an HTML in-memory document and build a tree. """    ret = libxml2mod.htmlParseDoc(cur, encoding)    if ret is None:raise parserError('htmlParseDoc() failed')    return xmlDoc(_obj=ret) def htmlParseFile(filename, encoding):    """parse an HTML file and build a tree. Automatic support for      ZLIB/Compress compressed document is provided by default if       found at compile-time. """    ret = libxml2mod.htmlParseFile(filename, encoding)    if ret is None:raise parserError('htmlParseFile() failed')    return xmlDoc(_obj=ret) def htmlReadDoc(cur, URL, encoding, options):    """parse an XML in-memory document and build a tree. """    ret = libxml2mod.htmlReadDoc(cur, URL, encoding, options)    if ret is None:raise treeError('htmlReadDoc() failed')    return xmlDoc(_obj=ret) def htmlReadFd(fd, URL, encoding, options):    """parse an XML from a file descriptor and build a tree. """    ret = libxml2mod.htmlReadFd(fd, URL, encoding, options)    if ret is None:raise treeError('htmlReadFd() failed')    return xmlDoc(_obj=ret) def htmlReadFile(filename, encoding, options):    """parse an XML file from the filesystem or the network. """    ret = libxml2mod.htmlReadFile(filename, encoding, options)    if ret is None:raise treeError('htmlReadFile() failed')    return xmlDoc(_obj=ret) def htmlReadMemory(buffer, size, URL, encoding, options):    """parse an XML in-memory document and build a tree. """    ret = libxml2mod.htmlReadMemory(buffer, size, URL, encoding, options)    if ret is None:raise treeError('htmlReadMemory() failed')    return xmlDoc(_obj=ret) ## Functions from module HTMLtree# def htmlIsBooleanAttr(name):    """Determine if a given attribute is a boolean attribute. """    ret = libxml2mod.htmlIsBooleanAttr(name)    return ret def htmlNewDoc(URI, ExternalID):    """Creates a new HTML document """    ret = libxml2mod.htmlNewDoc(URI, ExternalID)    if ret is None:raise treeError('htmlNewDoc() failed')    return xmlDoc(_obj=ret) def htmlNewDocNoDtD(URI, ExternalID):    """Creates a new HTML document without a DTD node if @URI and       @ExternalID are None """    ret = libxml2mod.htmlNewDocNoDtD(URI, ExternalID)    if ret is None:raise treeError('htmlNewDocNoDtD() failed')    return xmlDoc(_obj=ret) ## Functions from module SAX2# def SAXDefaultVersion(version):    """Set the default version of SAX used globally by the      library. By default, during initialization the default is      set to 2. Note that it is generally a better coding style      to use xmlSAXVersion() to set up the version explicitly for       a given parsing context. """    ret = libxml2mod.xmlSAXDefaultVersion(version)    return ret def defaultSAXHandlerInit():    """Initialize the default SAX2 handler """    libxml2mod.xmlDefaultSAXHandlerInit() def docbDefaultSAXHandlerInit():    """Initialize the default SAX handler """    libxml2mod.docbDefaultSAXHandlerInit() def htmlDefaultSAXHandlerInit():    """Initialize the default SAX handler """    libxml2mod.htmlDefaultSAXHandlerInit() ## Functions from module catalog# def catalogAdd(type, orig, replace):    """Add an entry in the catalog, it may overwrite existing but      different entries. If called before any other catalog      routine, allows to override the default shared catalog put       in place by xmlInitializeCatalog(); """    ret = libxml2mod.xmlCatalogAdd(type, orig, replace)    return ret def catalogCleanup():    """Free up all the memory associated with catalogs """    libxml2mod.xmlCatalogCleanup() def catalogConvert():    """Convert all the SGML catalog entries as XML ones """    ret = libxml2mod.xmlCatalogConvert()    return ret def catalogDump(out):    """Dump all the global catalog content to the given file. """    libxml2mod.xmlCatalogDump(out) def catalogGetPublic(pubID):    """Try to lookup the catalog reference associated to a public       ID DEPRECATED, use xmlCatalogResolvePublic() """    ret = libxml2mod.xmlCatalogGetPublic(pubID)    return ret def catalogGetSystem(sysID):    """Try to lookup the catalog reference associated to a system       ID DEPRECATED, use xmlCatalogResolveSystem() """    ret = libxml2mod.xmlCatalogGetSystem(sysID)    return ret def catalogRemove(value):    """Remove an entry from the catalog """    ret = libxml2mod.xmlCatalogRemove(value)    return ret def catalogResolve(pubID, sysID):    """Do a complete resolution lookup of an External Identifier """    ret = libxml2mod.xmlCatalogResolve(pubID, sysID)    return ret def catalogResolvePublic(pubID):    """Try to lookup the catalog reference associated to a public       ID """    ret = libxml2mod.xmlCatalogResolvePublic(pubID)    return ret def catalogResolveSystem(sysID):    """Try to lookup the catalog resource for a system ID """    ret = libxml2mod.xmlCatalogResolveSystem(sysID)    return ret def catalogResolveURI(URI):    """Do a complete resolution lookup of an URI """    ret = libxml2mod.xmlCatalogResolveURI(URI)    return ret def catalogSetDebug(level):    """Used to set the debug level for catalog operation, 0       disable debugging, 1 enable it """    ret = libxml2mod.xmlCatalogSetDebug(level)    return ret def initializeCatalog():    """Do the catalog initialization. this function is not thread      safe, catalog initialization should preferably be done once       at startup """    libxml2mod.xmlInitializeCatalog() def loadACatalog(filename):    """Load the catalog and build the associated data structures.      This can be either an XML Catalog or an SGML Catalog It      will recurse in SGML CATALOG entries. On the other hand XML       Catalogs are not handled recursively. """    ret = libxml2mod.xmlLoadACatalog(filename)    if ret is None:raise treeError('xmlLoadACatalog() failed')    return catalog(_obj=ret) def loadCatalog(filename):    """Load the catalog and makes its definitions effective for      the default external entity loader. It will recurse in SGML      CATALOG entries. this function is not thread safe, catalog       initialization should preferably be done once at startup """    ret = libxml2mod.xmlLoadCatalog(filename)    return ret def loadCatalogs(pathss):    """Load the catalogs and makes their definitions effective for      the default external entity loader. this function is not      thread safe, catalog initialization should preferably be       done once at startup """    libxml2mod.xmlLoadCatalogs(pathss) def loadSGMLSuperCatalog(filename):    """Load an SGML super catalog. It won't expand CATALOG or      DELEGATE references. This is only needed for manipulating      SGML Super Catalogs like adding and removing CATALOG or       DELEGATE entries. """    ret = libxml2mod.xmlLoadSGMLSuperCatalog(filename)    if ret is None:raise treeError('xmlLoadSGMLSuperCatalog() failed')    return catalog(_obj=ret) def newCatalog(sgml):    """create a new Catalog. """    ret = libxml2mod.xmlNewCatalog(sgml)    if ret is None:raise treeError('xmlNewCatalog() failed')    return catalog(_obj=ret) def parseCatalogFile(filename):    """parse an XML file and build a tree. It's like       xmlParseFile() except it bypass all catalog lookups. """    ret = libxml2mod.xmlParseCatalogFile(filename)    if ret is None:raise parserError('xmlParseCatalogFile() failed')    return xmlDoc(_obj=ret) ## Functions from module chvalid# def isBaseChar(ch):    """This function is DEPRECATED. Use xmlIsBaseChar_ch or       xmlIsBaseCharQ instead """    ret = libxml2mod.xmlIsBaseChar(ch)    return ret def isBlank(ch):    """This function is DEPRECATED. Use xmlIsBlank_ch or       xmlIsBlankQ instead """    ret = libxml2mod.xmlIsBlank(ch)    return ret def isChar(ch):    """This function is DEPRECATED. Use xmlIsChar_ch or xmlIsCharQ       instead """    ret = libxml2mod.xmlIsChar(ch)    return ret def isCombining(ch):    """This function is DEPRECATED. Use xmlIsCombiningQ instead """    ret = libxml2mod.xmlIsCombining(ch)    return ret def isDigit(ch):    """This function is DEPRECATED. Use xmlIsDigit_ch or       xmlIsDigitQ instead """    ret = libxml2mod.xmlIsDigit(ch)    return ret def isExtender(ch):    """This function is DEPRECATED. Use xmlIsExtender_ch or       xmlIsExtenderQ instead """    ret = libxml2mod.xmlIsExtender(ch)    return ret def isIdeographic(ch):    """This function is DEPRECATED. Use xmlIsIdeographicQ instead """    ret = libxml2mod.xmlIsIdeographic(ch)    return ret def isPubidChar(ch):    """This function is DEPRECATED. Use xmlIsPubidChar_ch or       xmlIsPubidCharQ instead """    ret = libxml2mod.xmlIsPubidChar(ch)    return ret ## Functions from module debugXML# def boolToText(boolval):    """Convenient way to turn bool into text """    ret = libxml2mod.xmlBoolToText(boolval)    return ret def debugDumpString(output, str):    """Dumps informations about the string, shorten it if necessary """    libxml2mod.xmlDebugDumpString(output, str) def shellPrintXPathError(errorType, arg):    """Print the xpath error to libxml default error channel """    libxml2mod.xmlShellPrintXPathError(errorType, arg) ## Functions from module dict# def dictCleanup():    """Free the dictionary mutex. Do not call unless sure the       library is not in use anymore ! """    libxml2mod.xmlDictCleanup() def initializeDict():    """Do the dictionary mutex initialization. this function is      not thread safe, initialization should preferably be done       once at startup """    ret = libxml2mod.xmlInitializeDict()    return ret ## Functions from module encoding# def addEncodingAlias(name, alias):    """Registers an alias @alias for an encoding named @name.       Existing alias will be overwritten. """    ret = libxml2mod.xmlAddEncodingAlias(name, alias)    return ret def cleanupCharEncodingHandlers():    """Cleanup the memory allocated for the char encoding support,       it unregisters all the encoding handlers and the aliases. """    libxml2mod.xmlCleanupCharEncodingHandlers() def cleanupEncodingAliases():    """Unregisters all aliases """    libxml2mod.xmlCleanupEncodingAliases() def delEncodingAlias(alias):    """Unregisters an encoding alias @alias """    ret = libxml2mod.xmlDelEncodingAlias(alias)    return ret def encodingAlias(alias):    """Lookup an encoding name for the given alias. """    ret = libxml2mod.xmlGetEncodingAlias(alias)    return ret def initCharEncodingHandlers():    """Initialize the char encoding support, it registers the      default encoding supported. NOTE: while public, this      function usually doesn't need to be called in normal       processing. """    libxml2mod.xmlInitCharEncodingHandlers() ## Functions from module entities# def cleanupPredefinedEntities():    """Cleanup up the predefined entities table. Deprecated call """    libxml2mod.xmlCleanupPredefinedEntities() def initializePredefinedEntities():    """Set up the predefined entities. Deprecated call """    libxml2mod.xmlInitializePredefinedEntities() def predefinedEntity(name):    """Check whether this name is an predefined entity. """    ret = libxml2mod.xmlGetPredefinedEntity(name)    if ret is None:raise treeError('xmlGetPredefinedEntity() failed')    return xmlEntity(_obj=ret) ## Functions from module globals# def cleanupGlobals():    """Additional cleanup for multi-threading """    libxml2mod.xmlCleanupGlobals() def initGlobals():    """Additional initialisation for multi-threading """    libxml2mod.xmlInitGlobals() def thrDefDefaultBufferSize(v):    ret = libxml2mod.xmlThrDefDefaultBufferSize(v)    return ret def thrDefDoValidityCheckingDefaultValue(v):    ret = libxml2mod.xmlThrDefDoValidityCheckingDefaultValue(v)    return ret def thrDefGetWarningsDefaultValue(v):    ret = libxml2mod.xmlThrDefGetWarningsDefaultValue(v)    return ret def thrDefIndentTreeOutput(v):    ret = libxml2mod.xmlThrDefIndentTreeOutput(v)    return ret def thrDefKeepBlanksDefaultValue(v):    ret = libxml2mod.xmlThrDefKeepBlanksDefaultValue(v)    return ret def thrDefLineNumbersDefaultValue(v):    ret = libxml2mod.xmlThrDefLineNumbersDefaultValue(v)    return ret def thrDefLoadExtDtdDefaultValue(v):    ret = libxml2mod.xmlThrDefLoadExtDtdDefaultValue(v)    return ret def thrDefParserDebugEntities(v):    ret = libxml2mod.xmlThrDefParserDebugEntities(v)    return ret def thrDefPedanticParserDefaultValue(v):    ret = libxml2mod.xmlThrDefPedanticParserDefaultValue(v)    return ret def thrDefSaveNoEmptyTags(v):    ret = libxml2mod.xmlThrDefSaveNoEmptyTags(v)    return ret def thrDefSubstituteEntitiesDefaultValue(v):    ret = libxml2mod.xmlThrDefSubstituteEntitiesDefaultValue(v)    return ret def thrDefTreeIndentString(v):    ret = libxml2mod.xmlThrDefTreeIndentString(v)    return ret ## Functions from module nanoftp# def nanoFTPCleanup():    """Cleanup the FTP protocol layer. This cleanup proxy       informations. """    libxml2mod.xmlNanoFTPCleanup() def nanoFTPInit():    """Initialize the FTP protocol layer. Currently it just checks       for proxy informations, and get the hostname """    libxml2mod.xmlNanoFTPInit() def nanoFTPProxy(host, port, user, passwd, type):    """Setup the FTP proxy informations. This can also be done by      using ftp_proxy ftp_proxy_user and ftp_proxy_password       environment variables. """    libxml2mod.xmlNanoFTPProxy(host, port, user, passwd, type) def nanoFTPScanProxy(URL):    """(Re)Initialize the FTP Proxy context by parsing the URL and      finding the protocol host port it indicates. Should be like      ftp://myproxy/ or ftp://myproxy:3128/ A None URL cleans up       proxy informations. """    libxml2mod.xmlNanoFTPScanProxy(URL) ## Functions from module nanohttp# def nanoHTTPCleanup():    """Cleanup the HTTP protocol layer. """    libxml2mod.xmlNanoHTTPCleanup() def nanoHTTPInit():    """Initialize the HTTP protocol layer. Currently it just       checks for proxy informations """    libxml2mod.xmlNanoHTTPInit() def nanoHTTPScanProxy(URL):    """(Re)Initialize the HTTP Proxy context by parsing the URL      and finding the protocol host port it indicates. Should be      like http://myproxy/ or http://myproxy:3128/ A None URL       cleans up proxy informations. """    libxml2mod.xmlNanoHTTPScanProxy(URL) ## Functions from module parser# def createDocParserCtxt(cur):    """Creates a parser context for an XML in-memory document. """    ret = libxml2mod.xmlCreateDocParserCtxt(cur)    if ret is None:raise parserError('xmlCreateDocParserCtxt() failed')    return parserCtxt(_obj=ret) def initParser():    """Initialization function for the XML parser. This is not      reentrant. Call once before processing in case of use in       multithreaded programs. """    libxml2mod.xmlInitParser() def keepBlanksDefault(val):    """Set and return the previous value for default blanks text      nodes support. The 1.x version of the parser used an      heuristic to try to detect ignorable white spaces. As a      result the SAX callback was generating      xmlSAX2IgnorableWhitespace() callbacks instead of      characters() one, and when using the DOM output text nodes

Lines 1–500 of 8526.

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t