added Info.plist
[TestXSLT.git] / libxml2 / python / libxml2class.py
1 #
2 # Functions from module HTMLparser
3 #
4
5 def htmlHandleOmittedElem(val):
6     """Set and return the previous value for handling HTML omitted
7        tags. """
8     ret = libxml2mod.htmlHandleOmittedElem(val)
9     return ret
10
11 def htmlIsScriptAttribute(name):
12     """Check if an attribute is of content type Script """
13     ret = libxml2mod.htmlIsScriptAttribute(name)
14     return ret
15
16 def htmlParseDoc(cur, encoding):
17     """parse an HTML in-memory document and build a tree. """
18     ret = libxml2mod.htmlParseDoc(cur, encoding)
19     if ret is None:raise parserError('htmlParseDoc() failed')
20     return xmlDoc(_obj=ret)
21
22 def htmlParseFile(filename, encoding):
23     """parse an HTML file and build a tree. Automatic support for
24        ZLIB/Compress compressed document is provided by default
25        if found at compile-time. """
26     ret = libxml2mod.htmlParseFile(filename, encoding)
27     if ret is None:raise parserError('htmlParseFile() failed')
28     return xmlDoc(_obj=ret)
29
30 #
31 # Functions from module HTMLtree
32 #
33
34 def htmlIsBooleanAttr(name):
35     """Determine if a given attribute is a boolean attribute. """
36     ret = libxml2mod.htmlIsBooleanAttr(name)
37     return ret
38
39 def htmlNewDoc(URI, ExternalID):
40     """Creates a new HTML document """
41     ret = libxml2mod.htmlNewDoc(URI, ExternalID)
42     if ret is None:raise treeError('htmlNewDoc() failed')
43     return xmlDoc(_obj=ret)
44
45 def htmlNewDocNoDtD(URI, ExternalID):
46     """Creates a new HTML document without a DTD node if @URI and
47        @ExternalID are None """
48     ret = libxml2mod.htmlNewDocNoDtD(URI, ExternalID)
49     if ret is None:raise treeError('htmlNewDocNoDtD() failed')
50     return xmlDoc(_obj=ret)
51
52 #
53 # Functions from module catalog
54 #
55
56 def catalogAdd(type, orig, replace):
57     """Add an entry in the catalog, it may overwrite existing but
58        different entries. If called before any other catalog
59        routine, allows to override the default shared catalog put
60        in place by xmlInitializeCatalog(); """
61     ret = libxml2mod.xmlCatalogAdd(type, orig, replace)
62     return ret
63
64 def catalogCleanup():
65     """Free up all the memory associated with catalogs """
66     libxml2mod.xmlCatalogCleanup()
67
68 def catalogConvert():
69     """Convert all the SGML catalog entries as XML ones """
70     ret = libxml2mod.xmlCatalogConvert()
71     return ret
72
73 def catalogDump(out):
74     """Free up all the memory associated with catalogs """
75     libxml2mod.xmlCatalogDump(out)
76
77 def catalogGetPublic(pubID):
78     """Try to lookup the system ID associated to a public ID
79        DEPRECATED, use xmlCatalogResolvePublic() """
80     ret = libxml2mod.xmlCatalogGetPublic(pubID)
81     return ret
82
83 def catalogGetSystem(sysID):
84     """Try to lookup the system ID associated to a public ID
85        DEPRECATED, use xmlCatalogResolveSystem() """
86     ret = libxml2mod.xmlCatalogGetSystem(sysID)
87     return ret
88
89 def catalogRemove(value):
90     """Remove an entry from the catalog """
91     ret = libxml2mod.xmlCatalogRemove(value)
92     return ret
93
94 def catalogResolve(pubID, sysID):
95     """Do a complete resolution lookup of an External Identifier """
96     ret = libxml2mod.xmlCatalogResolve(pubID, sysID)
97     return ret
98
99 def catalogResolvePublic(pubID):
100     """Try to lookup the system ID associated to a public ID """
101     ret = libxml2mod.xmlCatalogResolvePublic(pubID)
102     return ret
103
104 def catalogResolveSystem(sysID):
105     """Try to lookup the catalog resource for a system ID """
106     ret = libxml2mod.xmlCatalogResolveSystem(sysID)
107     return ret
108
109 def catalogResolveURI(URI):
110     """Do a complete resolution lookup of an URI """
111     ret = libxml2mod.xmlCatalogResolveURI(URI)
112     return ret
113
114 def catalogSetDebug(level):
115     """Used to set the debug level for catalog operation, 0
116        disable debugging, 1 enable it """
117     ret = libxml2mod.xmlCatalogSetDebug(level)
118     return ret
119
120 def initializeCatalog():
121     """Do the catalog initialization. this function is not thread
122        safe, catalog initialization should preferably be done
123        once at startup """
124     libxml2mod.xmlInitializeCatalog()
125
126 def loadACatalog(filename):
127     """Load the catalog and build the associated data structures.
128        This can be either an XML Catalog or an SGML Catalog It
129        will recurse in SGML CATALOG entries. On the other hand
130        XML Catalogs are not handled recursively. """
131     ret = libxml2mod.xmlLoadACatalog(filename)
132     if ret is None:raise treeError('xmlLoadACatalog() failed')
133     return catalog(_obj=ret)
134
135 def loadCatalog(filename):
136     """Load the catalog and makes its definitions effective for
137        the default external entity loader. It will recurse in
138        SGML CATALOG entries. this function is not thread safe,
139        catalog initialization should preferably be done once at
140        startup """
141     ret = libxml2mod.xmlLoadCatalog(filename)
142     return ret
143
144 def loadCatalogs(pathss):
145     """Load the catalogs and makes their definitions effective for
146        the default external entity loader. this function is not
147        thread safe, catalog initialization should preferably be
148        done once at startup """
149     libxml2mod.xmlLoadCatalogs(pathss)
150
151 def loadSGMLSuperCatalog(filename):
152     """Load an SGML super catalog. It won't expand CATALOG or
153        DELEGATE references. This is only needed for manipulating
154        SGML Super Catalogs like adding and removing CATALOG or
155        DELEGATE entries. """
156     ret = libxml2mod.xmlLoadSGMLSuperCatalog(filename)
157     if ret is None:raise treeError('xmlLoadSGMLSuperCatalog() failed')
158     return catalog(_obj=ret)
159
160 def newCatalog(sgml):
161     """create a new Catalog. """
162     ret = libxml2mod.xmlNewCatalog(sgml)
163     if ret is None:raise treeError('xmlNewCatalog() failed')
164     return catalog(_obj=ret)
165
166 def parseCatalogFile(filename):
167     """parse an XML file and build a tree. It's like
168        xmlParseFile() except it bypass all catalog lookups. """
169     ret = libxml2mod.xmlParseCatalogFile(filename)
170     if ret is None:raise parserError('xmlParseCatalogFile() failed')
171     return xmlDoc(_obj=ret)
172
173 #
174 # Functions from module debugXML
175 #
176
177 def boolToText(boolval):
178     """Convenient way to turn bool into text """
179     ret = libxml2mod.xmlBoolToText(boolval)
180     return ret
181
182 def debugDumpString(output, str):
183     """Dumps informations about the string, shorten it if necessary """
184     libxml2mod.xmlDebugDumpString(output, str)
185
186 def shellPrintXPathError(errorType, arg):
187     """Print the xpath error to libxml default error channel """
188     libxml2mod.xmlShellPrintXPathError(errorType, arg)
189
190 #
191 # Functions from module encoding
192 #
193
194 def UTF8Strlen(utf):
195     """compute the length of an UTF8 string, it doesn't do a full
196        UTF8 checking of the content of the string. """
197     ret = libxml2mod.xmlUTF8Strlen(utf)
198     return ret
199
200 def UTF8Strloc(utf, utfchar):
201     """a function to provide relative location of a UTF8 char """
202     ret = libxml2mod.xmlUTF8Strloc(utf, utfchar)
203     return ret
204
205 def UTF8Strndup(utf, len):
206     """a strndup for array of UTF8's """
207     ret = libxml2mod.xmlUTF8Strndup(utf, len)
208     return ret
209
210 def UTF8Strpos(utf, pos):
211     """a function to provide the equivalent of fetching a
212        character from a string array """
213     ret = libxml2mod.xmlUTF8Strpos(utf, pos)
214     return ret
215
216 def UTF8Strsize(utf, len):
217     """storage size of an UTF8 string """
218     ret = libxml2mod.xmlUTF8Strsize(utf, len)
219     return ret
220
221 def UTF8Strsub(utf, start, len):
222     """Note:  positions are given in units of UTF-8 chars """
223     ret = libxml2mod.xmlUTF8Strsub(utf, start, len)
224     return ret
225
226 def addEncodingAlias(name, alias):
227     """Registers and alias @alias for an encoding named @name.
228        Existing alias will be overwritten. """
229     ret = libxml2mod.xmlAddEncodingAlias(name, alias)
230     return ret
231
232 def checkUTF8(utf):
233     """Checks @utf for being valid utf-8. @utf is assumed to be
234        null-terminated. This function is not super-strict, as it
235        will allow longer utf-8 sequences than necessary. Note
236        that Java is capable of producing these sequences if
237        provoked. Also note, this routine checks for the 4-byte
238        maximum size, but does not check for 0x10ffff maximum
239        value. """
240     ret = libxml2mod.xmlCheckUTF8(utf)
241     return ret
242
243 def cleanupCharEncodingHandlers():
244     """Cleanup the memory allocated for the char encoding support,
245        it unregisters all the encoding handlers and the aliases. """
246     libxml2mod.xmlCleanupCharEncodingHandlers()
247
248 def cleanupEncodingAliases():
249     """Unregisters all aliases """
250     libxml2mod.xmlCleanupEncodingAliases()
251
252 def delEncodingAlias(alias):
253     """Unregisters an encoding alias @alias """
254     ret = libxml2mod.xmlDelEncodingAlias(alias)
255     return ret
256
257 def encodingAlias(alias):
258     """Lookup an encoding name for the given alias. """
259     ret = libxml2mod.xmlGetEncodingAlias(alias)
260     return ret
261
262 def initCharEncodingHandlers():
263     """Initialize the char encoding support, it registers the
264        default encoding supported. NOTE: while public, this
265        function usually doesn't need to be called in normal
266        processing. """
267     libxml2mod.xmlInitCharEncodingHandlers()
268
269 #
270 # Functions from module entities
271 #
272
273 def cleanupPredefinedEntities():
274     """Cleanup up the predefined entities table. """
275     libxml2mod.xmlCleanupPredefinedEntities()
276
277 def initializePredefinedEntities():
278     """Set up the predefined entities. """
279     libxml2mod.xmlInitializePredefinedEntities()
280
281 def predefinedEntity(name):
282     """Check whether this name is an predefined entity. """
283     ret = libxml2mod.xmlGetPredefinedEntity(name)
284     if ret is None:raise treeError('xmlGetPredefinedEntity() failed')
285     return xmlEntity(_obj=ret)
286
287 #
288 # Functions from module nanoftp
289 #
290
291 def nanoFTPCleanup():
292     """Cleanup the FTP protocol layer. This cleanup proxy
293        informations. """
294     libxml2mod.xmlNanoFTPCleanup()
295
296 def nanoFTPInit():
297     """Initialize the FTP protocol layer. Currently it just checks
298        for proxy informations, and get the hostname """
299     libxml2mod.xmlNanoFTPInit()
300
301 def nanoFTPProxy(host, port, user, passwd, type):
302     """Setup the FTP proxy informations. This can also be done by
303        using ftp_proxy ftp_proxy_user and ftp_proxy_password
304        environment variables. """
305     libxml2mod.xmlNanoFTPProxy(host, port, user, passwd, type)
306
307 def nanoFTPScanProxy(URL):
308     """(Re)Initialize the FTP Proxy context by parsing the URL and
309        finding the protocol host port it indicates. Should be
310        like ftp://myproxy/ or ftp://myproxy:3128/ A None URL
311        cleans up proxy informations. """
312     libxml2mod.xmlNanoFTPScanProxy(URL)
313
314 #
315 # Functions from module nanohttp
316 #
317
318 def nanoHTTPCleanup():
319     """Cleanup the HTTP protocol layer. """
320     libxml2mod.xmlNanoHTTPCleanup()
321
322 def nanoHTTPInit():
323     """Initialize the HTTP protocol layer. Currently it just
324        checks for proxy informations """
325     libxml2mod.xmlNanoHTTPInit()
326
327 def nanoHTTPScanProxy(URL):
328     """(Re)Initialize the HTTP Proxy context by parsing the URL
329        and finding the protocol host port it indicates. Should be
330        like http://myproxy/ or http://myproxy:3128/ A None URL
331        cleans up proxy informations. """
332     libxml2mod.xmlNanoHTTPScanProxy(URL)
333
334 #
335 # Functions from module parser
336 #
337
338 def cleanupParser():
339     """Cleanup function for the XML parser. It tries to reclaim
340        all parsing related global memory allocated for the parser
341        processing. It doesn't deallocate any document related
342        memory. Calling this function should not prevent reusing
343        the parser. One should call xmlCleanupParser() only when
344        the process has finished using the library or XML document
345        built with it. """
346     libxml2mod.xmlCleanupParser()
347
348 def createDocParserCtxt(cur):
349     """Creates a parser context for an XML in-memory document. """
350     ret = libxml2mod.xmlCreateDocParserCtxt(cur)
351     if ret is None:raise parserError('xmlCreateDocParserCtxt() failed')
352     return parserCtxt(_obj=ret)
353
354 def initParser():
355     """Initialization function for the XML parser. This is not
356        reentrant. Call once before processing in case of use in
357        multithreaded programs. """
358     libxml2mod.xmlInitParser()
359
360 def keepBlanksDefault(val):
361     """Set and return the previous value for default blanks text
362        nodes support. The 1.x version of the parser used an
363        heuristic to try to detect ignorable white spaces. As a
364        result the SAX callback was generating
365        ignorableWhitespace() callbacks instead of characters()
366        one, and when using the DOM output text nodes containing
367        those blanks were not generated. The 2.x and later version
368        will switch to the XML standard way and
369        ignorableWhitespace() are only generated when running the
370        parser in validating mode and when the current element
371        doesn't allow CDATA or mixed content. This function is
372        provided as a way to force the standard behavior on 1.X
373        libs and to switch back to the old mode for compatibility
374        when running 1.X client code on 2.X . Upgrade of 1.X code
375        should be done by using xmlIsBlankNode() commodity
376        function to detect the "empty" nodes generated. This value
377        also affect autogeneration of indentation when saving code
378        if blanks sections are kept, indentation is not generated. """
379     ret = libxml2mod.xmlKeepBlanksDefault(val)
380     return ret
381
382 def lineNumbersDefault(val):
383     """Set and return the previous value for enabling line numbers
384        in elements contents. This may break on old application
385        and is turned off by default. """
386     ret = libxml2mod.xmlLineNumbersDefault(val)
387     return ret
388
389 def parseDTD(ExternalID, SystemID):
390     """Load and parse an external subset. """
391     ret = libxml2mod.xmlParseDTD(ExternalID, SystemID)
392     if ret is None:raise parserError('xmlParseDTD() failed')
393     return xmlDtd(_obj=ret)
394
395 def parseDoc(cur):
396     """parse an XML in-memory document and build a tree. """
397     ret = libxml2mod.xmlParseDoc(cur)
398     if ret is None:raise parserError('xmlParseDoc() failed')
399     return xmlDoc(_obj=ret)
400
401 def parseEntity(filename):
402     """parse an XML external entity out of context and build a
403        tree.  [78] extParsedEnt ::= TextDecl? content  This
404        correspond to a "Well Balanced" chunk """
405     ret = libxml2mod.xmlParseEntity(filename)
406     if ret is None:raise parserError('xmlParseEntity() failed')
407     return xmlDoc(_obj=ret)
408
409 def parseFile(filename):
410     """parse an XML file and build a tree. Automatic support for
411        ZLIB/Compress compressed document is provided by default
412        if found at compile-time. """
413     ret = libxml2mod.xmlParseFile(filename)
414     if ret is None:raise parserError('xmlParseFile() failed')
415     return xmlDoc(_obj=ret)
416
417 def parseMemory(buffer, size):
418     """parse an XML in-memory block and build a tree. """
419     ret = libxml2mod.xmlParseMemory(buffer, size)
420     if ret is None:raise parserError('xmlParseMemory() failed')
421     return xmlDoc(_obj=ret)
422
423 def pedanticParserDefault(val):
424     """Set and return the previous value for enabling pedantic
425        warnings. """
426     ret = libxml2mod.xmlPedanticParserDefault(val)
427     return ret
428
429 def recoverDoc(cur):
430     """parse an XML in-memory document and build a tree. In the
431        case the document is not Well Formed, a tree is built
432        anyway """
433     ret = libxml2mod.xmlRecoverDoc(cur)
434     if ret is None:raise treeError('xmlRecoverDoc() failed')
435     return xmlDoc(_obj=ret)
436
437 def recoverFile(filename):
438     """parse an XML file and build a tree. Automatic support for
439        ZLIB/Compress compressed document is provided by default
440        if found at compile-time. In the case the document is not
441        Well Formed, a tree is built anyway """
442     ret = libxml2mod.xmlRecoverFile(filename)
443     if ret is None:raise treeError('xmlRecoverFile() failed')
444     return xmlDoc(_obj=ret)
445
446 def recoverMemory(buffer, size):
447     """parse an XML in-memory block and build a tree. In the case
448        the document is not Well Formed, a tree is built anyway """
449     ret = libxml2mod.xmlRecoverMemory(buffer, size)
450     if ret is None:raise treeError('xmlRecoverMemory() failed')
451     return xmlDoc(_obj=ret)
452
453 def substituteEntitiesDefault(val):
454     """Set and return the previous value for default entity
455        support. Initially the parser always keep entity
456        references instead of substituting entity values in the
457        output. This function has to be used to change the default
458        parser behavior SAX::substituteEntities() has to be used
459        for changing that on a file by file basis. """
460     ret = libxml2mod.xmlSubstituteEntitiesDefault(val)
461     return ret
462
463 #
464 # Functions from module parserInternals
465 #
466
467 def checkLanguageID(lang):
468     """Checks that the value conforms to the LanguageID
469        production:  NOTE: this is somewhat deprecated, those
470        productions were removed from the XML Second edition. 
471        [33] LanguageID ::= Langcode ('-' Subcode)* [34] Langcode
472        ::= ISO639Code |  IanaCode |  UserCode [35] ISO639Code ::=
473        ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= ('i' |
474        'I') '-' ([a-z] | [A-Z])+ [37] UserCode ::= ('x' | 'X')
475        '-' ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+ """
476     ret = libxml2mod.xmlCheckLanguageID(lang)
477     return ret
478
479 def copyChar(len, out, val):
480     """append the char value in the array """
481     ret = libxml2mod.xmlCopyChar(len, out, val)
482     return ret
483
484 def copyCharMultiByte(out, val):
485     """append the char value in the array """
486     ret = libxml2mod.xmlCopyCharMultiByte(out, val)
487     return ret
488
489 def createEntityParserCtxt(URL, ID, base):
490     """Create a parser context for an external entity Automatic
491        support for ZLIB/Compress compressed document is provided
492        by default if found at compile-time. """
493     ret = libxml2mod.xmlCreateEntityParserCtxt(URL, ID, base)
494     if ret is None:raise parserError('xmlCreateEntityParserCtxt() failed')
495     return parserCtxt(_obj=ret)
496
497 def createFileParserCtxt(filename):
498     """Create a parser context for a file content. Automatic
499        support for ZLIB/Compress compressed document is provided
500        by default if found at compile-time. """
501     ret = libxml2mod.xmlCreateFileParserCtxt(filename)
502     if ret is None:raise parserError('xmlCreateFileParserCtxt() failed')
503     return parserCtxt(_obj=ret)
504
505 def createMemoryParserCtxt(buffer, size):
506     """Create a parser context for an XML in-memory document. """
507     ret = libxml2mod.xmlCreateMemoryParserCtxt(buffer, size)
508     if ret is None:raise parserError('xmlCreateMemoryParserCtxt() failed')
509     return parserCtxt(_obj=ret)
510
511 def htmlCreateFileParserCtxt(filename, encoding):
512     """Create a parser context for a file content. Automatic
513        support for ZLIB/Compress compressed document is provided
514        by default if found at compile-time. """
515     ret = libxml2mod.htmlCreateFileParserCtxt(filename, encoding)
516     if ret is None:raise parserError('htmlCreateFileParserCtxt() failed')
517     return parserCtxt(_obj=ret)
518
519 def htmlInitAutoClose():
520     """Initialize the htmlStartCloseIndex for fast lookup of
521        closing tags names. This is not reentrant. Call
522        xmlInitParser() once before processing in case of use in
523        multithreaded programs. """
524     libxml2mod.htmlInitAutoClose()
525
526 def isBaseChar(c):
527     """Check whether the character is allowed by the production
528        [85] BaseChar ::= ... long list see REC ...  VI is your
529        friend ! :1,$ s/\[#x\([0-9A-Z]*\)-#x\([0-9A-Z]*\)\]/    
530        (((c) >= 0x\1) \&\& ((c) <= 0x\2)) ||/ and :1,$
531        s/#x\([0-9A-Z]*\)/     ((c) == 0x\1) ||/ """
532     ret = libxml2mod.xmlIsBaseChar(c)
533     return ret
534
535 def isBlank(c):
536     """Check whether the character is allowed by the production
537        [3] S ::= (#x20 | #x9 | #xD | #xA)+ Also available as a
538        macro IS_BLANK() """
539     ret = libxml2mod.xmlIsBlank(c)
540     return ret
541
542 def isChar(c):
543     """Check whether the character is allowed by the production
544        [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] |
545        [#xE000-#xFFFD] | [#x10000-#x10FFFF] any Unicode
546        character, excluding the surrogate blocks, FFFE, and FFFF.
547        Also available as a macro IS_CHAR() """
548     ret = libxml2mod.xmlIsChar(c)
549     return ret
550
551 def isCombining(c):
552     """Check whether the character is allowed by the production
553        [87] CombiningChar ::= ... long list see REC ... """
554     ret = libxml2mod.xmlIsCombining(c)
555     return ret
556
557 def isDigit(c):
558     """Check whether the character is allowed by the production
559        [88] Digit ::= ... long list see REC ... """
560     ret = libxml2mod.xmlIsDigit(c)
561     return ret
562
563 def isExtender(c):
564     """Check whether the character is allowed by the production
565        [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 |
566        #x0640 | #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
567        [#x309D-#x309E] | [#x30FC-#x30FE] """
568     ret = libxml2mod.xmlIsExtender(c)
569     return ret
570
571 def isIdeographic(c):
572     """Check whether the character is allowed by the production
573        [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 |
574        [#x3021-#x3029] """
575     ret = libxml2mod.xmlIsIdeographic(c)
576     return ret
577
578 def isLetter(c):
579     """Check whether the character is allowed by the production
580        [84] Letter ::= BaseChar | Ideographic """
581     ret = libxml2mod.xmlIsLetter(c)
582     return ret
583
584 def isPubidChar(c):
585     """Check whether the character is allowed by the production
586        [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] |
587        [-'()+,./:=?;!*#@$_%] """
588     ret = libxml2mod.xmlIsPubidChar(c)
589     return ret
590
591 def namePop(ctxt):
592     """Pops the top element name from the name stack """
593     if ctxt is None: ctxt__o = None
594     else: ctxt__o = ctxt._o
595     ret = libxml2mod.namePop(ctxt__o)
596     return ret
597
598 def namePush(ctxt, value):
599     """Pushes a new element name on top of the name stack """
600     if ctxt is None: ctxt__o = None
601     else: ctxt__o = ctxt._o
602     ret = libxml2mod.namePush(ctxt__o, value)
603     return ret
604
605 def newParserCtxt():
606     """Allocate and initialize a new parser context. """
607     ret = libxml2mod.xmlNewParserCtxt()
608     if ret is None:raise parserError('xmlNewParserCtxt() failed')
609     return parserCtxt(_obj=ret)
610
611 def nodePop(ctxt):
612     """Pops the top element node from the node stack """
613     if ctxt is None: ctxt__o = None
614     else: ctxt__o = ctxt._o
615     ret = libxml2mod.nodePop(ctxt__o)
616     if ret is None:raise treeError('nodePop() failed')
617     return xmlNode(_obj=ret)
618
619 def nodePush(ctxt, value):
620     """Pushes a new element node on top of the node stack """
621     if ctxt is None: ctxt__o = None
622     else: ctxt__o = ctxt._o
623     if value is None: value__o = None
624     else: value__o = value._o
625     ret = libxml2mod.nodePush(ctxt__o, value__o)
626     return ret
627
628 #
629 # Functions from module python
630 #
631
632 def SAXParseFile(SAX, URI, recover):
633     """Interface to parse an XML file or resource pointed by an
634        URI to build an event flow to the SAX object """
635     libxml2mod.xmlSAXParseFile(SAX, URI, recover)
636
637 def createInputBuffer(file, encoding):
638     """Create a libxml2 input buffer from a Python file """
639     ret = libxml2mod.xmlCreateInputBuffer(file, encoding)
640     if ret is None:raise treeError('xmlCreateInputBuffer() failed')
641     return inputBuffer(_obj=ret)
642
643 def createOutputBuffer(file, encoding):
644     """Create a libxml2 output buffer from a Python file """
645     ret = libxml2mod.xmlCreateOutputBuffer(file, encoding)
646     if ret is None:raise treeError('xmlCreateOutputBuffer() failed')
647     return outputBuffer(_obj=ret)
648
649 def createPushParser(SAX, chunk, size, URI):
650     """Create a progressive XML parser context to build either an
651        event flow if the SAX object is not None, or a DOM tree
652        otherwise. """
653     ret = libxml2mod.xmlCreatePushParser(SAX, chunk, size, URI)
654     if ret is None:raise parserError('xmlCreatePushParser() failed')
655     return parserCtxt(_obj=ret)
656
657 def debugMemory(activate):
658     """Switch on the generation of line number for elements nodes.
659        Also returns the number of bytes allocated and not freed
660        by libxml2 since memory debugging was switched on. """
661     ret = libxml2mod.xmlDebugMemory(activate)
662     return ret
663
664 def dumpMemory():
665     """dump the memory allocated in the file .memdump """
666     libxml2mod.xmlDumpMemory()
667
668 def htmlCreatePushParser(SAX, chunk, size, URI):
669     """Create a progressive HTML parser context to build either an
670        event flow if the SAX object is not None, or a DOM tree
671        otherwise. """
672     ret = libxml2mod.htmlCreatePushParser(SAX, chunk, size, URI)
673     if ret is None:raise parserError('htmlCreatePushParser() failed')
674     return parserCtxt(_obj=ret)
675
676 def htmlSAXParseFile(SAX, URI, encoding):
677     """Interface to parse an HTML file or resource pointed by an
678        URI to build an event flow to the SAX object """
679     libxml2mod.htmlSAXParseFile(SAX, URI, encoding)
680
681 def newNode(name):
682     """Create a new Node """
683     ret = libxml2mod.xmlNewNode(name)
684     if ret is None:raise treeError('xmlNewNode() failed')
685     return xmlNode(_obj=ret)
686
687 def setEntityLoader(resolver):
688     """Set the entity resolver as a python function """
689     ret = libxml2mod.xmlSetEntityLoader(resolver)
690     return ret
691
692 #
693 # Functions from module relaxng
694 #
695
696 def relaxNGCleanupTypes():
697     """Cleanup the default Schemas type library associated to
698        RelaxNG """
699     libxml2mod.xmlRelaxNGCleanupTypes()
700
701 def relaxNGNewMemParserCtxt(buffer, size):
702     """Create an XML RelaxNGs parse context for that memory buffer
703        expected to contain an XML RelaxNGs file. """
704     ret = libxml2mod.xmlRelaxNGNewMemParserCtxt(buffer, size)
705     if ret is None:raise parserError('xmlRelaxNGNewMemParserCtxt() failed')
706     return relaxNgParserCtxt(_obj=ret)
707
708 def relaxNGNewParserCtxt(URL):
709     """Create an XML RelaxNGs parse context for that file/resource
710        expected to contain an XML RelaxNGs file. """
711     ret = libxml2mod.xmlRelaxNGNewParserCtxt(URL)
712     if ret is None:raise parserError('xmlRelaxNGNewParserCtxt() failed')
713     return relaxNgParserCtxt(_obj=ret)
714
715 #
716 # Functions from module tree
717 #
718
719 def compressMode():
720     """get the default compression mode used, ZLIB based. """
721     ret = libxml2mod.xmlGetCompressMode()
722     return ret
723
724 def isXHTML(systemID, publicID):
725     """Try to find if the document correspond to an XHTML DTD """
726     ret = libxml2mod.xmlIsXHTML(systemID, publicID)
727     return ret
728
729 def newComment(content):
730     """Creation of a new node containing a comment. """
731     ret = libxml2mod.xmlNewComment(content)
732     if ret is None:raise treeError('xmlNewComment() failed')
733     return xmlNode(_obj=ret)
734
735 def newDoc(version):
736     """Creates a new XML document """
737     ret = libxml2mod.xmlNewDoc(version)
738     if ret is None:raise treeError('xmlNewDoc() failed')
739     return xmlDoc(_obj=ret)
740
741 def newPI(name, content):
742     """Creation of a processing instruction element. """
743     ret = libxml2mod.xmlNewPI(name, content)
744     if ret is None:raise treeError('xmlNewPI() failed')
745     return xmlNode(_obj=ret)
746
747 def newText(content):
748     """Creation of a new text node. """
749     ret = libxml2mod.xmlNewText(content)
750     if ret is None:raise treeError('xmlNewText() failed')
751     return xmlNode(_obj=ret)
752
753 def newTextLen(content, len):
754     """Creation of a new text node with an extra parameter for the
755        content's length """
756     ret = libxml2mod.xmlNewTextLen(content, len)
757     if ret is None:raise treeError('xmlNewTextLen() failed')
758     return xmlNode(_obj=ret)
759
760 def setCompressMode(mode):
761     """set the default compression mode used, ZLIB based Correct
762        values: 0 (uncompressed) to 9 (max compression) """
763     libxml2mod.xmlSetCompressMode(mode)
764
765 def validateNCName(value, space):
766     """Check that a value conforms to the lexical space of NCName """
767     ret = libxml2mod.xmlValidateNCName(value, space)
768     return ret
769
770 def validateNMToken(value, space):
771     """Check that a value conforms to the lexical space of NMToken """
772     ret = libxml2mod.xmlValidateNMToken(value, space)
773     return ret
774
775 def validateName(value, space):
776     """Check that a value conforms to the lexical space of Name """
777     ret = libxml2mod.xmlValidateName(value, space)
778     return ret
779
780 def validateQName(value, space):
781     """Check that a value conforms to the lexical space of QName """
782     ret = libxml2mod.xmlValidateQName(value, space)
783     return ret
784
785 #
786 # Functions from module uri
787 #
788
789 def URIEscape(str):
790     """Escaping routine, does not do validity checks ! It will try
791        to escape the chars needing this, but this is heuristic
792        based it's impossible to be sure. """
793     ret = libxml2mod.xmlURIEscape(str)
794     return ret
795
796 def URIEscapeStr(str, list):
797     """This routine escapes a string to hex, ignoring reserved
798        characters (a-z) and the characters in the exception list. """
799     ret = libxml2mod.xmlURIEscapeStr(str, list)
800     return ret
801
802 def URIUnescapeString(str, len, target):
803     """Unescaping routine, does not do validity checks ! Output is
804        direct unsigned char translation of %XX values (no
805        encoding) """
806     ret = libxml2mod.xmlURIUnescapeString(str, len, target)
807     return ret
808
809 def buildURI(URI, base):
810     """Computes he final URI of the reference done by checking
811        that the given URI is valid, and building the final URI
812        using the base URI. This is processed according to section
813        5.2 of the RFC 2396  5.2. Resolving Relative References to
814        Absolute Form """
815     ret = libxml2mod.xmlBuildURI(URI, base)
816     return ret
817
818 def canonicPath(path):
819     """Constructs a canonic path from the specified path. """
820     ret = libxml2mod.xmlCanonicPath(path)
821     return ret
822
823 def createURI():
824     """Simply creates an empty xmlURI """
825     ret = libxml2mod.xmlCreateURI()
826     if ret is None:raise uriError('xmlCreateURI() failed')
827     return URI(_obj=ret)
828
829 def normalizeURIPath(path):
830     """Applies the 5 normalization steps to a path string--that
831        is, RFC 2396 Section 5.2, steps 6.c through 6.g. 
832        Normalization occurs directly on the string, no new
833        allocation is done """
834     ret = libxml2mod.xmlNormalizeURIPath(path)
835     return ret
836
837 def parseURI(str):
838     """Parse an URI  URI-reference = [ absoluteURI | relativeURI ]
839        [ "#" fragment ] """
840     ret = libxml2mod.xmlParseURI(str)
841     if ret is None:raise uriError('xmlParseURI() failed')
842     return URI(_obj=ret)
843
844 #
845 # Functions from module valid
846 #
847
848 def validateNameValue(value):
849     """Validate that the given value match Name production """
850     ret = libxml2mod.xmlValidateNameValue(value)
851     return ret
852
853 def validateNamesValue(value):
854     """Validate that the given value match Names production """
855     ret = libxml2mod.xmlValidateNamesValue(value)
856     return ret
857
858 def validateNmtokenValue(value):
859     """Validate that the given value match Nmtoken production  [
860        VC: Name Token ] """
861     ret = libxml2mod.xmlValidateNmtokenValue(value)
862     return ret
863
864 def validateNmtokensValue(value):
865     """Validate that the given value match Nmtokens production  [
866        VC: Name Token ] """
867     ret = libxml2mod.xmlValidateNmtokensValue(value)
868     return ret
869
870 #
871 # Functions from module xmlIO
872 #
873
874 def checkFilename(path):
875     """function checks to see if @path is a valid source (file,
876        socket...) for XML.  if stat is not available on the
877        target machine, """
878     ret = libxml2mod.xmlCheckFilename(path)
879     return ret
880
881 def cleanupInputCallbacks():
882     """clears the entire input callback table. this includes the
883        compiled-in I/O. """
884     libxml2mod.xmlCleanupInputCallbacks()
885
886 def cleanupOutputCallbacks():
887     """clears the entire output callback table. this includes the
888        compiled-in I/O callbacks. """
889     libxml2mod.xmlCleanupOutputCallbacks()
890
891 def fileMatch(filename):
892     """input from FILE * """
893     ret = libxml2mod.xmlFileMatch(filename)
894     return ret
895
896 def iOFTPMatch(filename):
897     """check if the URI matches an FTP one """
898     ret = libxml2mod.xmlIOFTPMatch(filename)
899     return ret
900
901 def iOHTTPMatch(filename):
902     """check if the URI matches an HTTP one """
903     ret = libxml2mod.xmlIOHTTPMatch(filename)
904     return ret
905
906 def normalizeWindowsPath(path):
907     """This function is obsolete. Please see xmlURIFromPath in
908        uri.c for a better solution. """
909     ret = libxml2mod.xmlNormalizeWindowsPath(path)
910     return ret
911
912 def parserGetDirectory(filename):
913     """lookup the directory for that file """
914     ret = libxml2mod.xmlParserGetDirectory(filename)
915     return ret
916
917 def registerDefaultInputCallbacks():
918     """Registers the default compiled-in I/O handlers. """
919     libxml2mod.xmlRegisterDefaultInputCallbacks()
920
921 def registerDefaultOutputCallbacks():
922     """Registers the default compiled-in I/O handlers. """
923     libxml2mod.xmlRegisterDefaultOutputCallbacks()
924
925 def registerHTTPPostCallbacks():
926     """By default, libxml submits HTTP output requests using the
927        "PUT" method. Calling this method changes the HTTP output
928        method to use the "POST" method instead. """
929     libxml2mod.xmlRegisterHTTPPostCallbacks()
930
931 #
932 # Functions from module xmlreader
933 #
934
935 def newTextReaderFilename(URI):
936     """Create an xmlTextReader structure fed with the resource at
937        @URI """
938     ret = libxml2mod.xmlNewTextReaderFilename(URI)
939     if ret is None:raise treeError('xmlNewTextReaderFilename() failed')
940     return xmlTextReader(_obj=ret)
941
942 #
943 # Functions from module xmlregexp
944 #
945
946 def regexpCompile(regexp):
947     """Parses a regular expression conforming to XML Schemas Part
948        2 Datatype Appendix F and build an automata suitable for
949        testing strings against that regular expression """
950     ret = libxml2mod.xmlRegexpCompile(regexp)
951     if ret is None:raise treeError('xmlRegexpCompile() failed')
952     return xmlReg(_obj=ret)
953
954 #
955 # Functions from module xmlunicode
956 #
957
958 def uCSIsAlphabeticPresentationForms(code):
959     """Check whether the character is part of
960        AlphabeticPresentationForms UCS Block """
961     ret = libxml2mod.xmlUCSIsAlphabeticPresentationForms(code)
962     return ret
963
964 def uCSIsArabic(code):
965     """Check whether the character is part of Arabic UCS Block """
966     ret = libxml2mod.xmlUCSIsArabic(code)
967     return ret
968
969 def uCSIsArabicPresentationFormsA(code):
970     """Check whether the character is part of
971        ArabicPresentationForms-A UCS Block """
972     ret = libxml2mod.xmlUCSIsArabicPresentationFormsA(code)
973     return ret
974
975 def uCSIsArabicPresentationFormsB(code):
976     """Check whether the character is part of
977        ArabicPresentationForms-B UCS Block """
978     ret = libxml2mod.xmlUCSIsArabicPresentationFormsB(code)
979     return ret
980
981 def uCSIsArmenian(code):
982     """Check whether the character is part of Armenian UCS Block """
983     ret = libxml2mod.xmlUCSIsArmenian(code)
984     return ret
985
986 def uCSIsArrows(code):
987     """Check whether the character is part of Arrows UCS Block """
988     ret = libxml2mod.xmlUCSIsArrows(code)
989     return ret
990
991 def uCSIsBasicLatin(code):
992     """Check whether the character is part of BasicLatin UCS Block """
993     ret = libxml2mod.xmlUCSIsBasicLatin(code)
994     return ret
995
996 def uCSIsBengali(code):
997     """Check whether the character is part of Bengali UCS Block """
998     ret = libxml2mod.xmlUCSIsBengali(code)
999     return ret
1000
1001 def uCSIsBlock(code, block):
1002     """Check whether the caracter is part of the UCS Block """
1003     ret = libxml2mod.xmlUCSIsBlock(code, block)
1004     return ret
1005
1006 def uCSIsBlockElements(code):
1007     """Check whether the character is part of BlockElements UCS
1008        Block """
1009     ret = libxml2mod.xmlUCSIsBlockElements(code)
1010     return ret
1011
1012 def uCSIsBopomofo(code):
1013     """Check whether the character is part of Bopomofo UCS Block """
1014     ret = libxml2mod.xmlUCSIsBopomofo(code)
1015     return ret
1016
1017 def uCSIsBopomofoExtended(code):
1018     """Check whether the character is part of BopomofoExtended UCS
1019        Block """
1020     ret = libxml2mod.xmlUCSIsBopomofoExtended(code)
1021     return ret
1022
1023 def uCSIsBoxDrawing(code):
1024     """Check whether the character is part of BoxDrawing UCS Block """
1025     ret = libxml2mod.xmlUCSIsBoxDrawing(code)
1026     return ret
1027
1028 def uCSIsBraillePatterns(code):
1029     """Check whether the character is part of BraillePatterns UCS
1030        Block """
1031     ret = libxml2mod.xmlUCSIsBraillePatterns(code)
1032     return ret
1033
1034 def uCSIsByzantineMusicalSymbols(code):
1035     """Check whether the character is part of
1036        ByzantineMusicalSymbols UCS Block """
1037     ret = libxml2mod.xmlUCSIsByzantineMusicalSymbols(code)
1038     return ret
1039
1040 def uCSIsCJKCompatibility(code):
1041     """Check whether the character is part of CJKCompatibility UCS
1042        Block """
1043     ret = libxml2mod.xmlUCSIsCJKCompatibility(code)
1044     return ret
1045
1046 def uCSIsCJKCompatibilityForms(code):
1047     """Check whether the character is part of
1048        CJKCompatibilityForms UCS Block """
1049     ret = libxml2mod.xmlUCSIsCJKCompatibilityForms(code)
1050     return ret
1051
1052 def uCSIsCJKCompatibilityIdeographs(code):
1053     """Check whether the character is part of
1054        CJKCompatibilityIdeographs UCS Block """
1055     ret = libxml2mod.xmlUCSIsCJKCompatibilityIdeographs(code)
1056     return ret
1057
1058 def uCSIsCJKCompatibilityIdeographsSupplement(code):
1059     """Check whether the character is part of
1060        CJKCompatibilityIdeographsSupplement UCS Block """
1061     ret = libxml2mod.xmlUCSIsCJKCompatibilityIdeographsSupplement(code)
1062     return ret
1063
1064 def uCSIsCJKRadicalsSupplement(code):
1065     """Check whether the character is part of
1066        CJKRadicalsSupplement UCS Block """
1067     ret = libxml2mod.xmlUCSIsCJKRadicalsSupplement(code)
1068     return ret
1069
1070 def uCSIsCJKSymbolsandPunctuation(code):
1071     """Check whether the character is part of
1072        CJKSymbolsandPunctuation UCS Block """
1073     ret = libxml2mod.xmlUCSIsCJKSymbolsandPunctuation(code)
1074     return ret
1075
1076 def uCSIsCJKUnifiedIdeographs(code):
1077     """Check whether the character is part of CJKUnifiedIdeographs
1078        UCS Block """
1079     ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographs(code)
1080     return ret
1081
1082 def uCSIsCJKUnifiedIdeographsExtensionA(code):
1083     """Check whether the character is part of
1084        CJKUnifiedIdeographsExtensionA UCS Block """
1085     ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographsExtensionA(code)
1086     return ret
1087
1088 def uCSIsCJKUnifiedIdeographsExtensionB(code):
1089     """Check whether the character is part of
1090        CJKUnifiedIdeographsExtensionB UCS Block """
1091     ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographsExtensionB(code)
1092     return ret
1093
1094 def uCSIsCat(code, cat):
1095     """Check whether the caracter is part of the UCS Category """
1096     ret = libxml2mod.xmlUCSIsCat(code, cat)
1097     return ret
1098
1099 def uCSIsCatC(code):
1100     """Check whether the character is part of C UCS Category """
1101     ret = libxml2mod.xmlUCSIsCatC(code)
1102     return ret
1103
1104 def uCSIsCatCc(code):
1105     """Check whether the character is part of Cc UCS Category """
1106     ret = libxml2mod.xmlUCSIsCatCc(code)
1107     return ret
1108
1109 def uCSIsCatCf(code):
1110     """Check whether the character is part of Cf UCS Category """
1111     ret = libxml2mod.xmlUCSIsCatCf(code)
1112     return ret
1113
1114 def uCSIsCatCo(code):
1115     """Check whether the character is part of Co UCS Category """
1116     ret = libxml2mod.xmlUCSIsCatCo(code)
1117     return ret
1118
1119 def uCSIsCatCs(code):
1120     """Check whether the character is part of Cs UCS Category """
1121     ret = libxml2mod.xmlUCSIsCatCs(code)
1122     return ret
1123
1124 def uCSIsCatL(code):
1125     """Check whether the character is part of L UCS Category """
1126     ret = libxml2mod.xmlUCSIsCatL(code)
1127     return ret
1128
1129 def uCSIsCatLl(code):
1130     """Check whether the character is part of Ll UCS Category """
1131     ret = libxml2mod.xmlUCSIsCatLl(code)
1132     return ret
1133
1134 def uCSIsCatLm(code):
1135     """Check whether the character is part of Lm UCS Category """
1136     ret = libxml2mod.xmlUCSIsCatLm(code)
1137     return ret
1138
1139 def uCSIsCatLo(code):
1140     """Check whether the character is part of Lo UCS Category """
1141     ret = libxml2mod.xmlUCSIsCatLo(code)
1142     return ret
1143
1144 def uCSIsCatLt(code):
1145     """Check whether the character is part of Lt UCS Category """
1146     ret = libxml2mod.xmlUCSIsCatLt(code)
1147     return ret
1148
1149 def uCSIsCatLu(code):
1150     """Check whether the character is part of Lu UCS Category """
1151     ret = libxml2mod.xmlUCSIsCatLu(code)
1152     return ret
1153
1154 def uCSIsCatM(code):
1155     """Check whether the character is part of M UCS Category """
1156     ret = libxml2mod.xmlUCSIsCatM(code)
1157     return ret
1158
1159 def uCSIsCatMc(code):
1160     """Check whether the character is part of Mc UCS Category """
1161     ret = libxml2mod.xmlUCSIsCatMc(code)
1162     return ret
1163
1164 def uCSIsCatMe(code):
1165     """Check whether the character is part of Me UCS Category """
1166     ret = libxml2mod.xmlUCSIsCatMe(code)
1167     return ret
1168
1169 def uCSIsCatMn(code):
1170     """Check whether the character is part of Mn UCS Category """
1171     ret = libxml2mod.xmlUCSIsCatMn(code)
1172     return ret
1173
1174 def uCSIsCatN(code):
1175     """Check whether the character is part of N UCS Category """
1176     ret = libxml2mod.xmlUCSIsCatN(code)
1177     return ret
1178
1179 def uCSIsCatNd(code):
1180     """Check whether the character is part of Nd UCS Category """
1181     ret = libxml2mod.xmlUCSIsCatNd(code)
1182     return ret
1183
1184 def uCSIsCatNl(code):
1185     """Check whether the character is part of Nl UCS Category """
1186     ret = libxml2mod.xmlUCSIsCatNl(code)
1187     return ret
1188
1189 def uCSIsCatNo(code):
1190     """Check whether the character is part of No UCS Category """
1191     ret = libxml2mod.xmlUCSIsCatNo(code)
1192     return ret
1193
1194 def uCSIsCatP(code):
1195     """Check whether the character is part of P UCS Category """
1196     ret = libxml2mod.xmlUCSIsCatP(code)
1197     return ret
1198
1199 def uCSIsCatPc(code):
1200     """Check whether the character is part of Pc UCS Category """
1201     ret = libxml2mod.xmlUCSIsCatPc(code)
1202     return ret
1203
1204 def uCSIsCatPd(code):
1205     """Check whether the character is part of Pd UCS Category """
1206     ret = libxml2mod.xmlUCSIsCatPd(code)
1207     return ret
1208
1209 def uCSIsCatPe(code):
1210     """Check whether the character is part of Pe UCS Category """
1211     ret = libxml2mod.xmlUCSIsCatPe(code)
1212     return ret
1213
1214 def uCSIsCatPf(code):
1215     """Check whether the character is part of Pf UCS Category """
1216     ret = libxml2mod.xmlUCSIsCatPf(code)
1217     return ret
1218
1219 def uCSIsCatPi(code):
1220     """Check whether the character is part of Pi UCS Category """
1221     ret = libxml2mod.xmlUCSIsCatPi(code)
1222     return ret
1223
1224 def uCSIsCatPo(code):
1225     """Check whether the character is part of Po UCS Category """
1226     ret = libxml2mod.xmlUCSIsCatPo(code)
1227     return ret
1228
1229 def uCSIsCatPs(code):
1230     """Check whether the character is part of Ps UCS Category """
1231     ret = libxml2mod.xmlUCSIsCatPs(code)
1232     return ret
1233
1234 def uCSIsCatS(code):
1235     """Check whether the character is part of S UCS Category """
1236     ret = libxml2mod.xmlUCSIsCatS(code)
1237     return ret
1238
1239 def uCSIsCatSc(code):
1240     """Check whether the character is part of Sc UCS Category """
1241     ret = libxml2mod.xmlUCSIsCatSc(code)
1242     return ret
1243
1244 def uCSIsCatSk(code):
1245     """Check whether the character is part of Sk UCS Category """
1246     ret = libxml2mod.xmlUCSIsCatSk(code)
1247     return ret
1248
1249 def uCSIsCatSm(code):
1250     """Check whether the character is part of Sm UCS Category """
1251     ret = libxml2mod.xmlUCSIsCatSm(code)
1252     return ret
1253
1254 def uCSIsCatSo(code):
1255     """Check whether the character is part of So UCS Category """
1256     ret = libxml2mod.xmlUCSIsCatSo(code)
1257     return ret
1258
1259 def uCSIsCatZ(code):
1260     """Check whether the character is part of Z UCS Category """
1261     ret = libxml2mod.xmlUCSIsCatZ(code)
1262     return ret
1263
1264 def uCSIsCatZl(code):
1265     """Check whether the character is part of Zl UCS Category """
1266     ret = libxml2mod.xmlUCSIsCatZl(code)
1267     return ret
1268
1269 def uCSIsCatZp(code):
1270     """Check whether the character is part of Zp UCS Category """
1271     ret = libxml2mod.xmlUCSIsCatZp(code)
1272     return ret
1273
1274 def uCSIsCatZs(code):
1275     """Check whether the character is part of Zs UCS Category """
1276     ret = libxml2mod.xmlUCSIsCatZs(code)
1277     return ret
1278
1279 def uCSIsCherokee(code):
1280     """Check whether the character is part of Cherokee UCS Block """
1281     ret = libxml2mod.xmlUCSIsCherokee(code)
1282     return ret
1283
1284 def uCSIsCombiningDiacriticalMarks(code):
1285     """Check whether the character is part of
1286        CombiningDiacriticalMarks UCS Block """
1287     ret = libxml2mod.xmlUCSIsCombiningDiacriticalMarks(code)
1288     return ret
1289
1290 def uCSIsCombiningHalfMarks(code):
1291     """Check whether the character is part of CombiningHalfMarks
1292        UCS Block """
1293     ret = libxml2mod.xmlUCSIsCombiningHalfMarks(code)
1294     return ret
1295
1296 def uCSIsCombiningMarksforSymbols(code):
1297     """Check whether the character is part of
1298        CombiningMarksforSymbols UCS Block """
1299     ret = libxml2mod.xmlUCSIsCombiningMarksforSymbols(code)
1300     return ret
1301
1302 def uCSIsControlPictures(code):
1303     """Check whether the character is part of ControlPictures UCS
1304        Block """
1305     ret = libxml2mod.xmlUCSIsControlPictures(code)
1306     return ret
1307
1308 def uCSIsCurrencySymbols(code):
1309     """Check whether the character is part of CurrencySymbols UCS
1310        Block """
1311     ret = libxml2mod.xmlUCSIsCurrencySymbols(code)
1312     return ret
1313
1314 def uCSIsCyrillic(code):
1315     """Check whether the character is part of Cyrillic UCS Block """
1316     ret = libxml2mod.xmlUCSIsCyrillic(code)
1317     return ret
1318
1319 def uCSIsDeseret(code):
1320     """Check whether the character is part of Deseret UCS Block """
1321     ret = libxml2mod.xmlUCSIsDeseret(code)
1322     return ret
1323
1324 def uCSIsDevanagari(code):
1325     """Check whether the character is part of Devanagari UCS Block """
1326     ret = libxml2mod.xmlUCSIsDevanagari(code)
1327     return ret
1328
1329 def uCSIsDingbats(code):
1330     """Check whether the character is part of Dingbats UCS Block """
1331     ret = libxml2mod.xmlUCSIsDingbats(code)
1332     return ret
1333
1334 def uCSIsEnclosedAlphanumerics(code):
1335     """Check whether the character is part of
1336        EnclosedAlphanumerics UCS Block """
1337     ret = libxml2mod.xmlUCSIsEnclosedAlphanumerics(code)
1338     return ret
1339
1340 def uCSIsEnclosedCJKLettersandMonths(code):
1341     """Check whether the character is part of
1342        EnclosedCJKLettersandMonths UCS Block """
1343     ret = libxml2mod.xmlUCSIsEnclosedCJKLettersandMonths(code)
1344     return ret
1345
1346 def uCSIsEthiopic(code):
1347     """Check whether the character is part of Ethiopic UCS Block """
1348     ret = libxml2mod.xmlUCSIsEthiopic(code)
1349     return ret
1350
1351 def uCSIsGeneralPunctuation(code):
1352     """Check whether the character is part of GeneralPunctuation
1353        UCS Block """
1354     ret = libxml2mod.xmlUCSIsGeneralPunctuation(code)
1355     return ret
1356
1357 def uCSIsGeometricShapes(code):
1358     """Check whether the character is part of GeometricShapes UCS
1359        Block """
1360     ret = libxml2mod.xmlUCSIsGeometricShapes(code)
1361     return ret
1362
1363 def uCSIsGeorgian(code):
1364     """Check whether the character is part of Georgian UCS Block """
1365     ret = libxml2mod.xmlUCSIsGeorgian(code)
1366     return ret
1367
1368 def uCSIsGothic(code):
1369     """Check whether the character is part of Gothic UCS Block """
1370     ret = libxml2mod.xmlUCSIsGothic(code)
1371     return ret
1372
1373 def uCSIsGreek(code):
1374     """Check whether the character is part of Greek UCS Block """
1375     ret = libxml2mod.xmlUCSIsGreek(code)
1376     return ret
1377
1378 def uCSIsGreekExtended(code):
1379     """Check whether the character is part of GreekExtended UCS
1380        Block """
1381     ret = libxml2mod.xmlUCSIsGreekExtended(code)
1382     return ret
1383
1384 def uCSIsGujarati(code):
1385     """Check whether the character is part of Gujarati UCS Block """
1386     ret = libxml2mod.xmlUCSIsGujarati(code)
1387     return ret
1388
1389 def uCSIsGurmukhi(code):
1390     """Check whether the character is part of Gurmukhi UCS Block """
1391     ret = libxml2mod.xmlUCSIsGurmukhi(code)
1392     return ret
1393
1394 def uCSIsHalfwidthandFullwidthForms(code):
1395     """Check whether the character is part of
1396        HalfwidthandFullwidthForms UCS Block """
1397     ret = libxml2mod.xmlUCSIsHalfwidthandFullwidthForms(code)
1398     return ret
1399
1400 def uCSIsHangulCompatibilityJamo(code):
1401     """Check whether the character is part of
1402        HangulCompatibilityJamo UCS Block """
1403     ret = libxml2mod.xmlUCSIsHangulCompatibilityJamo(code)
1404     return ret
1405
1406 def uCSIsHangulJamo(code):
1407     """Check whether the character is part of HangulJamo UCS Block """
1408     ret = libxml2mod.xmlUCSIsHangulJamo(code)
1409     return ret
1410
1411 def uCSIsHangulSyllables(code):
1412     """Check whether the character is part of HangulSyllables UCS
1413        Block """
1414     ret = libxml2mod.xmlUCSIsHangulSyllables(code)
1415     return ret
1416
1417 def uCSIsHebrew(code):
1418     """Check whether the character is part of Hebrew UCS Block """
1419     ret = libxml2mod.xmlUCSIsHebrew(code)
1420     return ret
1421
1422 def uCSIsHighPrivateUseSurrogates(code):
1423     """Check whether the character is part of
1424        HighPrivateUseSurrogates UCS Block """
1425     ret = libxml2mod.xmlUCSIsHighPrivateUseSurrogates(code)
1426     return ret
1427
1428 def uCSIsHighSurrogates(code):
1429     """Check whether the character is part of HighSurrogates UCS
1430        Block """
1431     ret = libxml2mod.xmlUCSIsHighSurrogates(code)
1432     return ret
1433
1434 def uCSIsHiragana(code):
1435     """Check whether the character is part of Hiragana UCS Block """
1436     ret = libxml2mod.xmlUCSIsHiragana(code)
1437     return ret
1438
1439 def uCSIsIPAExtensions(code):
1440     """Check whether the character is part of IPAExtensions UCS
1441        Block """
1442     ret = libxml2mod.xmlUCSIsIPAExtensions(code)
1443     return ret
1444
1445 def uCSIsIdeographicDescriptionCharacters(code):
1446     """Check whether the character is part of
1447        IdeographicDescriptionCharacters UCS Block """
1448     ret = libxml2mod.xmlUCSIsIdeographicDescriptionCharacters(code)
1449     return ret
1450
1451 def uCSIsKanbun(code):
1452     """Check whether the character is part of Kanbun UCS Block """
1453     ret = libxml2mod.xmlUCSIsKanbun(code)
1454     return ret
1455
1456 def uCSIsKangxiRadicals(code):
1457     """Check whether the character is part of KangxiRadicals UCS
1458        Block """
1459     ret = libxml2mod.xmlUCSIsKangxiRadicals(code)
1460     return ret
1461
1462 def uCSIsKannada(code):
1463     """Check whether the character is part of Kannada UCS Block """
1464     ret = libxml2mod.xmlUCSIsKannada(code)
1465     return ret
1466
1467 def uCSIsKatakana(code):
1468     """Check whether the character is part of Katakana UCS Block """
1469     ret = libxml2mod.xmlUCSIsKatakana(code)
1470     return ret
1471
1472 def uCSIsKhmer(code):
1473     """Check whether the character is part of Khmer UCS Block """
1474     ret = libxml2mod.xmlUCSIsKhmer(code)
1475     return ret
1476
1477 def uCSIsLao(code):
1478     """Check whether the character is part of Lao UCS Block """
1479     ret = libxml2mod.xmlUCSIsLao(code)
1480     return ret
1481
1482 def uCSIsLatin1Supplement(code):
1483     """Check whether the character is part of Latin-1Supplement
1484        UCS Block """
1485     ret = libxml2mod.xmlUCSIsLatin1Supplement(code)
1486     return ret
1487
1488 def uCSIsLatinExtendedA(code):
1489     """Check whether the character is part of LatinExtended-A UCS
1490        Block """
1491     ret = libxml2mod.xmlUCSIsLatinExtendedA(code)
1492     return ret
1493
1494 def uCSIsLatinExtendedAdditional(code):
1495     """Check whether the character is part of
1496        LatinExtendedAdditional UCS Block """
1497     ret = libxml2mod.xmlUCSIsLatinExtendedAdditional(code)
1498     return ret
1499
1500 def uCSIsLatinExtendedB(code):
1501     """Check whether the character is part of LatinExtended-B UCS
1502        Block """
1503     ret = libxml2mod.xmlUCSIsLatinExtendedB(code)
1504     return ret
1505
1506 def uCSIsLetterlikeSymbols(code):
1507     """Check whether the character is part of LetterlikeSymbols
1508        UCS Block """
1509     ret = libxml2mod.xmlUCSIsLetterlikeSymbols(code)
1510     return ret
1511
1512 def uCSIsLowSurrogates(code):
1513     """Check whether the character is part of LowSurrogates UCS
1514        Block """
1515     ret = libxml2mod.xmlUCSIsLowSurrogates(code)
1516     return ret
1517
1518 def uCSIsMalayalam(code):
1519     """Check whether the character is part of Malayalam UCS Block """
1520     ret = libxml2mod.xmlUCSIsMalayalam(code)
1521     return ret
1522
1523 def uCSIsMathematicalAlphanumericSymbols(code):
1524     """Check whether the character is part of
1525        MathematicalAlphanumericSymbols UCS Block """
1526     ret = libxml2mod.xmlUCSIsMathematicalAlphanumericSymbols(code)
1527     return ret
1528
1529 def uCSIsMathematicalOperators(code):
1530     """Check whether the character is part of
1531        MathematicalOperators UCS Block """
1532     ret = libxml2mod.xmlUCSIsMathematicalOperators(code)
1533     return ret
1534
1535 def uCSIsMiscellaneousSymbols(code):
1536     """Check whether the character is part of MiscellaneousSymbols
1537        UCS Block """
1538     ret = libxml2mod.xmlUCSIsMiscellaneousSymbols(code)
1539     return ret
1540
1541 def uCSIsMiscellaneousTechnical(code):
1542     """Check whether the character is part of
1543        MiscellaneousTechnical UCS Block """
1544     ret = libxml2mod.xmlUCSIsMiscellaneousTechnical(code)
1545     return ret
1546
1547 def uCSIsMongolian(code):
1548     """Check whether the character is part of Mongolian UCS Block """
1549     ret = libxml2mod.xmlUCSIsMongolian(code)
1550     return ret
1551
1552 def uCSIsMusicalSymbols(code):
1553     """Check whether the character is part of MusicalSymbols UCS
1554        Block """
1555     ret = libxml2mod.xmlUCSIsMusicalSymbols(code)
1556     return ret
1557
1558 def uCSIsMyanmar(code):
1559     """Check whether the character is part of Myanmar UCS Block """
1560     ret = libxml2mod.xmlUCSIsMyanmar(code)
1561     return ret
1562
1563 def uCSIsNumberForms(code):
1564     """Check whether the character is part of NumberForms UCS Block """
1565     ret = libxml2mod.xmlUCSIsNumberForms(code)
1566     return ret
1567
1568 def uCSIsOgham(code):
1569     """Check whether the character is part of Ogham UCS Block """
1570     ret = libxml2mod.xmlUCSIsOgham(code)
1571     return ret
1572
1573 def uCSIsOldItalic(code):
1574     """Check whether the character is part of OldItalic UCS Block """
1575     ret = libxml2mod.xmlUCSIsOldItalic(code)
1576     return ret
1577
1578 def uCSIsOpticalCharacterRecognition(code):
1579     """Check whether the character is part of
1580        OpticalCharacterRecognition UCS Block """
1581     ret = libxml2mod.xmlUCSIsOpticalCharacterRecognition(code)
1582     return ret
1583
1584 def uCSIsOriya(code):
1585     """Check whether the character is part of Oriya UCS Block """
1586     ret = libxml2mod.xmlUCSIsOriya(code)
1587     return ret
1588
1589 def uCSIsPrivateUse(code):
1590     """Check whether the character is part of PrivateUse UCS Block """
1591     ret = libxml2mod.xmlUCSIsPrivateUse(code)
1592     return ret
1593
1594 def uCSIsRunic(code):
1595     """Check whether the character is part of Runic UCS Block """
1596     ret = libxml2mod.xmlUCSIsRunic(code)
1597     return ret
1598
1599 def uCSIsSinhala(code):
1600     """Check whether the character is part of Sinhala UCS Block """
1601     ret = libxml2mod.xmlUCSIsSinhala(code)
1602     return ret
1603
1604 def uCSIsSmallFormVariants(code):
1605     """Check whether the character is part of SmallFormVariants
1606        UCS Block """
1607     ret = libxml2mod.xmlUCSIsSmallFormVariants(code)
1608     return ret
1609
1610 def uCSIsSpacingModifierLetters(code):
1611     """Check whether the character is part of
1612        SpacingModifierLetters UCS Block """
1613     ret = libxml2mod.xmlUCSIsSpacingModifierLetters(code)
1614     return ret
1615
1616 def uCSIsSpecials(code):
1617     """Check whether the character is part of Specials UCS Block """
1618     ret = libxml2mod.xmlUCSIsSpecials(code)
1619     return ret
1620
1621 def uCSIsSuperscriptsandSubscripts(code):
1622     """Check whether the character is part of
1623        SuperscriptsandSubscripts UCS Block """
1624     ret = libxml2mod.xmlUCSIsSuperscriptsandSubscripts(code)
1625     return ret
1626
1627 def uCSIsSyriac(code):
1628     """Check whether the character is part of Syriac UCS Block """
1629     ret = libxml2mod.xmlUCSIsSyriac(code)
1630     return ret
1631
1632 def uCSIsTags(code):
1633     """Check whether the character is part of Tags UCS Block """
1634     ret = libxml2mod.xmlUCSIsTags(code)
1635     return ret
1636
1637 def uCSIsTamil(code):
1638     """Check whether the character is part of Tamil UCS Block """
1639     ret = libxml2mod.xmlUCSIsTamil(code)
1640     return ret
1641
1642 def uCSIsTelugu(code):
1643     """Check whether the character is part of Telugu UCS Block """
1644     ret = libxml2mod.xmlUCSIsTelugu(code)
1645     return ret
1646
1647 def uCSIsThaana(code):
1648     """Check whether the character is part of Thaana UCS Block """
1649     ret = libxml2mod.xmlUCSIsThaana(code)
1650     return ret
1651
1652 def uCSIsThai(code):
1653     """Check whether the character is part of Thai UCS Block """
1654     ret = libxml2mod.xmlUCSIsThai(code)
1655     return ret
1656
1657 def uCSIsTibetan(code):
1658     """Check whether the character is part of Tibetan UCS Block """
1659     ret = libxml2mod.xmlUCSIsTibetan(code)
1660     return ret
1661
1662 def uCSIsUnifiedCanadianAboriginalSyllabics(code):
1663     """Check whether the character is part of
1664        UnifiedCanadianAboriginalSyllabics UCS Block """
1665     ret = libxml2mod.xmlUCSIsUnifiedCanadianAboriginalSyllabics(code)
1666     return ret
1667
1668 def uCSIsYiRadicals(code):
1669     """Check whether the character is part of YiRadicals UCS Block """
1670     ret = libxml2mod.xmlUCSIsYiRadicals(code)
1671     return ret
1672
1673 def uCSIsYiSyllables(code):
1674     """Check whether the character is part of YiSyllables UCS Block """
1675     ret = libxml2mod.xmlUCSIsYiSyllables(code)
1676     return ret
1677
1678 #
1679 # Functions from module xmlversion
1680 #
1681
1682 def checkVersion(version):
1683     """check the compiled lib version against the include one.
1684        This can warn or immediately kill the application """
1685     libxml2mod.xmlCheckVersion(version)
1686
1687 #
1688 # Functions from module xpathInternals
1689 #
1690
1691 def valuePop(ctxt):
1692     """Pops the top XPath object from the value stack """
1693     if ctxt is None: ctxt__o = None
1694     else: ctxt__o = ctxt._o
1695     ret = libxml2mod.valuePop(ctxt__o)
1696     return ret
1697
1698 class xmlNode(xmlCore):
1699     def __init__(self, _obj=None):
1700         self._o = None
1701         xmlCore.__init__(self, _obj=_obj)
1702
1703     def __repr__(self):
1704         return "<xmlNode (%s) object at 0x%x>" % (self.name, id (self))
1705
1706     # accessors for xmlNode
1707     def ns(self):
1708         """Get the namespace of a node """
1709         ret = libxml2mod.xmlNodeGetNs(self._o)
1710         if ret is None:raise treeError('xmlNodeGetNs() failed')
1711         __tmp = xmlNs(_obj=ret)
1712         return __tmp
1713
1714     def nsDefs(self):
1715         """Get the namespace of a node """
1716         ret = libxml2mod.xmlNodeGetNsDefs(self._o)
1717         if ret is None:raise treeError('xmlNodeGetNsDefs() failed')
1718         __tmp = xmlNs(_obj=ret)
1719         return __tmp
1720
1721     #
1722     # xmlNode functions from module debugXML
1723     #
1724
1725     def debugDumpNode(self, output, depth):
1726         """Dumps debug information for the element node, it is
1727            recursive """
1728         libxml2mod.xmlDebugDumpNode(output, self._o, depth)
1729
1730     def debugDumpNodeList(self, output, depth):
1731         """Dumps debug information for the list of element node, it is
1732            recursive """
1733         libxml2mod.xmlDebugDumpNodeList(output, self._o, depth)
1734
1735     def debugDumpOneNode(self, output, depth):
1736         """Dumps debug information for the element node, it is not
1737            recursive """
1738         libxml2mod.xmlDebugDumpOneNode(output, self._o, depth)
1739
1740     def lsCountNode(self):
1741         """Count the children of @node. """
1742         ret = libxml2mod.xmlLsCountNode(self._o)
1743         return ret
1744
1745     def lsOneNode(self, output):
1746         """Dump to @output the type and name of @node. """
1747         libxml2mod.xmlLsOneNode(output, self._o)
1748
1749     def shellPrintNode(self):
1750         """Print node to the output FILE """
1751         libxml2mod.xmlShellPrintNode(self._o)
1752
1753     #
1754     # xmlNode functions from module tree
1755     #
1756
1757     def addChild(self, cur):
1758         """Add a new node to @parent, at the end of the child (or
1759            property) list merging adjacent TEXT nodes (in which case
1760            @cur is freed) If the new node is ATTRIBUTE, it is added
1761            into properties instead of children. If there is an
1762            attribute with equal name, it is first destroyed. """
1763         if cur is None: cur__o = None
1764         else: cur__o = cur._o
1765         ret = libxml2mod.xmlAddChild(self._o, cur__o)
1766         if ret is None:raise treeError('xmlAddChild() failed')
1767         __tmp = xmlNode(_obj=ret)
1768         return __tmp
1769
1770     def addChildList(self, cur):
1771         """Add a list of node at the end of the child list of the
1772            parent merging adjacent TEXT nodes (@cur may be freed) """
1773         if cur is None: cur__o = None
1774         else: cur__o = cur._o
1775         ret = libxml2mod.xmlAddChildList(self._o, cur__o)
1776         if ret is None:raise treeError('xmlAddChildList() failed')
1777         __tmp = xmlNode(_obj=ret)
1778         return __tmp
1779
1780     def addContent(self, content):
1781         """Append the extra substring to the node content. """
1782         libxml2mod.xmlNodeAddContent(self._o, content)
1783
1784     def addContentLen(self, content, len):
1785         """Append the extra substring to the node content. """
1786         libxml2mod.xmlNodeAddContentLen(self._o, content, len)
1787
1788     def addNextSibling(self, elem):
1789         """Add a new node @elem as the next sibling of @cur If the new
1790            node was already inserted in a document it is first
1791            unlinked from its existing context. As a result of text
1792            merging @elem may be freed. If the new node is ATTRIBUTE,
1793            it is added into properties instead of children. If there
1794            is an attribute with equal name, it is first destroyed. """
1795         if elem is None: elem__o = None
1796         else: elem__o = elem._o
1797         ret = libxml2mod.xmlAddNextSibling(self._o, elem__o)
1798         if ret is None:raise treeError('xmlAddNextSibling() failed')
1799         __tmp = xmlNode(_obj=ret)
1800         return __tmp
1801
1802     def addPrevSibling(self, elem):
1803         """Add a new node @elem as the previous sibling of @cur
1804            merging adjacent TEXT nodes (@elem may be freed) If the
1805            new node was already inserted in a document it is first
1806            unlinked from its existing context. If the new node is
1807            ATTRIBUTE, it is added into properties instead of
1808            children. If there is an attribute with equal name, it is
1809            first destroyed. """
1810         if elem is None: elem__o = None
1811         else: elem__o = elem._o
1812         ret = libxml2mod.xmlAddPrevSibling(self._o, elem__o)
1813         if ret is None:raise treeError('xmlAddPrevSibling() failed')
1814         __tmp = xmlNode(_obj=ret)
1815         return __tmp
1816
1817     def addSibling(self, elem):
1818         """Add a new element @elem to the list of siblings of @cur
1819            merging adjacent TEXT nodes (@elem may be freed) If the
1820            new element was already inserted in a document it is first
1821            unlinked from its existing context. """
1822         if elem is None: elem__o = None
1823         else: elem__o = elem._o
1824         ret = libxml2mod.xmlAddSibling(self._o, elem__o)
1825         if ret is None:raise treeError('xmlAddSibling() failed')
1826         __tmp = xmlNode(_obj=ret)
1827         return __tmp
1828
1829     def copyNode(self, recursive):
1830         """Do a copy of the node. """
1831         ret = libxml2mod.xmlCopyNode(self._o, recursive)
1832         if ret is None:raise treeError('xmlCopyNode() failed')
1833         __tmp = xmlNode(_obj=ret)
1834         return __tmp
1835
1836     def copyNodeList(self):
1837         """Do a recursive copy of the node list. """
1838         ret = libxml2mod.xmlCopyNodeList(self._o)
1839         if ret is None:raise treeError('xmlCopyNodeList() failed')
1840         __tmp = xmlNode(_obj=ret)
1841         return __tmp
1842
1843     def copyProp(self, cur):
1844         """Do a copy of the attribute. """
1845         if cur is None: cur__o = None
1846         else: cur__o = cur._o
1847         ret = libxml2mod.xmlCopyProp(self._o, cur__o)
1848         if ret is None:raise treeError('xmlCopyProp() failed')
1849         __tmp = xmlAttr(_obj=ret)
1850         return __tmp
1851
1852     def copyPropList(self, cur):
1853         """Do a copy of an attribute list. """
1854         if cur is None: cur__o = None
1855         else: cur__o = cur._o
1856         ret = libxml2mod.xmlCopyPropList(self._o, cur__o)
1857         if ret is None:raise treeError('xmlCopyPropList() failed')
1858         __tmp = xmlAttr(_obj=ret)
1859         return __tmp
1860
1861     def docCopyNode(self, doc, recursive):
1862         """Do a copy of the node to a given document. """
1863         if doc is None: doc__o = None
1864         else: doc__o = doc._o
1865         ret = libxml2mod.xmlDocCopyNode(self._o, doc__o, recursive)
1866         if ret is None:raise treeError('xmlDocCopyNode() failed')
1867         __tmp = xmlNode(_obj=ret)
1868         return __tmp
1869
1870     def docSetRootElement(self, doc):
1871         """Set the root element of the document (doc->children is a
1872            list containing possibly comments, PIs, etc ...). """
1873         if doc is None: doc__o = None
1874         else: doc__o = doc._o
1875         ret = libxml2mod.xmlDocSetRootElement(doc__o, self._o)
1876         if ret is None:return None
1877         __tmp = xmlNode(_obj=ret)
1878         return __tmp
1879
1880     def freeNode(self):
1881         """Free a node, this is a recursive behaviour, all the
1882            children are freed too. This doesn't unlink the child from
1883            the list, use xmlUnlinkNode() first. """
1884         libxml2mod.xmlFreeNode(self._o)
1885
1886     def freeNodeList(self):
1887         """Free a node and all its siblings, this is a recursive
1888            behaviour, all the children are freed too. """
1889         libxml2mod.xmlFreeNodeList(self._o)
1890
1891     def getBase(self, doc):
1892         """Searches for the BASE URL. The code should work on both XML
1893            and HTML document even if base mechanisms are completely
1894            different. It returns the base as defined in RFC 2396
1895            sections 5.1.1. Base URI within Document Content and
1896            5.1.2. Base URI from the Encapsulating Entity However it
1897            does not return the document base (5.1.3), use
1898            xmlDocumentGetBase() for this """
1899         if doc is None: doc__o = None
1900         else: doc__o = doc._o
1901         ret = libxml2mod.xmlNodeGetBase(doc__o, self._o)
1902         return ret
1903
1904     def getContent(self):
1905         """Read the value of a node, this can be either the text
1906            carried directly by this node if it's a TEXT node or the
1907            aggregate string of the values carried by this node
1908            child's (TEXT and ENTITY_REF). Entity references are
1909            substituted. """
1910         ret = libxml2mod.xmlNodeGetContent(self._o)
1911         return ret
1912
1913     def getLang(self):
1914         """Searches the language of a node, i.e. the values of the
1915            xml:lang attribute or the one carried by the nearest
1916            ancestor. """
1917         ret = libxml2mod.xmlNodeGetLang(self._o)
1918         return ret
1919
1920     def getSpacePreserve(self):
1921         """Searches the space preserving behaviour of a node, i.e. the
1922            values of the xml:space attribute or the one carried by
1923            the nearest ancestor. """
1924         ret = libxml2mod.xmlNodeGetSpacePreserve(self._o)
1925         return ret
1926
1927     def hasNsProp(self, name, nameSpace):
1928         """Search for an attribute associated to a node This attribute
1929            has to be anchored in the namespace specified. This does
1930            the entity substitution. This function looks in DTD
1931            attribute declaration for #FIXED or default declaration
1932            values unless DTD use has been turned off. """
1933         ret = libxml2mod.xmlHasNsProp(self._o, name, nameSpace)
1934         if ret is None:return None
1935         __tmp = xmlAttr(_obj=ret)
1936         return __tmp
1937
1938     def hasProp(self, name):
1939         """Search an attribute associated to a node This function also
1940            looks in DTD attribute declaration for #FIXED or default
1941            declaration values unless DTD use has been turned off. """
1942         ret = libxml2mod.xmlHasProp(self._o, name)
1943         if ret is None:return None
1944         __tmp = xmlAttr(_obj=ret)
1945         return __tmp
1946
1947     def isBlankNode(self):
1948         """Checks whether this node is an empty or whitespace only
1949            (and possibly ignorable) text-node. """
1950         ret = libxml2mod.xmlIsBlankNode(self._o)
1951         return ret
1952
1953     def isText(self):
1954         """Is this node a Text node ? """
1955         ret = libxml2mod.xmlNodeIsText(self._o)
1956         return ret
1957
1958     def lastChild(self):
1959         """Search the last child of a node. """
1960         ret = libxml2mod.xmlGetLastChild(self._o)
1961         if ret is None:raise treeError('xmlGetLastChild() failed')
1962         __tmp = xmlNode(_obj=ret)
1963         return __tmp
1964
1965     def lineNo(self):
1966         """Get line number of node. this requires activation of this
1967            option before invoking the parser by calling
1968            xmlLineNumbersDefault(1) """
1969         ret = libxml2mod.xmlGetLineNo(self._o)
1970         return ret
1971
1972     def listGetRawString(self, doc, inLine):
1973         """Builds the string equivalent to the text contained in the
1974            Node list made of TEXTs and ENTITY_REFs, contrary to
1975            xmlNodeListGetString() this function doesn't do any
1976            character encoding handling. """
1977         if doc is None: doc__o = None
1978         else: doc__o = doc._o
1979         ret = libxml2mod.xmlNodeListGetRawString(doc__o, self._o, inLine)
1980         return ret
1981
1982     def listGetString(self, doc, inLine):
1983         """Build the string equivalent to the text contained in the
1984            Node list made of TEXTs and ENTITY_REFs """
1985         if doc is None: doc__o = None
1986         else: doc__o = doc._o
1987         ret = libxml2mod.xmlNodeListGetString(doc__o, self._o, inLine)
1988         return ret
1989
1990     def newChild(self, ns, name, content):
1991         """Creation of a new child element, added at the end of
1992            @parent children list. @ns and @content parameters are
1993            optional (None). If content is non None, a child list
1994            containing the TEXTs and ENTITY_REFs node will be created.
1995            NOTE: @content is supposed to be a piece of XML CDATA, so
1996            it allow entities references, but XML special chars need
1997            to be escaped first by using xmlEncodeEntitiesReentrant().
1998            Use xmlNewTextChild() if entities support is not needed. """
1999         if ns is None: ns__o = None
2000         else: ns__o = ns._o
2001         ret = libxml2mod.xmlNewChild(self._o, ns__o, name, content)
2002         if ret is None:raise treeError('xmlNewChild() failed')
2003         __tmp = xmlNode(_obj=ret)
2004         return __tmp
2005
2006     def newNs(self, href, prefix):
2007         """Creation of a new Namespace. This function will refuse to
2008            create a namespace with a similar prefix than an existing
2009            one present on this node. We use href==None in the case of
2010            an element creation where the namespace was not defined. """
2011         ret = libxml2mod.xmlNewNs(self._o, href, prefix)
2012         if ret is None:raise treeError('xmlNewNs() failed')
2013         __tmp = xmlNs(_obj=ret)
2014         return __tmp
2015
2016     def newNsProp(self, ns, name, value):
2017         """Create a new property tagged with a namespace and carried
2018            by a node. """
2019         if ns is None: ns__o = None
2020         else: ns__o = ns._o
2021         ret = libxml2mod.xmlNewNsProp(self._o, ns__o, name, value)
2022         if ret is None:raise treeError('xmlNewNsProp() failed')
2023         __tmp = xmlAttr(_obj=ret)
2024         return __tmp
2025
2026     def newNsPropEatName(self, ns, name, value):
2027         """Create a new property tagged with a namespace and carried
2028            by a node. """
2029         if ns is None: ns__o = None
2030         else: ns__o = ns._o
2031         ret = libxml2mod.xmlNewNsPropEatName(self._o, ns__o, name, value)
2032         if ret is None:raise treeError('xmlNewNsPropEatName() failed')
2033         __tmp = xmlAttr(_obj=ret)
2034         return __tmp
2035
2036     def newProp(self, name, value):
2037         """Create a new property carried by a node. """
2038         ret = libxml2mod.xmlNewProp(self._o, name, value)
2039         if ret is None:raise treeError('xmlNewProp() failed')
2040         __tmp = xmlAttr(_obj=ret)
2041         return __tmp
2042
2043     def newTextChild(self, ns, name, content):
2044         """Creation of a new child element, added at the end of
2045            @parent children list. @ns and @content parameters are
2046            optional (None). If content is non None, a child TEXT node
2047            will be created containing the string content. """
2048         if ns is None: ns__o = None
2049         else: ns__o = ns._o
2050         ret = libxml2mod.xmlNewTextChild(self._o, ns__o, name, content)
2051         if ret is None:raise treeError('xmlNewTextChild() failed')
2052         __tmp = xmlNode(_obj=ret)
2053         return __tmp
2054
2055     def noNsProp(self, name):
2056         """Search and get the value of an attribute associated to a
2057            node This does the entity substitution. This function
2058            looks in DTD attribute declaration for #FIXED or default
2059            declaration values unless DTD use has been turned off.
2060            This function is similar to xmlGetProp except it will
2061            accept only an attribute in no namespace. """
2062         ret = libxml2mod.xmlGetNoNsProp(self._o, name)
2063         return ret
2064
2065     def nodePath(self):
2066         """Build a structure based Path for the given node """
2067         ret = libxml2mod.xmlGetNodePath(self._o)
2068         return ret
2069
2070     def nsProp(self, name, nameSpace):
2071         """Search and get the value of an attribute associated to a
2072            node This attribute has to be anchored in the namespace
2073            specified. This does the entity substitution. This
2074            function looks in DTD attribute declaration for #FIXED or
2075            default declaration values unless DTD use has been turned
2076            off. """
2077         ret = libxml2mod.xmlGetNsProp(self._o, name, nameSpace)
2078         return ret
2079
2080     def prop(self, name):
2081         """Search and get the value of an attribute associated to a
2082            node This does the entity substitution. This function
2083            looks in DTD attribute declaration for #FIXED or default
2084            declaration values unless DTD use has been turned off.
2085            NOTE: this function acts independently of namespaces
2086            associated to the attribute. Use xmlGetNsProp() or
2087            xmlGetNoNsProp() for namespace aware processing. """
2088         ret = libxml2mod.xmlGetProp(self._o, name)
2089         return ret
2090
2091     def reconciliateNs(self, doc):
2092         """This function checks that all the namespaces declared
2093            within the given tree are properly declared. This is
2094            needed for example after Copy or Cut and then paste
2095            operations. The subtree may still hold pointers to
2096            namespace declarations outside the subtree or
2097            invalid/masked. As much as possible the function try to
2098            reuse the existing namespaces found in the new
2099            environment. If not possible the new namespaces are
2100            redeclared on @tree at the top of the given subtree. """
2101         if doc is None: doc__o = None
2102         else: doc__o = doc._o
2103         ret = libxml2mod.xmlReconciliateNs(doc__o, self._o)
2104         return ret
2105
2106     def replaceNode(self, cur):
2107         """Unlink the old node from it's current context, prune the
2108            new one at the same place. If @cur was already inserted in
2109            a document it is first unlinked from its existing context. """
2110         if cur is None: cur__o = None
2111         else: cur__o = cur._o
2112         ret = libxml2mod.xmlReplaceNode(self._o, cur__o)
2113         if ret is None:raise treeError('xmlReplaceNode() failed')
2114         __tmp = xmlNode(_obj=ret)
2115         return __tmp
2116
2117     def searchNs(self, doc, nameSpace):
2118         """Search a Ns registered under a given name space for a
2119            document. recurse on the parents until it finds the
2120            defined namespace or return None otherwise. @nameSpace can
2121            be None, this is a search for the default namespace. We
2122            don't allow to cross entities boundaries. If you don't
2123            declare the namespace within those you will be in troubles
2124            !!! A warning is generated to cover this case. """
2125         if doc is None: doc__o = None
2126         else: doc__o = doc._o
2127         ret = libxml2mod.xmlSearchNs(doc__o, self._o, nameSpace)
2128         if ret is None:raise treeError('xmlSearchNs() failed')
2129         __tmp = xmlNs(_obj=ret)
2130         return __tmp
2131
2132     def searchNsByHref(self, doc, href):
2133         """Search a Ns aliasing a given URI. Recurse on the parents
2134            until it finds the defined namespace or return None
2135            otherwise. """
2136         if doc is None: doc__o = None
2137         else: doc__o = doc._o
2138         ret = libxml2mod.xmlSearchNsByHref(doc__o, self._o, href)
2139         if ret is None:raise treeError('xmlSearchNsByHref() failed')
2140         __tmp = xmlNs(_obj=ret)
2141         return __tmp
2142
2143     def setBase(self, uri):
2144         """Set (or reset) the base URI of a node, i.e. the value of
2145            the xml:base attribute. """
2146         libxml2mod.xmlNodeSetBase(self._o, uri)
2147
2148     def setContent(self, content):
2149         """Replace the content of a node. """
2150         libxml2mod.xmlNodeSetContent(self._o, content)
2151
2152     def setContentLen(self, content, len):
2153         """Replace the content of a node. """
2154         libxml2mod.xmlNodeSetContentLen(self._o, content, len)
2155
2156     def setLang(self, lang):
2157         """Set the language of a node, i.e. the values of the xml:lang
2158            attribute. """
2159         libxml2mod.xmlNodeSetLang(self._o, lang)
2160
2161     def setListDoc(self, doc):
2162         """update all nodes in the list to point to the right document """
2163         if doc is None: doc__o = None
2164         else: doc__o = doc._o
2165         libxml2mod.xmlSetListDoc(self._o, doc__o)
2166
2167     def setName(self, name):
2168         """Set (or reset) the name of a node. """
2169         libxml2mod.xmlNodeSetName(self._o, name)
2170
2171     def setNs(self, ns):
2172         """Associate a namespace to a node, a posteriori. """
2173         if ns is None: ns__o = None
2174         else: ns__o = ns._o
2175         libxml2mod.xmlSetNs(self._o, ns__o)
2176
2177     def setNsProp(self, ns, name, value):
2178         """Set (or reset) an attribute carried by a node. The ns
2179            structure must be in scope, this is not checked. """
2180         if ns is None: ns__o = None
2181         else: ns__o = ns._o
2182         ret = libxml2mod.xmlSetNsProp(self._o, ns__o, name, value)
2183         if ret is None:raise treeError('xmlSetNsProp() failed')
2184         __tmp = xmlAttr(_obj=ret)
2185         return __tmp
2186
2187     def setProp(self, name, value):
2188         """Set (or reset) an attribute carried by a node. """
2189         ret = libxml2mod.xmlSetProp(self._o, name, value)
2190         if ret is None:raise treeError('xmlSetProp() failed')
2191         __tmp = xmlAttr(_obj=ret)
2192         return __tmp
2193
2194     def setSpacePreserve(self, val):
2195         """Set (or reset) the space preserving behaviour of a node,
2196            i.e. the value of the xml:space attribute. """
2197         libxml2mod.xmlNodeSetSpacePreserve(self._o, val)
2198
2199     def setTreeDoc(self, doc):
2200         """update all nodes under the tree to point to the right
2201            document """
2202         if doc is None: doc__o = None
2203         else: doc__o = doc._o
2204         libxml2mod.xmlSetTreeDoc(self._o, doc__o)
2205
2206     def textConcat(self, content, len):
2207         """Concat the given string at the end of the existing node
2208            content """
2209         libxml2mod.xmlTextConcat(self._o, content, len)
2210
2211     def textMerge(self, second):
2212         """Merge two text nodes into one """
2213         if second is None: second__o = None
2214         else: second__o = second._o
2215         ret = libxml2mod.xmlTextMerge(self._o, second__o)
2216         if ret is None:raise treeError('xmlTextMerge() failed')
2217         __tmp = xmlNode(_obj=ret)
2218         return __tmp
2219
2220     def unlinkNode(self):
2221         """Unlink a node from it's current context, the node is not
2222            freed """
2223         libxml2mod.xmlUnlinkNode(self._o)
2224
2225     def unsetNsProp(self, ns, name):
2226         """Remove an attribute carried by a node. """
2227         if ns is None: ns__o = None
2228         else: ns__o = ns._o
2229         ret = libxml2mod.xmlUnsetNsProp(self._o, ns__o, name)
2230         return ret
2231
2232     def unsetProp(self, name):
2233         """Remove an attribute carried by a node. """
2234         ret = libxml2mod.xmlUnsetProp(self._o, name)
2235         return ret
2236
2237     #
2238     # xmlNode functions from module valid
2239     #
2240
2241     def isID(self, doc, attr):
2242         """Determine whether an attribute is of type ID. In case we
2243            have DTD(s) then this is done if DTD loading has been
2244            requested. In the case of HTML documents parsed with the
2245            HTML parser, then ID detection is done systematically. """
2246         if doc is None: doc__o = None
2247         else: doc__o = doc._o
2248         if attr is None: attr__o = None
2249         else: attr__o = attr._o
2250         ret = libxml2mod.xmlIsID(doc__o, self._o, attr__o)
2251         return ret
2252
2253     def isRef(self, doc, attr):
2254         """Determine whether an attribute is of type Ref. In case we
2255            have DTD(s) then this is simple, otherwise we use an
2256            heuristic: name Ref (upper or lowercase). """
2257         if doc is None: doc__o = None
2258         else: doc__o = doc._o
2259         if attr is None: attr__o = None
2260         else: attr__o = attr._o
2261         ret = libxml2mod.xmlIsRef(doc__o, self._o, attr__o)
2262         return ret
2263
2264     def validNormalizeAttributeValue(self, doc, name, value):
2265         """Does the validation related extra step of the normalization
2266            of attribute values:  If the declared value is not CDATA,
2267            then the XML processor must further process the normalized
2268            attribute value by discarding any leading and trailing
2269            space (#x20) characters, and by replacing sequences of
2270            space (#x20) characters by single space (#x20) character. """
2271         if doc is None: doc__o = None
2272         else: doc__o = doc._o
2273         ret = libxml2mod.xmlValidNormalizeAttributeValue(doc__o, self._o, name, value)
2274         return ret
2275
2276     #
2277     # xmlNode functions from module xpath
2278     #
2279
2280     def xpathCastNodeToNumber(self):
2281         """Converts a node to its number value """
2282         ret = libxml2mod.xmlXPathCastNodeToNumber(self._o)
2283         return ret
2284
2285     def xpathCastNodeToString(self):
2286         """Converts a node to its string value. """
2287         ret = libxml2mod.xmlXPathCastNodeToString(self._o)
2288         return ret
2289
2290     def xpathCmpNodes(self, node2):
2291         """Compare two nodes w.r.t document order """
2292         if node2 is None: node2__o = None
2293         else: node2__o = node2._o
2294         ret = libxml2mod.xmlXPathCmpNodes(self._o, node2__o)
2295         return ret
2296
2297     #
2298     # xmlNode functions from module xpathInternals
2299     #
2300
2301     def xpathNewNodeSet(self):
2302         """Create a new xmlXPathObjectPtr of type NodeSet and
2303            initialize it with the single Node @val """
2304         ret = libxml2mod.xmlXPathNewNodeSet(self._o)
2305         if ret is None:raise xpathError('xmlXPathNewNodeSet() failed')
2306         return xpathObjectRet(ret)
2307
2308     def xpathNewValueTree(self):
2309         """Create a new xmlXPathObjectPtr of type Value Tree (XSLT)
2310            and initialize it with the tree root @val """
2311         ret = libxml2mod.xmlXPathNewValueTree(self._o)
2312         if ret is None:raise xpathError('xmlXPathNewValueTree() failed')
2313         return xpathObjectRet(ret)
2314
2315     def xpathNextAncestor(self, ctxt):
2316         """Traversal function for the "ancestor" direction the
2317            ancestor axis contains the ancestors of the context node;
2318            the ancestors of the context node consist of the parent of
2319            context node and the parent's parent and so on; the nodes
2320            are ordered in reverse document order; thus the parent is
2321            the first node on the axis, and the parent's parent is the
2322            second node on the axis """
2323         if ctxt is None: ctxt__o = None
2324         else: ctxt__o = ctxt._o
2325         ret = libxml2mod.xmlXPathNextAncestor(ctxt__o, self._o)
2326         if ret is None:raise xpathError('xmlXPathNextAncestor() failed')
2327         __tmp = xmlNode(_obj=ret)
2328         return __tmp
2329
2330     def xpathNextAncestorOrSelf(self, ctxt):
2331         """Traversal function for the "ancestor-or-self" direction he
2332            ancestor-or-self axis contains the context node and
2333            ancestors of the context node in reverse document order;
2334            thus the context node is the first node on the axis, and
2335            the context node's parent the second; parent here is
2336            defined the same as with the parent axis. """
2337         if ctxt is None: ctxt__o = None
2338         else: ctxt__o = ctxt._o
2339         ret = libxml2mod.xmlXPathNextAncestorOrSelf(ctxt__o, self._o)
2340         if ret is None:raise xpathError('xmlXPathNextAncestorOrSelf() failed')
2341         __tmp = xmlNode(_obj=ret)
2342         return __tmp
2343
2344     def xpathNextAttribute(self, ctxt):
2345         """Traversal function for the "attribute" direction TODO:
2346            support DTD inherited default attributes """
2347         if ctxt is None: ctxt__o = None
2348         else: ctxt__o = ctxt._o
2349         ret = libxml2mod.xmlXPathNextAttribute(ctxt__o, self._o)
2350         if ret is None:raise xpathError('xmlXPathNextAttribute() failed')
2351         __tmp = xmlNode(_obj=ret)
2352         return __tmp
2353
2354     def xpathNextChild(self, ctxt):
2355         """Traversal function for the "child" direction The child axis
2356            contains the children of the context node in document
2357            order. """
2358         if ctxt is None: ctxt__o = None
2359         else: ctxt__o = ctxt._o
2360         ret = libxml2mod.xmlXPathNextChild(ctxt__o, self._o)
2361         if ret is None:raise xpathError('xmlXPathNextChild() failed')
2362         __tmp = xmlNode(_obj=ret)
2363         return __tmp
2364
2365     def xpathNextDescendant(self, ctxt):
2366         """Traversal function for the "descendant" direction the
2367            descendant axis contains the descendants of the context
2368            node in document order; a descendant is a child or a child
2369            of a child and so on. """
2370         if ctxt is None: ctxt__o = None
2371         else: ctxt__o = ctxt._o
2372         ret = libxml2mod.xmlXPathNextDescendant(ctxt__o, self._o)
2373         if ret is None:raise xpathError('xmlXPathNextDescendant() failed')
2374         __tmp = xmlNode(_obj=ret)
2375         return __tmp
2376
2377     def xpathNextDescendantOrSelf(self, ctxt):
2378         """Traversal function for the "descendant-or-self" direction
2379            the descendant-or-self axis contains the context node and
2380            the descendants of the context node in document order;
2381            thus the context node is the first node on the axis, and
2382            the first child of the context node is the second node on
2383            the axis """
2384         if ctxt is None: ctxt__o = None
2385         else: ctxt__o = ctxt._o
2386         ret = libxml2mod.xmlXPathNextDescendantOrSelf(ctxt__o, self._o)
2387         if ret is None:raise xpathError('xmlXPathNextDescendantOrSelf() failed')
2388         __tmp = xmlNode(_obj=ret)
2389         return __tmp
2390
2391     def xpathNextFollowing(self, ctxt):
2392         """Traversal function for the "following" direction The
2393            following axis contains all nodes in the same document as
2394            the context node that are after the context node in
2395            document order, excluding any descendants and excluding
2396            attribute nodes and namespace nodes; the nodes are ordered
2397            in document order """
2398         if ctxt is None: ctxt__o = None
2399         else: ctxt__o = ctxt._o
2400         ret = libxml2mod.xmlXPathNextFollowing(ctxt__o, self._o)
2401         if ret is None:raise xpathError('xmlXPathNextFollowing() failed')
2402         __tmp = xmlNode(_obj=ret)
2403         return __tmp
2404
2405     def xpathNextFollowingSibling(self, ctxt):
2406         """Traversal function for the "following-sibling" direction
2407            The following-sibling axis contains the following siblings
2408            of the context node in document order. """
2409         if ctxt is None: ctxt__o = None
2410         else: ctxt__o = ctxt._o
2411         ret = libxml2mod.xmlXPathNextFollowingSibling(ctxt__o, self._o)
2412         if ret is None:raise xpathError('xmlXPathNextFollowingSibling() failed')
2413         __tmp = xmlNode(_obj=ret)
2414         return __tmp
2415
2416     def xpathNextNamespace(self, ctxt):
2417         """Traversal function for the "namespace" direction the
2418            namespace axis contains the namespace nodes of the context
2419            node; the order of nodes on this axis is
2420            implementation-defined; the axis will be empty unless the
2421            context node is an element  We keep the XML namespace node
2422            at the end of the list. """
2423         if ctxt is None: ctxt__o = None
2424         else: ctxt__o = ctxt._o
2425         ret = libxml2mod.xmlXPathNextNamespace(ctxt__o, self._o)
2426         if ret is None:raise xpathError('xmlXPathNextNamespace() failed')
2427         __tmp = xmlNode(_obj=ret)
2428         return __tmp
2429
2430     def xpathNextParent(self, ctxt):
2431         """Traversal function for the "parent" direction The parent
2432            axis contains the parent of the context node, if there is
2433            one. """
2434         if ctxt is None: ctxt__o = None
2435         else: ctxt__o = ctxt._o
2436         ret = libxml2mod.xmlXPathNextParent(ctxt__o, self._o)
2437         if ret is None:raise xpathError('xmlXPathNextParent() failed')
2438         __tmp = xmlNode(_obj=ret)
2439         return __tmp
2440
2441     def xpathNextPreceding(self, ctxt):
2442         """Traversal function for the "preceding" direction the
2443            preceding axis contains all nodes in the same document as
2444            the context node that are before the context node in
2445            document order, excluding any ancestors and excluding
2446            attribute nodes and namespace nodes; the nodes are ordered
2447            in reverse document order """
2448         if ctxt is None: ctxt__o = None
2449         else: ctxt__o = ctxt._o
2450         ret = libxml2mod.xmlXPathNextPreceding(ctxt__o, self._o)
2451         if ret is None:raise xpathError('xmlXPathNextPreceding() failed')
2452         __tmp = xmlNode(_obj=ret)
2453         return __tmp
2454
2455     def xpathNextPrecedingSibling(self, ctxt):
2456         """Traversal function for the "preceding-sibling" direction
2457            The preceding-sibling axis contains the preceding siblings
2458            of the context node in reverse document order; the first
2459            preceding sibling is first on the axis; the sibling
2460            preceding that node is the second on the axis and so on. """
2461         if ctxt is None: ctxt__o = None
2462         else: ctxt__o = ctxt._o
2463         ret = libxml2mod.xmlXPathNextPrecedingSibling(ctxt__o, self._o)
2464         if ret is None:raise xpathError('xmlXPathNextPrecedingSibling() failed')
2465         __tmp = xmlNode(_obj=ret)
2466         return __tmp
2467
2468     def xpathNextSelf(self, ctxt):
2469         """Traversal function for the "self" direction The self axis
2470            contains just the context node itself """
2471         if ctxt is None: ctxt__o = None
2472         else: ctxt__o = ctxt._o
2473         ret = libxml2mod.xmlXPathNextSelf(ctxt__o, self._o)
2474         if ret is None:raise xpathError('xmlXPathNextSelf() failed')
2475         __tmp = xmlNode(_obj=ret)
2476         return __tmp
2477
2478     #
2479     # xmlNode functions from module xpointer
2480     #
2481
2482     def xpointerNewCollapsedRange(self):
2483         """Create a new xmlXPathObjectPtr of type range using a single
2484            nodes """
2485         ret = libxml2mod.xmlXPtrNewCollapsedRange(self._o)
2486         if ret is None:raise treeError('xmlXPtrNewCollapsedRange() failed')
2487         return xpathObjectRet(ret)
2488
2489     def xpointerNewContext(self, doc, origin):
2490         """Create a new XPointer context """
2491         if doc is None: doc__o = None
2492         else: doc__o = doc._o
2493         if origin is None: origin__o = None
2494         else: origin__o = origin._o
2495         ret = libxml2mod.xmlXPtrNewContext(doc__o, self._o, origin__o)
2496         if ret is None:raise treeError('xmlXPtrNewContext() failed')
2497         __tmp = xpathContext(_obj=ret)
2498         return __tmp
2499
2500     def xpointerNewLocationSetNodes(self, end):
2501         """Create a new xmlXPathObjectPtr of type LocationSet and
2502            initialize it with the single range made of the two nodes
2503            @start and @end """
2504         if end is None: end__o = None
2505         else: end__o = end._o
2506         ret = libxml2mod.xmlXPtrNewLocationSetNodes(self._o, end__o)
2507         if ret is None:raise treeError('xmlXPtrNewLocationSetNodes() failed')
2508         return xpathObjectRet(ret)
2509
2510     def xpointerNewRange(self, startindex, end, endindex):
2511         """Create a new xmlXPathObjectPtr of type range """
2512         if end is None: end__o = None
2513         else: end__o = end._o
2514         ret = libxml2mod.xmlXPtrNewRange(self._o, startindex, end__o, endindex)
2515         if ret is None:raise treeError('xmlXPtrNewRange() failed')
2516         return xpathObjectRet(ret)
2517
2518     def xpointerNewRangeNodes(self, end):
2519         """Create a new xmlXPathObjectPtr of type range using 2 nodes """
2520         if end is None: end__o = None
2521         else: end__o = end._o
2522         ret = libxml2mod.xmlXPtrNewRangeNodes(self._o, end__o)
2523         if ret is None:raise treeError('xmlXPtrNewRangeNodes() failed')
2524         return xpathObjectRet(ret)
2525
2526 class xmlDoc(xmlNode):
2527     def __init__(self, _obj=None):
2528         self._o = None
2529         xmlNode.__init__(self, _obj=_obj)
2530
2531     def __repr__(self):
2532         return "<xmlDoc (%s) object at 0x%x>" % (self.name, id (self))
2533
2534     #
2535     # xmlDoc functions from module HTMLparser
2536     #
2537
2538     def htmlAutoCloseTag(self, name, elem):
2539         """The HTML DTD allows a tag to implicitly close other tags.
2540            The list is kept in htmlStartClose array. This function
2541            checks if the element or one of it's children would
2542            autoclose the given tag. """
2543         ret = libxml2mod.htmlAutoCloseTag(self._o, name, elem)
2544         return ret
2545
2546     def htmlIsAutoClosed(self, elem):
2547         """The HTML DTD allows a tag to implicitly close other tags.
2548            The list is kept in htmlStartClose array. This function
2549            checks if a tag is autoclosed by one of it's child """
2550         ret = libxml2mod.htmlIsAutoClosed(self._o, elem)
2551         return ret
2552
2553     #
2554     # xmlDoc functions from module HTMLtree
2555     #
2556
2557     def htmlDocContentDumpFormatOutput(self, buf, encoding, format):
2558         """Dump an HTML document. """
2559         if buf is None: buf__o = None
2560         else: buf__o = buf._o
2561         libxml2mod.htmlDocContentDumpFormatOutput(buf__o, self._o, encoding, format)
2562
2563     def htmlDocContentDumpOutput(self, buf, encoding):
2564         """Dump an HTML document. Formating return/spaces are added. """
2565         if buf is None: buf__o = None
2566         else: buf__o = buf._o
2567         libxml2mod.htmlDocContentDumpOutput(buf__o, self._o, encoding)
2568
2569     def htmlDocDump(self, f):
2570         """Dump an HTML document to an open FILE. """
2571         ret = libxml2mod.htmlDocDump(f, self._o)
2572         return ret
2573
2574     def htmlGetMetaEncoding(self):
2575         """Encoding definition lookup in the Meta tags """
2576         ret = libxml2mod.htmlGetMetaEncoding(self._o)
2577         return ret
2578
2579     def htmlNodeDumpFile(self, out, cur):
2580         """Dump an HTML node, recursive behaviour,children are printed
2581            too, and formatting returns are added. """
2582         if cur is None: cur__o = None
2583         else: cur__o = cur._o
2584         libxml2mod.htmlNodeDumpFile(out, self._o, cur__o)
2585
2586     def htmlNodeDumpFileFormat(self, out, cur, encoding, format):
2587         """Dump an HTML node, recursive behaviour,children are printed
2588            too.  TODO: if encoding == None try to save in the doc
2589            encoding """
2590         if cur is None: cur__o = None
2591         else: cur__o = cur._o
2592         ret = libxml2mod.htmlNodeDumpFileFormat(out, self._o, cur__o, encoding, format)
2593         return ret
2594
2595     def htmlNodeDumpFormatOutput(self, buf, cur, encoding, format):
2596         """Dump an HTML node, recursive behaviour,children are printed
2597            too. """
2598         if buf is None: buf__o = None
2599         else: buf__o = buf._o
2600         if cur is None: cur__o = None
2601         else: cur__o = cur._o
2602         libxml2mod.htmlNodeDumpFormatOutput(buf__o, self._o, cur__o, encoding, format)
2603
2604     def htmlNodeDumpOutput(self, buf, cur, encoding):
2605         """Dump an HTML node, recursive behaviour,children are printed
2606            too, and formatting returns/spaces are added. """
2607         if buf is None: buf__o = None
2608         else: buf__o = buf._o
2609         if cur is None: cur__o = None
2610         else: cur__o = cur._o
2611         libxml2mod.htmlNodeDumpOutput(buf__o, self._o, cur__o, encoding)
2612
2613     def htmlSaveFile(self, filename):
2614         """Dump an HTML document to a file. If @filename is "-" the
2615            stdout file is used. """
2616         ret = libxml2mod.htmlSaveFile(filename, self._o)
2617         return ret
2618
2619     def htmlSaveFileEnc(self, filename, encoding):
2620         """Dump an HTML document to a file using a given encoding and
2621            formatting returns/spaces are added. """
2622         ret = libxml2mod.htmlSaveFileEnc(filename, self._o, encoding)
2623         return ret
2624
2625     def htmlSaveFileFormat(self, filename, encoding, format):
2626         """Dump an HTML document to a file using a given encoding. """
2627         ret = libxml2mod.htmlSaveFileFormat(filename, self._o, encoding, format)
2628         return ret
2629
2630     def htmlSetMetaEncoding(self, encoding):
2631         """Sets the current encoding in the Meta tags NOTE: this will
2632            not change the document content encoding, just the META
2633            flag associated. """
2634         ret = libxml2mod.htmlSetMetaEncoding(self._o, encoding)
2635         return ret
2636
2637     #
2638     # xmlDoc functions from module debugXML
2639     #
2640
2641     def debugDumpDocument(self, output):
2642         """Dumps debug information for the document, it's recursive """
2643         libxml2mod.xmlDebugDumpDocument(output, self._o)
2644
2645     def debugDumpDocumentHead(self, output):
2646         """Dumps debug information cncerning the document, not
2647            recursive """
2648         libxml2mod.xmlDebugDumpDocumentHead(output, self._o)
2649
2650     def debugDumpEntities(self, output):
2651         """Dumps debug information for all the entities in use by the
2652            document """
2653         libxml2mod.xmlDebugDumpEntities(output, self._o)
2654
2655     #
2656     # xmlDoc functions from module entities
2657     #
2658
2659     def addDocEntity(self, name, type, ExternalID, SystemID, content):
2660         """Register a new entity for this document. """
2661         ret = libxml2mod.xmlAddDocEntity(self._o, name, type, ExternalID, SystemID, content)
2662         if ret is None:raise treeError('xmlAddDocEntity() failed')
2663         __tmp = xmlEntity(_obj=ret)
2664         return __tmp
2665
2666     def addDtdEntity(self, name, type, ExternalID, SystemID, content):
2667         """Register a new entity for this document DTD external subset. """
2668         ret = libxml2mod.xmlAddDtdEntity(self._o, name, type, ExternalID, SystemID, content)
2669         if ret is None:raise treeError('xmlAddDtdEntity() failed')
2670         __tmp = xmlEntity(_obj=ret)
2671         return __tmp
2672
2673     def docEntity(self, name):
2674         """Do an entity lookup in the document entity hash table and """
2675         ret = libxml2mod.xmlGetDocEntity(self._o, name)
2676         if ret is None:raise treeError('xmlGetDocEntity() failed')
2677         __tmp = xmlEntity(_obj=ret)
2678         return __tmp
2679
2680     def dtdEntity(self, name):
2681         """Do an entity lookup in the DTD entity hash table and """
2682         ret = libxml2mod.xmlGetDtdEntity(self._o, name)
2683         if ret is None:raise treeError('xmlGetDtdEntity() failed')
2684         __tmp = xmlEntity(_obj=ret)
2685         return __tmp
2686
2687     def encodeEntities(self, input):
2688         """Do a global encoding of a string, replacing the predefined
2689            entities and non ASCII values with their entities and
2690            CharRef counterparts.  TODO: remove xmlEncodeEntities,
2691            once we are not afraid of breaking binary compatibility 
2692            People must migrate their code to
2693            xmlEncodeEntitiesReentrant ! This routine will issue a
2694            warning when encountered. """
2695         ret = libxml2mod.xmlEncodeEntities(self._o, input)
2696         return ret
2697
2698     def encodeEntitiesReentrant(self, input):
2699         """Do a global encoding of a string, replacing the predefined
2700            entities and non ASCII values with their entities and
2701            CharRef counterparts. Contrary to xmlEncodeEntities, this
2702            routine is reentrant, and result must be deallocated. """
2703         ret = libxml2mod.xmlEncodeEntitiesReentrant(self._o, input)
2704         return ret
2705
2706     def encodeSpecialChars(self, input):
2707         """Do a global encoding of a string, replacing the predefined
2708            entities this routine is reentrant, and result must be
2709            deallocated. """
2710         ret = libxml2mod.xmlEncodeSpecialChars(self._o, input)
2711         return ret
2712
2713     def parameterEntity(self, name):
2714         """Do an entity lookup in the internal and external subsets and """
2715         ret = libxml2mod.xmlGetParameterEntity(self._o, name)
2716         if ret is None:raise treeError('xmlGetParameterEntity() failed')
2717         __tmp = xmlEntity(_obj=ret)
2718         return __tmp
2719
2720     #
2721     # xmlDoc functions from module relaxng
2722     #
2723
2724     def relaxNGValidateDoc(self, ctxt):
2725         """Validate a document tree in memory. """
2726         if ctxt is None: ctxt__o = None
2727         else: ctxt__o = ctxt._o
2728         ret = libxml2mod.xmlRelaxNGValidateDoc(ctxt__o, self._o)
2729         return ret
2730
2731     #
2732     # xmlDoc functions from module tree
2733     #
2734
2735     def copyDoc(self, recursive):
2736         """Do a copy of the document info. If recursive, the content
2737            tree will be copied too as well as DTD, namespaces and
2738            entities. """
2739         ret = libxml2mod.xmlCopyDoc(self._o, recursive)
2740         if ret is None:raise treeError('xmlCopyDoc() failed')
2741         __tmp = xmlDoc(_obj=ret)
2742         return __tmp
2743
2744     def createIntSubset(self, name, ExternalID, SystemID):
2745         """Create the internal subset of a document """
2746         ret = libxml2mod.xmlCreateIntSubset(self._o, name, ExternalID, SystemID)
2747         if ret is None:raise treeError('xmlCreateIntSubset() failed')
2748         __tmp = xmlDtd(_obj=ret)
2749         return __tmp
2750
2751     def docCompressMode(self):
2752         """get the compression ratio for a document, ZLIB based """
2753         ret = libxml2mod.xmlGetDocCompressMode(self._o)
2754         return ret
2755
2756     def dump(self, f):
2757         """Dump an XML document to an open FILE. """
2758         ret = libxml2mod.xmlDocDump(f, self._o)
2759         return ret
2760
2761     def elemDump(self, f, cur):
2762         """Dump an XML/HTML node, recursive behaviour, children are
2763            printed too. """
2764         if cur is None: cur__o = None
2765         else: cur__o = cur._o
2766         libxml2mod.xmlElemDump(f, self._o, cur__o)
2767
2768     def formatDump(self, f, format):
2769         """Dump an XML document to an open FILE. """
2770         ret = libxml2mod.xmlDocFormatDump(f, self._o, format)
2771         return ret
2772
2773     def freeDoc(self):
2774         """Free up all the structures used by a document, tree
2775            included. """
2776         libxml2mod.xmlFreeDoc(self._o)
2777
2778     def getRootElement(self):
2779         """Get the root element of the document (doc->children is a
2780            list containing possibly comments, PIs, etc ...). """
2781         ret = libxml2mod.xmlDocGetRootElement(self._o)
2782         if ret is None:raise treeError('xmlDocGetRootElement() failed')
2783         __tmp = xmlNode(_obj=ret)
2784         return __tmp
2785
2786     def intSubset(self):
2787         """Get the internal subset of a document """
2788         ret = libxml2mod.xmlGetIntSubset(self._o)
2789         if ret is None:raise treeError('xmlGetIntSubset() failed')
2790         __tmp = xmlDtd(_obj=ret)
2791         return __tmp
2792
2793     def newCDataBlock(self, content, len):
2794         """Creation of a new node containing a CDATA block. """
2795         ret = libxml2mod.xmlNewCDataBlock(self._o, content, len)
2796         if ret is None:raise treeError('xmlNewCDataBlock() failed')
2797         __tmp = xmlNode(_obj=ret)
2798         return __tmp
2799
2800     def newCharRef(self, name):
2801         """Creation of a new character reference node. """
2802         ret = libxml2mod.xmlNewCharRef(self._o, name)
2803         if ret is None:raise treeError('xmlNewCharRef() failed')
2804         __tmp = xmlNode(_obj=ret)
2805         return __tmp
2806
2807     def newDocComment(self, content):
2808         """Creation of a new node containing a comment within a
2809            document. """
2810         ret = libxml2mod.xmlNewDocComment(self._o, content)
2811         if ret is None:raise treeError('xmlNewDocComment() failed')
2812         __tmp = xmlNode(_obj=ret)
2813         return __tmp
2814
2815     def newDocFragment(self):
2816         """Creation of a new Fragment node. """
2817         ret = libxml2mod.xmlNewDocFragment(self._o)
2818         if ret is None:raise treeError('xmlNewDocFragment() failed')
2819         __tmp = xmlNode(_obj=ret)
2820         return __tmp
2821
2822     def newDocNode(self, ns, name, content):
2823         """Creation of a new node element within a document. @ns and
2824            @content are optional (None). NOTE: @content is supposed
2825            to be a piece of XML CDATA, so it allow entities
2826            references, but XML special chars need to be escaped first
2827            by using xmlEncodeEntitiesReentrant(). Use
2828            xmlNewDocRawNode() if you don't need entities support. """
2829         if ns is None: ns__o = None
2830         else: ns__o = ns._o
2831         ret = libxml2mod.xmlNewDocNode(self._o, ns__o, name, content)
2832         if ret is None:raise treeError('xmlNewDocNode() failed')
2833         __tmp = xmlNode(_obj=ret)
2834         return __tmp
2835
2836     def newDocNodeEatName(self, ns, name, content):
2837         """Creation of a new node element within a document. @ns and
2838            @content are optional (None). NOTE: @content is supposed
2839            to be a piece of XML CDATA, so it allow entities
2840            references, but XML special chars need to be escaped first
2841            by using xmlEncodeEntitiesReentrant(). Use
2842            xmlNewDocRawNode() if you don't need entities support. """
2843         if ns is None: ns__o = None
2844         else: ns__o = ns._o
2845         ret = libxml2mod.xmlNewDocNodeEatName(self._o, ns__o, name, content)
2846         if ret is None:raise treeError('xmlNewDocNodeEatName() failed')
2847         __tmp = xmlNode(_obj=ret)
2848         return __tmp
2849
2850     def newDocProp(self, name, value):
2851         """Create a new property carried by a document. """
2852         ret = libxml2mod.xmlNewDocProp(self._o, name, value)
2853         if ret is None:raise treeError('xmlNewDocProp() failed')
2854         __tmp = xmlAttr(_obj=ret)
2855         return __tmp
2856
2857     def newDocRawNode(self, ns, name, content):
2858         """Creation of a new node element within a document. @ns and
2859            @content are optional (None). """
2860         if ns is None: ns__o = None
2861         else: ns__o = ns._o
2862         ret = libxml2mod.xmlNewDocRawNode(self._o, ns__o, name, content)
2863         if ret is None:raise treeError('xmlNewDocRawNode() failed')
2864         __tmp = xmlNode(_obj=ret)
2865         return __tmp
2866
2867     def newDocText(self, content):
2868         """Creation of a new text node within a document. """
2869         ret = libxml2mod.xmlNewDocText(self._o, content)
2870         if ret is None:raise treeError('xmlNewDocText() failed')
2871         __tmp = xmlNode(_obj=ret)
2872         return __tmp
2873
2874     def newDocTextLen(self, content, len):
2875         """Creation of a new text node with an extra content length
2876            parameter. The text node pertain to a given document. """
2877         ret = libxml2mod.xmlNewDocTextLen(self._o, content, len)
2878         if ret is None:raise treeError('xmlNewDocTextLen() failed')
2879         __tmp = xmlNode(_obj=ret)
2880         return __tmp
2881
2882     def newDtd(self, name, ExternalID, SystemID):
2883         """Creation of a new DTD for the external subset. To create an
2884            internal subset, use xmlCreateIntSubset(). """
2885         ret = libxml2mod.xmlNewDtd(self._o, name, ExternalID, SystemID)
2886         if ret is None:raise treeError('xmlNewDtd() failed')
2887         __tmp = xmlDtd(_obj=ret)
2888         return __tmp
2889
2890     def newGlobalNs(self, href, prefix):
2891         """Creation of a Namespace, the old way using PI and without
2892            scoping DEPRECATED !!! It now create a namespace on the
2893            root element of the document if found. """
2894         ret = libxml2mod.xmlNewGlobalNs(self._o, href, prefix)
2895         if ret is None:raise treeError('xmlNewGlobalNs() failed')
2896         __tmp = xmlNs(_obj=ret)
2897         return __tmp
2898
2899     def newReference(self, name):
2900         """Creation of a new reference node. """
2901         ret = libxml2mod.xmlNewReference(self._o, name)
2902         if ret is None:raise treeError('xmlNewReference() failed')
2903         __tmp = xmlNode(_obj=ret)
2904         return __tmp
2905
2906     def nodeDumpOutput(self, buf, cur, level, format, encoding):
2907         """Dump an XML node, recursive behaviour, children are printed
2908            too. Note that @format = 1 provide node indenting only if
2909            xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was
2910            called """
2911         if buf is None: buf__o = None
2912         else: buf__o = buf._o
2913         if cur is None: cur__o = None
2914         else: cur__o = cur._o
2915         libxml2mod.xmlNodeDumpOutput(buf__o, self._o, cur__o, level, format, encoding)
2916
2917     def saveFile(self, filename):
2918         """Dump an XML document to a file. Will use compression if
2919            compiled in and enabled. If @filename is "-" the stdout
2920            file is used. """
2921         ret = libxml2mod.xmlSaveFile(filename, self._o)
2922         return ret
2923
2924     def saveFileEnc(self, filename, encoding):
2925         """Dump an XML document, converting it to the given encoding """
2926         ret = libxml2mod.xmlSaveFileEnc(filename, self._o, encoding)
2927         return ret
2928
2929     def saveFileTo(self, buf, encoding):
2930         """Dump an XML document to an I/O buffer. """
2931         if buf is None: buf__o = None
2932         else: buf__o = buf._o
2933         ret = libxml2mod.xmlSaveFileTo(buf__o, self._o, encoding)
2934         return ret
2935
2936     def saveFormatFile(self, filename, format):
2937         """Dump an XML document to a file. Will use compression if
2938            compiled in and enabled. If @filename is "-" the stdout
2939            file is used. If @format is set then the document will be
2940            indented on output. Note that @format = 1 provide node
2941            indenting only if xmlIndentTreeOutput = 1 or
2942            xmlKeepBlanksDefault(0) was called """
2943         ret = libxml2mod.xmlSaveFormatFile(filename, self._o, format)
2944         return ret
2945
2946     def saveFormatFileEnc(self, filename, encoding, format):
2947         """Dump an XML document to a file or an URL. """
2948         ret = libxml2mod.xmlSaveFormatFileEnc(filename, self._o, encoding, format)
2949         return ret
2950
2951     def saveFormatFileTo(self, buf, encoding, format):
2952         """Dump an XML document to an I/O buffer. """
2953         if buf is None: buf__o = None
2954         else: buf__o = buf._o
2955         ret = libxml2mod.xmlSaveFormatFileTo(buf__o, self._o, encoding, format)
2956         return ret
2957
2958     def setDocCompressMode(self, mode):
2959         """set the compression ratio for a document, ZLIB based
2960            Correct values: 0 (uncompressed) to 9 (max compression) """
2961         libxml2mod.xmlSetDocCompressMode(self._o, mode)
2962
2963     def stringGetNodeList(self, value):
2964         """Parse the value string and build the node list associated.
2965            Should produce a flat tree with only TEXTs and ENTITY_REFs. """
2966         ret = libxml2mod.xmlStringGetNodeList(self._o, value)
2967         if ret is None:raise treeError('xmlStringGetNodeList() failed')
2968         __tmp = xmlNode(_obj=ret)
2969         return __tmp
2970
2971     def stringLenGetNodeList(self, value, len):
2972         """Parse the value string and build the node list associated.
2973            Should produce a flat tree with only TEXTs and ENTITY_REFs. """
2974         ret = libxml2mod.xmlStringLenGetNodeList(self._o, value, len)
2975         if ret is None:raise treeError('xmlStringLenGetNodeList() failed')
2976         __tmp = xmlNode(_obj=ret)
2977         return __tmp
2978
2979     #
2980     # xmlDoc functions from module valid
2981     #
2982
2983     def ID(self, ID):
2984         """Search the attribute declaring the given ID """
2985         ret = libxml2mod.xmlGetID(self._o, ID)
2986         if ret is None:raise treeError('xmlGetID() failed')
2987         __tmp = xmlAttr(_obj=ret)
2988         return __tmp
2989
2990     def isMixedElement(self, name):
2991         """Search in the DtDs whether an element accept Mixed content
2992            (or ANY) basically if it is supposed to accept text childs """
2993         ret = libxml2mod.xmlIsMixedElement(self._o, name)
2994         return ret
2995
2996     def removeID(self, attr):
2997         """Remove the given attribute from the ID table maintained
2998            internally. """
2999         if attr is None: attr__o = None
3000         else: attr__o = attr._o
3001         ret = libxml2mod.xmlRemoveID(self._o, attr__o)
3002         return ret
3003
3004     def removeRef(self, attr):
3005         """Remove the given attribute from the Ref table maintained
3006            internally. """
3007         if attr is None: attr__o = None
3008         else: attr__o = attr._o
3009         ret = libxml2mod.xmlRemoveRef(self._o, attr__o)
3010         return ret
3011
3012     #
3013     # xmlDoc functions from module xinclude
3014     #
3015
3016     def xincludeProcess(self):
3017         """Implement the XInclude substitution on the XML document @doc """
3018         ret = libxml2mod.xmlXIncludeProcess(self._o)
3019         return ret
3020
3021     #
3022     # xmlDoc functions from module xpath
3023     #
3024
3025     def xpathNewContext(self):
3026         """Create a new xmlXPathContext """
3027         ret = libxml2mod.xmlXPathNewContext(self._o)
3028         if ret is None:raise xpathError('xmlXPathNewContext() failed')
3029         __tmp = xpathContext(_obj=ret)
3030         return __tmp
3031
3032 class xpathContext:
3033     def __init__(self, _obj=None):
3034         if _obj != None:self._o = _obj;return
3035         self._o = None
3036
3037     # accessors for xpathContext
3038     def contextDoc(self):
3039         """Get the doc from an xpathContext """
3040         ret = libxml2mod.xmlXPathGetContextDoc(self._o)
3041         if ret is None:raise xpathError('xmlXPathGetContextDoc() failed')
3042         __tmp = xmlDoc(_obj=ret)
3043         return __tmp
3044
3045     def contextNode(self):
3046         """Get the current node from an xpathContext """
3047         ret = libxml2mod.xmlXPathGetContextNode(self._o)
3048         if ret is None:raise xpathError('xmlXPathGetContextNode() failed')
3049         __tmp = xmlNode(_obj=ret)
3050         return __tmp
3051
3052     def contextPosition(self):
3053         """Get the current node from an xpathContext """
3054         ret = libxml2mod.xmlXPathGetContextPosition(self._o)
3055         return ret
3056
3057     def contextSize(self):
3058         """Get the current node from an xpathContext """
3059         ret = libxml2mod.xmlXPathGetContextSize(self._o)
3060         return ret
3061
3062     def function(self):
3063         """Get the current function name xpathContext """
3064         ret = libxml2mod.xmlXPathGetFunction(self._o)
3065         return ret
3066
3067     def functionURI(self):
3068         """Get the current function name URI xpathContext """
3069         ret = libxml2mod.xmlXPathGetFunctionURI(self._o)
3070         return ret
3071
3072     def setContextDoc(self, doc):
3073         """Set the doc of an xpathContext """
3074         if doc is None: doc__o = None
3075         else: doc__o = doc._o
3076         libxml2mod.xmlXPathSetContextDoc(self._o, doc__o)
3077
3078     def setContextNode(self, node):
3079         """Set the current node of an xpathContext """
3080         if node is None: node__o = None
3081         else: node__o = node._o
3082         libxml2mod.xmlXPathSetContextNode(self._o, node__o)
3083
3084     #
3085     # xpathContext functions from module python
3086     #
3087
3088     def registerXPathFunction(self, name, ns_uri, f):
3089         """Register a Python written function to the XPath interpreter """
3090         ret = libxml2mod.xmlRegisterXPathFunction(self._o, name, ns_uri, f)
3091         return ret
3092
3093     #
3094     # xpathContext functions from module xpath
3095     #
3096
3097     def xpathEval(self, str):
3098         """Evaluate the XPath Location Path in the given context. """
3099         ret = libxml2mod.xmlXPathEval(str, self._o)
3100         if ret is None:raise xpathError('xmlXPathEval() failed')
3101         return xpathObjectRet(ret)
3102
3103     def xpathEvalExpression(self, str):
3104         """Evaluate the XPath expression in the given context. """
3105         ret = libxml2mod.xmlXPathEvalExpression(str, self._o)
3106         if ret is None:raise xpathError('xmlXPathEvalExpression() failed')
3107         return xpathObjectRet(ret)
3108
3109     def xpathFreeContext(self):
3110         """Free up an xmlXPathContext """
3111         libxml2mod.xmlXPathFreeContext(self._o)
3112
3113     #
3114     # xpathContext functions from module xpathInternals
3115     #
3116
3117     def xpathNewParserContext(self, str):
3118         """Create a new xmlXPathParserContext """
3119         ret = libxml2mod.xmlXPathNewParserContext(str, self._o)
3120         if ret is None:raise xpathError('xmlXPathNewParserContext() failed')
3121         __tmp = xpathParserContext(_obj=ret)
3122         return __tmp
3123
3124     def xpathNsLookup(self, prefix):
3125         """Search in the namespace declaration array of the context
3126            for the given namespace name associated to the given prefix """
3127         ret = libxml2mod.xmlXPathNsLookup(self._o, prefix)
3128         return ret
3129
3130     def xpathRegisterAllFunctions(self):
3131         """Registers all default XPath functions in this context """
3132         libxml2mod.xmlXPathRegisterAllFunctions(self._o)
3133
3134     def xpathRegisterNs(self, prefix, ns_uri):
3135         """Register a new namespace. If @ns_uri is None it unregisters
3136            the namespace """
3137         ret = libxml2mod.xmlXPathRegisterNs(self._o, prefix, ns_uri)
3138         return ret
3139
3140     def xpathRegisteredFuncsCleanup(self):
3141         """Cleanup the XPath context data associated to registered
3142            functions """
3143         libxml2mod.xmlXPathRegisteredFuncsCleanup(self._o)
3144
3145     def xpathRegisteredNsCleanup(self):
3146         """Cleanup the XPath context data associated to registered
3147            variables """
3148         libxml2mod.xmlXPathRegisteredNsCleanup(self._o)
3149
3150     def xpathRegisteredVariablesCleanup(self):
3151         """Cleanup the XPath context data associated to registered
3152            variables """
3153         libxml2mod.xmlXPathRegisteredVariablesCleanup(self._o)
3154
3155     def xpathVariableLookup(self, name):
3156         """Search in the Variable array of the context for the given
3157            variable value. """
3158         ret = libxml2mod.xmlXPathVariableLookup(self._o, name)
3159         if ret is None:raise xpathError('xmlXPathVariableLookup() failed')
3160         return xpathObjectRet(ret)
3161
3162     def xpathVariableLookupNS(self, name, ns_uri):
3163         """Search in the Variable array of the context for the given
3164            variable value. """
3165         ret = libxml2mod.xmlXPathVariableLookupNS(self._o, name, ns_uri)
3166         if ret is None:raise xpathError('xmlXPathVariableLookupNS() failed')
3167         return xpathObjectRet(ret)
3168
3169     #
3170     # xpathContext functions from module xpointer
3171     #
3172
3173     def xpointerEval(self, str):
3174         """Evaluate the XPath Location Path in the given context. """
3175         ret = libxml2mod.xmlXPtrEval(str, self._o)
3176         if ret is None:raise treeError('xmlXPtrEval() failed')
3177         return xpathObjectRet(ret)
3178
3179 class xmlAttribute(xmlNode):
3180     def __init__(self, _obj=None):
3181         self._o = None
3182         xmlNode.__init__(self, _obj=_obj)
3183
3184     def __repr__(self):
3185         return "<xmlAttribute (%s) object at 0x%x>" % (self.name, id (self))
3186
3187 class catalog:
3188     def __init__(self, _obj=None):
3189         if _obj != None:self._o = _obj;return
3190         self._o = None
3191
3192     def __del__(self):
3193         if self._o != None:
3194             libxml2mod.xmlFreeCatalog(self._o)
3195         self._o = None
3196
3197     #
3198     # catalog functions from module catalog
3199     #
3200
3201     def add(self, type, orig, replace):
3202         """Add an entry in the catalog, it may overwrite existing but
3203            different entries. """
3204         ret = libxml2mod.xmlACatalogAdd(self._o, type, orig, replace)
3205         return ret
3206
3207     def catalogIsEmpty(self):
3208         """Check is a catalog is empty """
3209         ret = libxml2mod.xmlCatalogIsEmpty(self._o)
3210         return ret
3211
3212     def convertSGMLCatalog(self):
3213         """Convert all the SGML catalog entries as XML ones """
3214         ret = libxml2mod.xmlConvertSGMLCatalog(self._o)
3215         return ret
3216
3217     def dump(self, out):
3218         """Free up all the memory associated with catalogs """
3219         libxml2mod.xmlACatalogDump(self._o, out)
3220
3221     def freeCatalog(self):
3222         """Free the memory allocated to a Catalog """
3223         libxml2mod.xmlFreeCatalog(self._o)
3224
3225     def remove(self, value):
3226         """Remove an entry from the catalog """
3227         ret = libxml2mod.xmlACatalogRemove(self._o, value)
3228         return ret
3229
3230     def resolve(self, pubID, sysID):
3231         """Do a complete resolution lookup of an External Identifier """
3232         ret = libxml2mod.xmlACatalogResolve(self._o, pubID, sysID)
3233         return ret
3234
3235     def resolvePublic(self, pubID):
3236         """Try to lookup the system ID associated to a public ID in
3237            that catalog """
3238         ret = libxml2mod.xmlACatalogResolvePublic(self._o, pubID)
3239         return ret
3240
3241     def resolveSystem(self, sysID):
3242         """Try to lookup the catalog resource for a system ID """
3243         ret = libxml2mod.xmlACatalogResolveSystem(self._o, sysID)
3244         return ret
3245
3246     def resolveURI(self, URI):
3247         """Do a complete resolution lookup of an URI """
3248         ret = libxml2mod.xmlACatalogResolveURI(self._o, URI)
3249         return ret
3250
3251 class xmlElement(xmlNode):
3252     def __init__(self, _obj=None):
3253         self._o = None
3254         xmlNode.__init__(self, _obj=_obj)
3255
3256     def __repr__(self):
3257         return "<xmlElement (%s) object at 0x%x>" % (self.name, id (self))
3258
3259 class xmlAttr(xmlNode):
3260     def __init__(self, _obj=None):
3261         self._o = None
3262         xmlNode.__init__(self, _obj=_obj)
3263
3264     def __repr__(self):
3265         return "<xmlAttr (%s) object at 0x%x>" % (self.name, id (self))
3266
3267     #
3268     # xmlAttr functions from module debugXML
3269     #
3270
3271     def debugDumpAttr(self, output, depth):
3272         """Dumps debug information for the attribute """
3273         libxml2mod.xmlDebugDumpAttr(output, self._o, depth)
3274
3275     def debugDumpAttrList(self, output, depth):
3276         """Dumps debug information for the attribute list """
3277         libxml2mod.xmlDebugDumpAttrList(output, self._o, depth)
3278
3279     #
3280     # xmlAttr functions from module tree
3281     #
3282
3283     def freeProp(self):
3284         """Free one attribute, all the content is freed too """
3285         libxml2mod.xmlFreeProp(self._o)
3286
3287     def freePropList(self):
3288         """Free a property and all its siblings, all the children are
3289            freed too. """
3290         libxml2mod.xmlFreePropList(self._o)
3291
3292     def removeProp(self):
3293         """Unlink and free one attribute, all the content is freed too
3294            Note this doesn't work for namespace definition attributes """
3295         ret = libxml2mod.xmlRemoveProp(self._o)
3296         return ret
3297
3298 class xmlTextReader(xmlTextReaderCore):
3299     def __init__(self, _obj=None):
3300         self.input = None
3301         self._o = None
3302         xmlTextReaderCore.__init__(self, _obj=_obj)
3303
3304     def __del__(self):
3305         if self._o != None:
3306             libxml2mod.xmlFreeTextReader(self._o)
3307         self._o = None
3308
3309     #
3310     # xmlTextReader functions from module xmlreader
3311     #
3312
3313     def AttributeCount(self):
3314         """Provides the number of attributes of the current node """
3315         ret = libxml2mod.xmlTextReaderAttributeCount(self._o)
3316         return ret
3317
3318     def BaseUri(self):
3319         """The base URI of the node. """
3320         ret = libxml2mod.xmlTextReaderBaseUri(self._o)
3321         return ret
3322
3323     def Close(self):
3324         """This method releases any resources allocated by the current
3325            instance changes the state to Closed and close any
3326            underlying input. """
3327         ret = libxml2mod.xmlTextReaderClose(self._o)
3328         return ret
3329
3330     def CurrentDoc(self):
3331         """Hacking interface allowing to get the xmlDocPtr
3332            correponding to the current document being accessed by the
3333            xmlTextReader. This is dangerous because the associated
3334            node may be destroyed on the next Reads. """
3335         ret = libxml2mod.xmlTextReaderCurrentDoc(self._o)
3336         if ret is None:raise treeError('xmlTextReaderCurrentDoc() failed')
3337         __tmp = xmlDoc(_obj=ret)
3338         return __tmp
3339
3340     def CurrentNode(self):
3341         """Hacking interface allowing to get the xmlNodePtr
3342            correponding to the current node being accessed by the
3343            xmlTextReader. This is dangerous because the underlying
3344            node may be destroyed on the next Reads. """
3345         ret = libxml2mod.xmlTextReaderCurrentNode(self._o)
3346         if ret is None:raise treeError('xmlTextReaderCurrentNode() failed')
3347         __tmp = xmlNode(_obj=ret)
3348         return __tmp
3349
3350     def Depth(self):
3351         """The depth of the node in the tree. """
3352         ret = libxml2mod.xmlTextReaderDepth(self._o)
3353         return ret
3354
3355     def GetAttribute(self, name):
3356         """Provides the value of the attribute with the specified
3357            qualified name. """
3358         ret = libxml2mod.xmlTextReaderGetAttribute(self._o, name)
3359         return ret
3360
3361     def GetAttributeNo(self, no):
3362         """Provides the value of the attribute with the specified
3363            index relative to the containing element. """
3364         ret = libxml2mod.xmlTextReaderGetAttributeNo(self._o, no)
3365         return ret
3366
3367     def GetAttributeNs(self, localName, namespaceURI):
3368         """Provides the value of the specified attribute """
3369         ret = libxml2mod.xmlTextReaderGetAttributeNs(self._o, localName, namespaceURI)
3370         return ret
3371
3372     def GetParserProp(self, prop):
3373         """Read the parser internal property. """
3374         ret = libxml2mod.xmlTextReaderGetParserProp(self._o, prop)
3375         return ret
3376
3377     def GetRemainder(self):
3378         """Method to get the remainder of the buffered XML. this
3379            method stops the parser, set its state to End Of File and
3380            return the input stream with what is left that the parser
3381            did not use. """
3382         ret = libxml2mod.xmlTextReaderGetRemainder(self._o)
3383         if ret is None:raise treeError('xmlTextReaderGetRemainder() failed')
3384         __tmp = inputBuffer(_obj=ret)
3385         return __tmp
3386
3387     def HasAttributes(self):
3388         """Whether the node has attributes. """
3389         ret = libxml2mod.xmlTextReaderHasAttributes(self._o)
3390         return ret
3391
3392     def HasValue(self):
3393         """Whether the node can have a text value. """
3394         ret = libxml2mod.xmlTextReaderHasValue(self._o)
3395         return ret
3396
3397     def IsDefault(self):
3398         """Whether an Attribute  node was generated from the default
3399            value defined in the DTD or schema. """
3400         ret = libxml2mod.xmlTextReaderIsDefault(self._o)
3401         return ret
3402
3403     def IsEmptyElement(self):
3404         """Check if the current node is empty """
3405         ret = libxml2mod.xmlTextReaderIsEmptyElement(self._o)
3406         return ret
3407
3408     def LocalName(self):
3409         """The local name of the node. """
3410         ret = libxml2mod.xmlTextReaderLocalName(self._o)
3411         return ret
3412
3413     def LookupNamespace(self, prefix):
3414         """Resolves a namespace prefix in the scope of the current
3415            element. """
3416         ret = libxml2mod.xmlTextReaderLookupNamespace(self._o, prefix)
3417         return ret
3418
3419     def MoveToAttribute(self, name):
3420         """Moves the position of the current instance to the attribute
3421            with the specified qualified name. """
3422         ret = libxml2mod.xmlTextReaderMoveToAttribute(self._o, name)
3423         return ret
3424
3425     def MoveToAttributeNo(self, no):
3426         """Moves the position of the current instance to the attribute
3427            with the specified index relative to the containing
3428            element. """
3429         ret = libxml2mod.xmlTextReaderMoveToAttributeNo(self._o, no)
3430         return ret
3431
3432     def MoveToAttributeNs(self, localName, namespaceURI):
3433         """Moves the position of the current instance to the attribute
3434            with the specified local name and namespace URI. """
3435         ret = libxml2mod.xmlTextReaderMoveToAttributeNs(self._o, localName, namespaceURI)
3436         return ret
3437
3438     def MoveToElement(self):
3439         """Moves the position of the current instance to the node that
3440            contains the current Attribute  node. """
3441         ret = libxml2mod.xmlTextReaderMoveToElement(self._o)
3442         return ret
3443
3444     def MoveToFirstAttribute(self):
3445         """Moves the position of the current instance to the first
3446            attribute associated with the current node. """
3447         ret = libxml2mod.xmlTextReaderMoveToFirstAttribute(self._o)
3448         return ret
3449
3450     def MoveToNextAttribute(self):
3451         """Moves the position of the current instance to the next
3452            attribute associated with the current node. """
3453         ret = libxml2mod.xmlTextReaderMoveToNextAttribute(self._o)
3454         return ret
3455
3456     def Name(self):
3457         """The qualified name of the node, equal to Prefix :LocalName. """
3458         ret = libxml2mod.xmlTextReaderName(self._o)
3459         return ret
3460
3461     def NamespaceUri(self):
3462         """The URI defining the namespace associated with the node. """
3463         ret = libxml2mod.xmlTextReaderNamespaceUri(self._o)
3464         return ret
3465
3466     def NodeType(self):
3467         """Get the node type of the current node Reference:
3468            http://dotgnu.org/pnetlib-doc/System/Xml/XmlNodeType.html """
3469         ret = libxml2mod.xmlTextReaderNodeType(self._o)
3470         return ret
3471
3472     def Normalization(self):
3473         """The value indicating whether to normalize white space and
3474            attribute values. Since attribute value and end of line
3475            normalizations are a MUST in the XML specification only
3476            the value true is accepted. The broken bahaviour of
3477            accepting out of range character entities like &#0; is of
3478            course not supported either. """
3479         ret = libxml2mod.xmlTextReaderNormalization(self._o)
3480         return ret
3481
3482     def Prefix(self):
3483         """A shorthand reference to the namespace associated with the
3484            node. """
3485         ret = libxml2mod.xmlTextReaderPrefix(self._o)
3486         return ret
3487
3488     def QuoteChar(self):
3489         """The quotation mark character used to enclose the value of
3490            an attribute. """
3491         ret = libxml2mod.xmlTextReaderQuoteChar(self._o)
3492         return ret
3493
3494     def Read(self):
3495         """Moves the position of the current instance to the next node
3496            in the stream, exposing its properties. """
3497         ret = libxml2mod.xmlTextReaderRead(self._o)
3498         return ret
3499
3500     def ReadAttributeValue(self):
3501         """Parses an attribute value into one or more Text and
3502            EntityReference nodes. """
3503         ret = libxml2mod.xmlTextReaderReadAttributeValue(self._o)
3504         return ret
3505
3506     def ReadInnerXml(self):
3507         """Reads the contents of the current node, including child
3508            nodes and markup. """
3509         ret = libxml2mod.xmlTextReaderReadInnerXml(self._o)
3510         return ret
3511
3512     def ReadOuterXml(self):
3513         """Reads the contents of the current node, including child
3514            nodes and markup. """
3515         ret = libxml2mod.xmlTextReaderReadOuterXml(self._o)
3516         return ret
3517
3518     def ReadState(self):
3519         """Gets the read state of the reader. """
3520         ret = libxml2mod.xmlTextReaderReadState(self._o)
3521         return ret
3522
3523     def ReadString(self):
3524         """Reads the contents of an element or a text node as a string. """
3525         ret = libxml2mod.xmlTextReaderReadString(self._o)
3526         return ret
3527
3528     def SetParserProp(self, prop, value):
3529         """Change the parser processing behaviour by changing some of
3530            its internal properties. Note that some properties can
3531            only be changed before any read has been done. """
3532         ret = libxml2mod.xmlTextReaderSetParserProp(self._o, prop, value)
3533         return ret
3534
3535     def Value(self):
3536         """Provides the text value of the node if present """
3537         ret = libxml2mod.xmlTextReaderValue(self._o)
3538         return ret
3539
3540     def XmlLang(self):
3541         """The xml:lang scope within which the node resides. """
3542         ret = libxml2mod.xmlTextReaderXmlLang(self._o)
3543         return ret
3544
3545 class xmlReg:
3546     def __init__(self, _obj=None):
3547         if _obj != None:self._o = _obj;return
3548         self._o = None
3549
3550     def __del__(self):
3551         if self._o != None:
3552             libxml2mod.xmlRegFreeRegexp(self._o)
3553         self._o = None
3554
3555     #
3556     # xmlReg functions from module xmlregexp
3557     #
3558
3559     def regexpExec(self, content):
3560         """Check if the regular expression generate the value """
3561         ret = libxml2mod.xmlRegexpExec(self._o, content)
3562         return ret
3563
3564     def regexpFreeRegexp(self):
3565         """Free a regexp """
3566         libxml2mod.xmlRegFreeRegexp(self._o)
3567
3568     def regexpIsDeterminist(self):
3569         """Check if the regular expression is determinist """
3570         ret = libxml2mod.xmlRegexpIsDeterminist(self._o)
3571         return ret
3572
3573     def regexpPrint(self, output):
3574         """Print the content of the compiled regular expression """
3575         libxml2mod.xmlRegexpPrint(output, self._o)
3576
3577 class xmlEntity(xmlNode):
3578     def __init__(self, _obj=None):
3579         self._o = None
3580         xmlNode.__init__(self, _obj=_obj)
3581
3582     def __repr__(self):
3583         return "<xmlEntity (%s) object at 0x%x>" % (self.name, id (self))
3584
3585     #
3586     # xmlEntity functions from module parserInternals
3587     #
3588
3589     def handleEntity(self, ctxt):
3590         """Default handling of defined entities, when should we define
3591            a new input stream ? When do we just handle that as a set
3592            of chars ?  OBSOLETE: to be removed at some point. """
3593         if ctxt is None: ctxt__o = None
3594         else: ctxt__o = ctxt._o
3595         libxml2mod.xmlHandleEntity(ctxt__o, self._o)
3596
3597 class relaxNgSchema:
3598     def __init__(self, _obj=None):
3599         if _obj != None:self._o = _obj;return
3600         self._o = None
3601
3602     def __del__(self):
3603         if self._o != None:
3604             libxml2mod.xmlRelaxNGFree(self._o)
3605         self._o = None
3606
3607     #
3608     # relaxNgSchema functions from module relaxng
3609     #
3610
3611     def relaxNGDump(self, output):
3612         """Dump a RelaxNG structure back """
3613         libxml2mod.xmlRelaxNGDump(output, self._o)
3614
3615     def relaxNGDumpTree(self, output):
3616         """Dump the transformed RelaxNG tree. """
3617         libxml2mod.xmlRelaxNGDumpTree(output, self._o)
3618
3619     def relaxNGFree(self):
3620         """Deallocate a RelaxNG structure. """
3621         libxml2mod.xmlRelaxNGFree(self._o)
3622
3623     def relaxNGNewValidCtxt(self):
3624         """Create an XML RelaxNGs validation context based on the
3625            given schema """
3626         ret = libxml2mod.xmlRelaxNGNewValidCtxt(self._o)
3627         if ret is None:raise treeError('xmlRelaxNGNewValidCtxt() failed')
3628         __tmp = relaxNgValidCtxt(_obj=ret)
3629         __tmp.schema = self
3630         return __tmp
3631
3632 class relaxNgValidCtxt:
3633     def __init__(self, _obj=None):
3634         self.schema = None
3635         if _obj != None:self._o = _obj;return
3636         self._o = None
3637
3638     def __del__(self):
3639         if self._o != None:
3640             libxml2mod.xmlRelaxNGFreeValidCtxt(self._o)
3641         self._o = None
3642
3643     #
3644     # relaxNgValidCtxt functions from module relaxng
3645     #
3646
3647     def relaxNGFreeValidCtxt(self):
3648         """Free the resources associated to the schema validation
3649            context """
3650         libxml2mod.xmlRelaxNGFreeValidCtxt(self._o)
3651
3652 class xpathParserContext:
3653     def __init__(self, _obj=None):
3654         if _obj != None:self._o = _obj;return
3655         self._o = None
3656
3657     # accessors for xpathParserContext
3658     def context(self):
3659         """Get the xpathContext from an xpathParserContext """
3660         ret = libxml2mod.xmlXPathParserGetContext(self._o)
3661         if ret is None:raise xpathError('xmlXPathParserGetContext() failed')
3662         __tmp = xpathContext(_obj=ret)
3663         return __tmp
3664
3665     #
3666     # xpathParserContext functions from module xpathInternals
3667     #
3668
3669     def xpathAddValues(self):
3670         """Implement the add operation on XPath objects: The numeric
3671            operators convert their operands to numbers as if by
3672            calling the number function. """
3673         libxml2mod.xmlXPathAddValues(self._o)
3674
3675     def xpathBooleanFunction(self, nargs):
3676         """Implement the boolean() XPath function boolean
3677            boolean(object) he boolean function converts its argument
3678            to a boolean as follows: - a number is true if and only if
3679            it is neither positive or negative zero nor NaN - a
3680            node-set is true if and only if it is non-empty - a string
3681            is true if and only if its length is non-zero """
3682         libxml2mod.xmlXPathBooleanFunction(self._o, nargs)
3683
3684     def xpathCeilingFunction(self, nargs):
3685         """Implement the ceiling() XPath function number
3686            ceiling(number) The ceiling function returns the smallest
3687            (closest to negative infinity) number that is not less
3688            than the argument and that is an integer. """
3689         libxml2mod.xmlXPathCeilingFunction(self._o, nargs)
3690
3691     def xpathCompareValues(self, inf, strict):
3692         """Implement the compare operation on XPath objects: @arg1 <
3693            @arg2    (1, 1, ... @arg1 <= @arg2   (1, 0, ... @arg1 >
3694            @arg2    (0, 1, ... @arg1 >= @arg2   (0, 0, ...  When
3695            neither object to be compared is a node-set and the
3696            operator is <=, <, >=, >, then the objects are compared by
3697            converted both objects to numbers and comparing the
3698            numbers according to IEEE 754. The < comparison will be
3699            true if and only if the first number is less than the
3700            second number. The <= comparison will be true if and only
3701            if the first number is less than or equal to the second
3702            number. The > comparison will be true if and only if the
3703            first number is greater than the second number. The >=
3704            comparison will be true if and only if the first number is
3705            greater than or equal to the second number. """
3706         ret = libxml2mod.xmlXPathCompareValues(self._o, inf, strict)
3707         return ret
3708
3709     def xpathConcatFunction(self, nargs):
3710         """Implement the concat() XPath function string concat(string,
3711            string, string*) The concat function returns the
3712            concatenation of its arguments. """
3713         libxml2mod.xmlXPathConcatFunction(self._o, nargs)
3714
3715     def xpathContainsFunction(self, nargs):
3716         """Implement the contains() XPath function boolean
3717            contains(string, string) The contains function returns
3718            true if the first argument string contains the second
3719            argument string, and otherwise returns false. """
3720         libxml2mod.xmlXPathContainsFunction(self._o, nargs)
3721
3722     def xpathCountFunction(self, nargs):
3723         """Implement the count() XPath function number count(node-set) """
3724         libxml2mod.xmlXPathCountFunction(self._o, nargs)
3725
3726     def xpathDivValues(self):
3727         """Implement the div operation on XPath objects @arg1 / @arg2:
3728            The numeric operators convert their operands to numbers as
3729            if by calling the number function. """
3730         libxml2mod.xmlXPathDivValues(self._o)
3731
3732     def xpathEqualValues(self):
3733         """Implement the equal operation on XPath objects content:
3734            @arg1 == @arg2 """
3735         ret = libxml2mod.xmlXPathEqualValues(self._o)
3736         return ret
3737
3738     def xpathEvalExpr(self):
3739         """Parse and evaluate an XPath expression in the given
3740            context, then push the result on the context stack """
3741         libxml2mod.xmlXPathEvalExpr(self._o)
3742
3743     def xpathFalseFunction(self, nargs):
3744         """Implement the false() XPath function boolean false() """
3745         libxml2mod.xmlXPathFalseFunction(self._o, nargs)
3746
3747     def xpathFloorFunction(self, nargs):
3748         """Implement the floor() XPath function number floor(number)
3749            The floor function returns the largest (closest to
3750            positive infinity) number that is not greater than the
3751            argument and that is an integer. """
3752         libxml2mod.xmlXPathFloorFunction(self._o, nargs)
3753
3754     def xpathFreeParserContext(self):
3755         """Free up an xmlXPathParserContext """
3756         libxml2mod.xmlXPathFreeParserContext(self._o)
3757
3758     def xpathIdFunction(self, nargs):
3759         """Implement the id() XPath function node-set id(object) The
3760            id function selects elements by their unique ID (see
3761            [5.2.1 Unique IDs]). When the argument to id is of type
3762            node-set, then the result is the union of the result of
3763            applying id to the string value of each of the nodes in
3764            the argument node-set. When the argument to id is of any
3765            other type, the argument is converted to a string as if by
3766            a call to the string function; the string is split into a
3767            whitespace-separated list of tokens (whitespace is any
3768            sequence of characters matching the production S); the
3769            result is a node-set containing the elements in the same
3770            document as the context node that have a unique ID equal
3771            to any of the tokens in the list. """
3772         libxml2mod.xmlXPathIdFunction(self._o, nargs)
3773
3774     def xpathLangFunction(self, nargs):
3775         """Implement the lang() XPath function boolean lang(string)
3776            The lang function returns true or false depending on
3777            whether the language of the context node as specified by
3778            xml:lang attributes is the same as or is a sublanguage of
3779            the language specified by the argument string. The
3780            language of the context node is determined by the value of
3781            the xml:lang attribute on the context node, or, if the
3782            context node has no xml:lang attribute, by the value of
3783            the xml:lang attribute on the nearest ancestor of the
3784            context node that has an xml:lang attribute. If there is
3785            no such attribute, then lang """
3786         libxml2mod.xmlXPathLangFunction(self._o, nargs)
3787
3788     def xpathLastFunction(self, nargs):
3789         """Implement the last() XPath function number last() The last
3790            function returns the number of nodes in the context node
3791            list. """
3792         libxml2mod.xmlXPathLastFunction(self._o, nargs)
3793
3794     def xpathLocalNameFunction(self, nargs):
3795         """Implement the local-name() XPath function string
3796            local-name(node-set?) The local-name function returns a
3797            string containing the local part of the name of the node
3798            in the argument node-set that is first in document order.
3799            If the node-set is empty or the first node has no name, an
3800            empty string is returned. If the argument is omitted it
3801            defaults to the context node. """
3802         libxml2mod.xmlXPathLocalNameFunction(self._o, nargs)
3803
3804     def xpathModValues(self):
3805         """Implement the mod operation on XPath objects: @arg1 / @arg2
3806            The numeric operators convert their operands to numbers as
3807            if by calling the number function. """
3808         libxml2mod.xmlXPathModValues(self._o)
3809
3810     def xpathMultValues(self):
3811         """Implement the multiply operation on XPath objects: The
3812            numeric operators convert their operands to numbers as if
3813            by calling the number function. """
3814         libxml2mod.xmlXPathMultValues(self._o)
3815
3816     def xpathNamespaceURIFunction(self, nargs):
3817         """Implement the namespace-uri() XPath function string
3818            namespace-uri(node-set?) The namespace-uri function
3819            returns a string containing the namespace URI of the
3820            expanded name of the node in the argument node-set that is
3821            first in document order. If the node-set is empty, the
3822            first node has no name, or the expanded name has no
3823            namespace URI, an empty string is returned. If the
3824            argument is omitted it defaults to the context node. """
3825         libxml2mod.xmlXPathNamespaceURIFunction(self._o, nargs)
3826
3827     def xpathNormalizeFunction(self, nargs):
3828         """Implement the normalize-space() XPath function string
3829            normalize-space(string?) The normalize-space function
3830            returns the argument string with white space normalized by
3831            stripping leading and trailing whitespace and replacing
3832            sequences of whitespace characters by a single space.
3833            Whitespace characters are the same allowed by the S
3834            production in XML. If the argument is omitted, it defaults
3835            to the context node converted to a string, in other words
3836            the value of the context node. """
3837         libxml2mod.xmlXPathNormalizeFunction(self._o, nargs)
3838
3839     def xpathNotEqualValues(self):
3840         """Implement the equal operation on XPath objects content:
3841            @arg1 == @arg2 """
3842         ret = libxml2mod.xmlXPathNotEqualValues(self._o)
3843         return ret
3844
3845     def xpathNotFunction(self, nargs):
3846         """Implement the not() XPath function boolean not(boolean) The
3847            not function returns true if its argument is false, and
3848            false otherwise. """
3849         libxml2mod.xmlXPathNotFunction(self._o, nargs)
3850
3851     def xpathNumberFunction(self, nargs):
3852         """Implement the number() XPath function number number(object?) """
3853         libxml2mod.xmlXPathNumberFunction(self._o, nargs)
3854
3855     def xpathParseNCName(self):
3856         """parse an XML namespace non qualified name.  [NS 3] NCName
3857            ::= (Letter | '_') (NCNameChar)*  [NS 4] NCNameChar ::=
3858            Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender """
3859         ret = libxml2mod.xmlXPathParseNCName(self._o)
3860         return ret
3861
3862     def xpathParseName(self):
3863         """parse an XML name  [4] NameChar ::= Letter | Digit | '.' |
3864            '-' | '_' | ':' | CombiningChar | Extender  [5] Name ::=
3865            (Letter | '_' | ':') (NameChar)* """
3866         ret = libxml2mod.xmlXPathParseName(self._o)
3867         return ret
3868
3869     def xpathPopBoolean(self):
3870         """Pops a boolean from the stack, handling conversion if
3871            needed. Check error with #xmlXPathCheckError. """
3872         ret = libxml2mod.xmlXPathPopBoolean(self._o)
3873         return ret
3874
3875     def xpathPopNumber(self):
3876         """Pops a number from the stack, handling conversion if
3877            needed. Check error with #xmlXPathCheckError. """
3878         ret = libxml2mod.xmlXPathPopNumber(self._o)
3879         return ret
3880
3881     def xpathPopString(self):
3882         """Pops a string from the stack, handling conversion if
3883            needed. Check error with #xmlXPathCheckError. """
3884         ret = libxml2mod.xmlXPathPopString(self._o)
3885         return ret
3886
3887     def xpathPositionFunction(self, nargs):
3888         """Implement the position() XPath function number position()
3889            The position function returns the position of the context
3890            node in the context node list. The first position is 1,
3891            and so the last position will be equal to last(). """
3892         libxml2mod.xmlXPathPositionFunction(self._o, nargs)
3893
3894     def xpathRoot(self):
3895         """Initialize the context to the root of the document """
3896         libxml2mod.xmlXPathRoot(self._o)
3897
3898     def xpathRoundFunction(self, nargs):
3899         """Implement the round() XPath function number round(number)
3900            The round function returns the number that is closest to
3901            the argument and that is an integer. If there are two such
3902            numbers, then the one that is even is returned. """
3903         libxml2mod.xmlXPathRoundFunction(self._o, nargs)
3904
3905     def xpathStartsWithFunction(self, nargs):
3906         """Implement the starts-with() XPath function boolean
3907            starts-with(string, string) The starts-with function
3908            returns true if the first argument string starts with the
3909            second argument string, and otherwise returns false. """
3910         libxml2mod.xmlXPathStartsWithFunction(self._o, nargs)
3911
3912     def xpathStringFunction(self, nargs):
3913         """Implement the string() XPath function string
3914            string(object?) he string function converts an object to a
3915            string as follows: - A node-set is converted to a string
3916            by returning the value of the node in the node-set that is
3917            first in document order. If the node-set is empty, an
3918            empty string is returned. - A number is converted to a
3919            string as follows + NaN is converted to the string NaN +
3920            positive zero is converted to the string 0 + negative zero
3921            is converted to the string 0 + positive infinity is
3922            converted to the string Infinity + negative infinity is
3923            converted to the string -Infinity + if the number is an
3924            integer, the number is represented in decimal form as a
3925            Number with no decimal point and no leading zeros,
3926            preceded by a minus sign (-) if the number is negative +
3927            otherwise, the number is represented in decimal form as a
3928            Number including a decimal point with at least one digit
3929            before the decimal point and at least one digit after the
3930            decimal point, preceded by a minus sign (-) if the number
3931            is negative; there must be no leading zeros before the
3932            decimal point apart possibly from the one required digit
3933            immediately before the decimal point; beyond the one
3934            required digit after the decimal point there must be as
3935            many, but only as many, more digits as are needed to
3936            uniquely distinguish the number from all other IEEE 754
3937            numeric values. - The boolean false value is converted to
3938            the string false. The boolean true value is converted to
3939            the string true.  If the argument is omitted, it defaults
3940            to a node-set with the context node as its only member. """
3941         libxml2mod.xmlXPathStringFunction(self._o, nargs)
3942
3943     def xpathStringLengthFunction(self, nargs):
3944         """Implement the string-length() XPath function number
3945            string-length(string?) The string-length returns the
3946            number of characters in the string (see [3.6 Strings]). If
3947            the argument is omitted, it defaults to the context node
3948            converted to a string, in other words the value of the
3949            context node. """
3950         libxml2mod.xmlXPathStringLengthFunction(self._o, nargs)
3951
3952     def xpathSubValues(self):
3953         """Implement the subtraction operation on XPath objects: The
3954            numeric operators convert their operands to numbers as if
3955            by calling the number function. """
3956         libxml2mod.xmlXPathSubValues(self._o)
3957
3958     def xpathSubstringAfterFunction(self, nargs):
3959         """Implement the substring-after() XPath function string
3960            substring-after(string, string) The substring-after
3961            function returns the substring of the first argument
3962            string that follows the first occurrence of the second
3963            argument string in the first argument string, or the empty
3964            stringi if the first argument string does not contain the
3965            second argument string. For example,
3966            substring-after("1999/04/01","/") returns 04/01, and
3967            substring-after("1999/04/01","19") returns 99/04/01. """
3968         libxml2mod.xmlXPathSubstringAfterFunction(self._o, nargs)
3969
3970     def xpathSubstringBeforeFunction(self, nargs):
3971         """Implement the substring-before() XPath function string
3972            substring-before(string, string) The substring-before
3973            function returns the substring of the first argument
3974            string that precedes the first occurrence of the second
3975            argument string in the first argument string, or the empty
3976            string if the first argument string does not contain the
3977            second argument string. For example,
3978            substring-before("1999/04/01","/") returns 1999. """
3979         libxml2mod.xmlXPathSubstringBeforeFunction(self._o, nargs)
3980
3981     def xpathSubstringFunction(self, nargs):
3982         """Implement the substring() XPath function string
3983            substring(string, number, number?) The substring function
3984            returns the substring of the first argument starting at
3985            the position specified in the second argument with length
3986            specified in the third argument. For example,
3987            substring("12345",2,3) returns "234". If the third
3988            argument is not specified, it returns the substring
3989            starting at the position specified in the second argument
3990            and continuing to the end of the string. For example,
3991            substring("12345",2) returns "2345".  More precisely, each
3992            character in the string (see [3.6 Strings]) is considered
3993            to have a numeric position: the position of the first
3994            character is 1, the position of the second character is 2
3995            and so on. The returned substring contains those
3996            characters for which the position of the character is
3997            greater than or equal to the second argument and, if the
3998            third argument is specified, less than the sum of the
3999            second and third arguments; the comparisons and addition
4000            used for the above follow the standard IEEE 754 rules.
4001            Thus: - substring("12345", 1.5, 2.6) returns "234" -
4002            substring("12345", 0, 3) returns "12" - substring("12345",
4003            0 div 0, 3) returns "" - substring("12345", 1, 0 div 0)
4004            returns "" - substring("12345", -42, 1 div 0) returns
4005            "12345" - substring("12345", -1 div 0, 1 div 0) returns "" """
4006         libxml2mod.xmlXPathSubstringFunction(self._o, nargs)
4007
4008     def xpathSumFunction(self, nargs):
4009         """Implement the sum() XPath function number sum(node-set) The
4010            sum function returns the sum of the values of the nodes in
4011            the argument node-set. """
4012         libxml2mod.xmlXPathSumFunction(self._o, nargs)
4013
4014     def xpathTranslateFunction(self, nargs):
4015         """Implement the translate() XPath function string
4016            translate(string, string, string) The translate function
4017            returns the first argument string with occurrences of
4018            characters in the second argument string replaced by the
4019            character at the corresponding position in the third
4020            argument string. For example, translate("bar","abc","ABC")
4021            returns the string BAr. If there is a character in the
4022            second argument string with no character at a
4023            corresponding position in the third argument string
4024            (because the second argument string is longer than the
4025            third argument string), then occurrences of that character
4026            in the first argument string are removed. For example,
4027            translate("--aaa--","abc-","ABC") """
4028         libxml2mod.xmlXPathTranslateFunction(self._o, nargs)
4029
4030     def xpathTrueFunction(self, nargs):
4031         """Implement the true() XPath function boolean true() """
4032         libxml2mod.xmlXPathTrueFunction(self._o, nargs)
4033
4034     def xpathValueFlipSign(self):
4035         """Implement the unary - operation on an XPath object The
4036            numeric operators convert their operands to numbers as if
4037            by calling the number function. """
4038         libxml2mod.xmlXPathValueFlipSign(self._o)
4039
4040     def xpatherror(self, file, line, no):
4041         """Formats an error message. """
4042         libxml2mod.xmlXPatherror(self._o, file, line, no)
4043
4044     #
4045     # xpathParserContext functions from module xpointer
4046     #
4047
4048     def xpointerEvalRangePredicate(self):
4049         """[8]   Predicate ::=   '[' PredicateExpr ']' [9]  
4050            PredicateExpr ::=   Expr  Evaluate a predicate as in
4051            xmlXPathEvalPredicate() but for a Location Set instead of
4052            a node set """
4053         libxml2mod.xmlXPtrEvalRangePredicate(self._o)
4054
4055     def xpointerRangeToFunction(self, nargs):
4056         """Implement the range-to() XPointer function """
4057         libxml2mod.xmlXPtrRangeToFunction(self._o, nargs)
4058
4059 class parserCtxt(parserCtxtCore):
4060     def __init__(self, _obj=None):
4061         self._o = None
4062         parserCtxtCore.__init__(self, _obj=_obj)
4063
4064     def __del__(self):
4065         if self._o != None:
4066             libxml2mod.xmlFreeParserCtxt(self._o)
4067         self._o = None
4068
4069     # accessors for parserCtxt
4070     def doc(self):
4071         """Get the document tree from a parser context. """
4072         ret = libxml2mod.xmlParserGetDoc(self._o)
4073         if ret is None:raise parserError('xmlParserGetDoc() failed')
4074         __tmp = xmlDoc(_obj=ret)
4075         return __tmp
4076
4077     def isValid(self):
4078         """Get the validity information from a parser context. """
4079         ret = libxml2mod.xmlParserGetIsValid(self._o)
4080         return ret
4081
4082     def lineNumbers(self, linenumbers):
4083         """Switch on the generation of line number for elements nodes. """
4084         libxml2mod.xmlParserSetLineNumbers(self._o, linenumbers)
4085
4086     def loadSubset(self, loadsubset):
4087         """Switch the parser to load the DTD without validating. """
4088         libxml2mod.xmlParserSetLoadSubset(self._o, loadsubset)
4089
4090     def pedantic(self, pedantic):
4091         """Switch the parser to be pedantic. """
4092         libxml2mod.xmlParserSetPedantic(self._o, pedantic)
4093
4094     def replaceEntities(self, replaceEntities):
4095         """Switch the parser to replace entities. """
4096         libxml2mod.xmlParserSetReplaceEntities(self._o, replaceEntities)
4097
4098     def validate(self, validate):
4099         """Switch the parser to validation mode. """
4100         libxml2mod.xmlParserSetValidate(self._o, validate)
4101
4102     def wellFormed(self):
4103         """Get the well formed information from a parser context. """
4104         ret = libxml2mod.xmlParserGetWellFormed(self._o)
4105         return ret
4106
4107     #
4108     # parserCtxt functions from module HTMLparser
4109     #
4110
4111     def htmlFreeParserCtxt(self):
4112         """Free all the memory used by a parser context. However the
4113            parsed document in ctxt->myDoc is not freed. """
4114         libxml2mod.htmlFreeParserCtxt(self._o)
4115
4116     def htmlParseCharRef(self):
4117         """parse Reference declarations  [66] CharRef ::= '&#' [0-9]+
4118            ';' | '&#x' [0-9a-fA-F]+ ';' """
4119         ret = libxml2mod.htmlParseCharRef(self._o)
4120         return ret
4121
4122     def htmlParseChunk(self, chunk, size, terminate):
4123         """Parse a Chunk of memory """
4124         ret = libxml2mod.htmlParseChunk(self._o, chunk, size, terminate)
4125         return ret
4126
4127     def htmlParseDocument(self):
4128         """parse an HTML document (and build a tree if using the
4129            standard SAX interface). """
4130         ret = libxml2mod.htmlParseDocument(self._o)
4131         return ret
4132
4133     def htmlParseElement(self):
4134         """parse an HTML element, this is highly recursive  [39]
4135            element ::= EmptyElemTag | STag content ETag  [41]
4136            Attribute ::= Name Eq AttValue """
4137         libxml2mod.htmlParseElement(self._o)
4138
4139     #
4140     # parserCtxt functions from module parser
4141     #
4142
4143     def clearParserCtxt(self):
4144         """Clear (release owned resources) and reinitialize a parser
4145            context """
4146         libxml2mod.xmlClearParserCtxt(self._o)
4147
4148     def initParserCtxt(self):
4149         """Initialize a parser context """
4150         libxml2mod.xmlInitParserCtxt(self._o)
4151
4152     def parseChunk(self, chunk, size, terminate):
4153         """Parse a Chunk of memory """
4154         ret = libxml2mod.xmlParseChunk(self._o, chunk, size, terminate)
4155         return ret
4156
4157     def parseDocument(self):
4158         """parse an XML document (and build a tree if using the
4159            standard SAX interface).  [1] document ::= prolog element
4160            Misc*  [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? """
4161         ret = libxml2mod.xmlParseDocument(self._o)
4162         return ret
4163
4164     def parseExtParsedEnt(self):
4165         """parse a general parsed entity An external general parsed
4166            entity is well-formed if it matches the production labeled
4167            extParsedEnt.  [78] extParsedEnt ::= TextDecl? content """
4168         ret = libxml2mod.xmlParseExtParsedEnt(self._o)
4169         return ret
4170
4171     def setupParserForBuffer(self, buffer, filename):
4172         """Setup the parser context to parse a new buffer; Clears any
4173            prior contents from the parser context. The buffer
4174            parameter must not be None, but the filename parameter can
4175            be """
4176         libxml2mod.xmlSetupParserForBuffer(self._o, buffer, filename)
4177
4178     def stopParser(self):
4179         """Blocks further parser processing """
4180         libxml2mod.xmlStopParser(self._o)
4181
4182     #
4183     # parserCtxt functions from module parserInternals
4184     #
4185
4186     def decodeEntities(self, len, what, end, end2, end3):
4187         """This function is deprecated, we now always process entities
4188            content through xmlStringDecodeEntities  TODO: remove it
4189            in next major release.  [67] Reference ::= EntityRef |
4190            CharRef  [69] PEReference ::= '%' Name ';' """
4191         ret = libxml2mod.xmlDecodeEntities(self._o, len, what, end, end2, end3)
4192         return ret
4193
4194     def namespaceParseNCName(self):
4195         """parse an XML namespace name.  TODO: this seems not in use
4196            anymore, the namespace handling is done on top of the SAX
4197            interfaces, i.e. not on raw input.  [NS 3] NCName ::=
4198            (Letter | '_') (NCNameChar)*  [NS 4] NCNameChar ::= Letter
4199            | Digit | '.' | '-' | '_' | CombiningChar | Extender """
4200         ret = libxml2mod.xmlNamespaceParseNCName(self._o)
4201         return ret
4202
4203     def namespaceParseNSDef(self):
4204         """parse a namespace prefix declaration  TODO: this seems not
4205            in use anymore, the namespace handling is done on top of
4206            the SAX interfaces, i.e. not on raw input.  [NS 1] NSDef
4207            ::= PrefixDef Eq SystemLiteral  [NS 2] PrefixDef ::=
4208            'xmlns' (':' NCName)? """
4209         ret = libxml2mod.xmlNamespaceParseNSDef(self._o)
4210         return ret
4211
4212     def nextChar(self):
4213         """Skip to the next char input char. """
4214         libxml2mod.xmlNextChar(self._o)
4215
4216     def parseAttValue(self):
4217         """parse a value for an attribute Note: the parser won't do
4218            substitution of entities here, this will be handled later
4219            in xmlStringGetNodeList  [10] AttValue ::= '"' ([^<&"] |
4220            Reference)* '"' | "'" ([^<&'] | Reference)* "'"  3.3.3
4221            Attribute-Value Normalization: Before the value of an
4222            attribute is passed to the application or checked for
4223            validity, the XML processor must normalize it as follows:
4224            - a character reference is processed by appending the
4225            referenced character to the attribute value - an entity
4226            reference is processed by recursively processing the
4227            replacement text of the entity - a whitespace character
4228            (#x20, #xD, #xA, #x9) is processed by appending #x20 to
4229            the normalized value, except that only a single #x20 is
4230            appended for a "#xD#xA" sequence that is part of an
4231            external parsed entity or the literal entity value of an
4232            internal parsed entity - other characters are processed by
4233            appending them to the normalized value If the declared
4234            value is not CDATA, then the XML processor must further
4235            process the normalized attribute value by discarding any
4236            leading and trailing space (#x20) characters, and by
4237            replacing sequences of space (#x20) characters by a single
4238            space (#x20) character. All attributes for which no
4239            declaration has been read should be treated by a
4240            non-validating parser as if declared CDATA. """
4241         ret = libxml2mod.xmlParseAttValue(self._o)
4242         return ret
4243
4244     def parseAttributeListDecl(self):
4245         """: parse the Attribute list def for an element  [52]
4246            AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>'  [53]
4247            AttDef ::= S Name S AttType S DefaultDecl """
4248         libxml2mod.xmlParseAttributeListDecl(self._o)
4249
4250     def parseCDSect(self):
4251         """Parse escaped pure raw content.  [18] CDSect ::= CDStart
4252            CData CDEnd  [19] CDStart ::= '<![CDATA['  [20] Data ::=
4253            (Char* - (Char* ']]>' Char*))  [21] CDEnd ::= ']]>' """
4254         libxml2mod.xmlParseCDSect(self._o)
4255
4256     def parseCharData(self, cdata):
4257         """parse a CharData section. if we are within a CDATA section
4258            ']]>' marks an end of section.  The right angle bracket
4259            (>) may be represented using the string "&gt;", and must,
4260            for compatibility, be escaped using "&gt;" or a character
4261            reference when it appears in the string "]]>" in content,
4262            when that string is not marking the end of a CDATA
4263            section.  [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) """
4264         libxml2mod.xmlParseCharData(self._o, cdata)
4265
4266     def parseCharRef(self):
4267         """parse Reference declarations  [66] CharRef ::= '&#' [0-9]+
4268            ';' | '&#x' [0-9a-fA-F]+ ';'  [ WFC: Legal Character ]
4269            Characters referred to using character references must
4270            match the production for Char. """
4271         ret = libxml2mod.xmlParseCharRef(self._o)
4272         return ret
4273
4274     def parseComment(self):
4275         """Skip an XML (SGML) comment <!-- .... --> The spec says that
4276            "For compatibility, the string "--" (double-hyphen) must
4277            not occur within comments. "  [15] Comment ::= '<!--'
4278            ((Char - '-') | ('-' (Char - '-')))* '-->' """
4279         libxml2mod.xmlParseComment(self._o)
4280
4281     def parseContent(self):
4282         """Parse a content:  [43] content ::= (element | CharData |
4283            Reference | CDSect | PI | Comment)* """
4284         libxml2mod.xmlParseContent(self._o)
4285
4286     def parseDocTypeDecl(self):
4287         """parse a DOCTYPE declaration  [28] doctypedecl ::=
4288            '<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl |
4289            PEReference | S)* ']' S?)? '>'  [ VC: Root Element Type ]
4290            The Name in the document type declaration must match the
4291            element type of the root element. """
4292         libxml2mod.xmlParseDocTypeDecl(self._o)
4293
4294     def parseElement(self):
4295         """parse an XML element, this is highly recursive  [39]
4296            element ::= EmptyElemTag | STag content ETag  [ WFC:
4297            Element Type Match ] The Name in an element's end-tag must
4298            match the element type in the start-tag.  [ VC: Element
4299            Valid ] An element is valid if there is a declaration
4300            matching elementdecl where the Name matches the element
4301            type and one of the following holds: - The declaration
4302            matches EMPTY and the element has no content. - The
4303            declaration matches children and the sequence of child
4304            elements belongs to the language generated by the regular
4305            expression in the content model, with optional white space
4306            (characters matching the nonterminal S) between each pair
4307            of child elements. - The declaration matches Mixed and the
4308            content consists of character data and child elements
4309            whose types match names in the content model. - The
4310            declaration matches ANY, and the types of any child
4311            elements have been declared. """
4312         libxml2mod.xmlParseElement(self._o)
4313
4314     def parseElementDecl(self):
4315         """parse an Element declaration.  [45] elementdecl ::=
4316            '<!ELEMENT' S Name S contentspec S? '>'  [ VC: Unique
4317            Element Type Declaration ] No element type may be declared
4318            more than once """
4319         ret = libxml2mod.xmlParseElementDecl(self._o)
4320         return ret
4321
4322     def parseEncName(self):
4323         """parse the XML encoding name  [81] EncName ::= [A-Za-z]
4324            ([A-Za-z0-9._] | '-')* """
4325         ret = libxml2mod.xmlParseEncName(self._o)
4326         return ret
4327
4328     def parseEncodingDecl(self):
4329         """parse the XML encoding declaration  [80] EncodingDecl ::= S
4330            'encoding' Eq ('"' EncName '"' |  "'" EncName "'")  this
4331            setups the conversion filters. """
4332         ret = libxml2mod.xmlParseEncodingDecl(self._o)
4333         return ret
4334
4335     def parseEndTag(self):
4336         """parse an end of tag  [42] ETag ::= '</' Name S? '>'  With
4337            namespace  [NS 9] ETag ::= '</' QName S? '>' """
4338         libxml2mod.xmlParseEndTag(self._o)
4339
4340     def parseEntityDecl(self):
4341         """parse <!ENTITY declarations  [70] EntityDecl ::= GEDecl |
4342            PEDecl  [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S?
4343            '>'  [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S?
4344            '>'  [73] EntityDef ::= EntityValue | (ExternalID
4345            NDataDecl?)  [74] PEDef ::= EntityValue | ExternalID  [76]
4346            NDataDecl ::= S 'NDATA' S Name  [ VC: Notation Declared ]
4347            The Name must match the declared name of a notation. """
4348         libxml2mod.xmlParseEntityDecl(self._o)
4349
4350     def parseEntityRef(self):
4351         """parse ENTITY references declarations  [68] EntityRef ::=
4352            '&' Name ';'  [ WFC: Entity Declared ] In a document
4353            without any DTD, a document with only an internal DTD
4354            subset which contains no parameter entity references, or a
4355            document with "standalone='yes'", the Name given in the
4356            entity reference must match that in an entity declaration,
4357            except that well-formed documents need not declare any of
4358            the following entities: amp, lt, gt, apos, quot.  The
4359            declaration of a parameter entity must precede any
4360            reference to it.  Similarly, the declaration of a general
4361            entity must precede any reference to it which appears in a
4362            default value in an attribute-list declaration. Note that
4363            if entities are declared in the external subset or in
4364            external parameter entities, a non-validating processor is
4365            not obligated to read and process their declarations; for
4366            such documents, the rule that an entity must be declared
4367            is a well-formedness constraint only if standalone='yes'. 
4368            [ WFC: Parsed Entity ] An entity reference must not
4369            contain the name of an unparsed entity """
4370         ret = libxml2mod.xmlParseEntityRef(self._o)
4371         if ret is None:raise parserError('xmlParseEntityRef() failed')
4372         __tmp = xmlEntity(_obj=ret)
4373         return __tmp
4374
4375     def parseExternalSubset(self, ExternalID, SystemID):
4376         """parse Markup declarations from an external subset  [30]
4377            extSubset ::= textDecl? extSubsetDecl  [31] extSubsetDecl
4378            ::= (markupdecl | conditionalSect | PEReference | S) * """
4379         libxml2mod.xmlParseExternalSubset(self._o, ExternalID, SystemID)
4380
4381     def parseMarkupDecl(self):
4382         """parse Markup declarations  [29] markupdecl ::= elementdecl
4383            | AttlistDecl | EntityDecl | NotationDecl | PI | Comment 
4384            [ VC: Proper Declaration/PE Nesting ] Parameter-entity
4385            replacement text must be properly nested with markup
4386            declarations. That is to say, if either the first
4387            character or the last character of a markup declaration
4388            (markupdecl above) is contained in the replacement text
4389            for a parameter-entity reference, both must be contained
4390            in the same replacement text.  [ WFC: PEs in Internal
4391            Subset ] In the internal DTD subset, parameter-entity
4392            references can occur only where markup declarations can
4393            occur, not within markup declarations. (This does not
4394            apply to references that occur in external parameter
4395            entities or to the external subset.) """
4396         libxml2mod.xmlParseMarkupDecl(self._o)
4397
4398     def parseMisc(self):
4399         """parse an XML Misc* optional field.  [27] Misc ::= Comment |
4400            PI |  S """
4401         libxml2mod.xmlParseMisc(self._o)
4402
4403     def parseName(self):
4404         """parse an XML name.  [4] NameChar ::= Letter | Digit | '.' |
4405            '-' | '_' | ':' | CombiningChar | Extender  [5] Name ::=
4406            (Letter | '_' | ':') (NameChar)*  [6] Names ::= Name (S
4407            Name)* """
4408         ret = libxml2mod.xmlParseName(self._o)
4409         return ret
4410
4411     def parseNamespace(self):
4412         """xmlParseNamespace: parse specific PI '<?namespace ...'
4413            constructs.  This is what the older xml-name Working Draft
4414            specified, a bunch of other stuff may still rely on it, so
4415            support is still here as if it was declared on the root of
4416            the Tree:-(  TODO: remove from library  To be removed at
4417            next drop of binary compatibility """
4418         libxml2mod.xmlParseNamespace(self._o)
4419
4420     def parseNmtoken(self):
4421         """parse an XML Nmtoken.  [7] Nmtoken ::= (NameChar)+  [8]
4422            Nmtokens ::= Nmtoken (S Nmtoken)* """
4423         ret = libxml2mod.xmlParseNmtoken(self._o)
4424         return ret
4425
4426     def parseNotationDecl(self):
4427         """parse a notation declaration  [82] NotationDecl ::=
4428            '<!NOTATION' S Name S (ExternalID |  PublicID) S? '>' 
4429            Hence there is actually 3 choices: 'PUBLIC' S PubidLiteral
4430            'PUBLIC' S PubidLiteral S SystemLiteral and 'SYSTEM' S
4431            SystemLiteral  See the NOTE on xmlParseExternalID(). """
4432         libxml2mod.xmlParseNotationDecl(self._o)
4433
4434     def parsePEReference(self):
4435         """parse PEReference declarations The entity content is
4436            handled directly by pushing it's content as a new input
4437            stream.  [69] PEReference ::= '%' Name ';'  [ WFC: No
4438            Recursion ] A parsed entity must not contain a recursive
4439            reference to itself, either directly or indirectly.  [
4440            WFC: Entity Declared ] In a document without any DTD, a
4441            document with only an internal DTD subset which contains
4442            no parameter entity references, or a document with
4443            "standalone='yes'", ...  ... The declaration of a
4444            parameter entity must precede any reference to it...  [
4445            VC: Entity Declared ] In a document with an external
4446            subset or external parameter entities with
4447            "standalone='no'", ...  ... The declaration of a parameter
4448            entity must precede any reference to it...  [ WFC: In DTD
4449            ] Parameter-entity references may only appear in the DTD.
4450            NOTE: misleading but this is handled. """
4451         libxml2mod.xmlParsePEReference(self._o)
4452
4453     def parsePI(self):
4454         """parse an XML Processing Instruction.  [16] PI ::= '<?'
4455            PITarget (S (Char* - (Char* '?>' Char*)))? '?>'  The
4456            processing is transfered to SAX once parsed. """
4457         libxml2mod.xmlParsePI(self._o)
4458
4459     def parsePITarget(self):
4460         """parse the name of a PI  [17] PITarget ::= Name - (('X' |
4461            'x') ('M' | 'm') ('L' | 'l')) """
4462         ret = libxml2mod.xmlParsePITarget(self._o)
4463         return ret
4464
4465     def parsePubidLiteral(self):
4466         """parse an XML public literal  [12] PubidLiteral ::= '"'
4467            PubidChar* '"' | "'" (PubidChar - "'")* "'" """
4468         ret = libxml2mod.xmlParsePubidLiteral(self._o)
4469         return ret
4470
4471     def parseQuotedString(self):
4472         """Parse and return a string between quotes or doublequotes 
4473            TODO: Deprecated, to  be removed at next drop of binary
4474            compatibility """
4475         ret = libxml2mod.xmlParseQuotedString(self._o)
4476         return ret
4477
4478     def parseReference(self):
4479         """parse and handle entity references in content, depending on
4480            the SAX interface, this may end-up in a call to
4481            character() if this is a CharRef, a predefined entity, if
4482            there is no reference() callback. or if the parser was
4483            asked to switch to that mode.  [67] Reference ::=
4484            EntityRef | CharRef """
4485         libxml2mod.xmlParseReference(self._o)
4486
4487     def parseSDDecl(self):
4488         """parse the XML standalone declaration  [32] SDDecl ::= S
4489            'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' |
4490            'no')'"'))  [ VC: Standalone Document Declaration ] TODO
4491            The standalone document declaration must have the value
4492            "no" if any external markup declarations contain
4493            declarations of: - attributes with default values, if
4494            elements to which these attributes apply appear in the
4495            document without specifications of values for these
4496            attributes, or - entities (other than amp, lt, gt, apos,
4497            quot), if references to those entities appear in the
4498            document, or - attributes with values subject to
4499            normalization, where the attribute appears in the document
4500            with a value which will change as a result of
4501            normalization, or - element types with element content, if
4502            white space occurs directly within any instance of those
4503            types. """
4504         ret = libxml2mod.xmlParseSDDecl(self._o)
4505         return ret
4506
4507     def parseStartTag(self):
4508         """parse a start of tag either for rule element or
4509            EmptyElement. In both case we don't parse the tag closing
4510            chars.  [40] STag ::= '<' Name (S Attribute)* S? '>'  [
4511            WFC: Unique Att Spec ] No attribute name may appear more
4512            than once in the same start-tag or empty-element tag. 
4513            [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'  [
4514            WFC: Unique Att Spec ] No attribute name may appear more
4515            than once in the same start-tag or empty-element tag. 
4516            With namespace:  [NS 8] STag ::= '<' QName (S Attribute)*
4517            S? '>'  [NS 10] EmptyElement ::= '<' QName (S Attribute)*
4518            S? '/>' """
4519         ret = libxml2mod.xmlParseStartTag(self._o)
4520         return ret
4521
4522     def parseSystemLiteral(self):
4523         """parse an XML Literal  [11] SystemLiteral ::= ('"' [^"]*
4524            '"') | ("'" [^']* "'") """
4525         ret = libxml2mod.xmlParseSystemLiteral(self._o)
4526         return ret
4527
4528     def parseTextDecl(self):
4529         """parse an XML declaration header for external entities  [77]
4530            TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' 
4531            Question: Seems that EncodingDecl is mandatory ? Is that a
4532            typo ? """
4533         libxml2mod.xmlParseTextDecl(self._o)
4534
4535     def parseVersionInfo(self):
4536         """parse the XML version.  [24] VersionInfo ::= S 'version' Eq
4537            (' VersionNum ' | " VersionNum ")  [25] Eq ::= S? '=' S? """
4538         ret = libxml2mod.xmlParseVersionInfo(self._o)
4539         return ret
4540
4541     def parseVersionNum(self):
4542         """parse the XML version value.  [26] VersionNum ::=
4543            ([a-zA-Z0-9_.:] | '-')+ """
4544         ret = libxml2mod.xmlParseVersionNum(self._o)
4545         return ret
4546
4547     def parseXMLDecl(self):
4548         """parse an XML declaration header  [23] XMLDecl ::= '<?xml'
4549            VersionInfo EncodingDecl? SDDecl? S? '?>' """
4550         libxml2mod.xmlParseXMLDecl(self._o)
4551
4552     def parserHandlePEReference(self):
4553         """[69] PEReference ::= '%' Name ';'  [ WFC: No Recursion ] A
4554            parsed entity must not contain a recursive reference to
4555            itself, either directly or indirectly.  [ WFC: Entity
4556            Declared ] In a document without any DTD, a document with
4557            only an internal DTD subset which contains no parameter
4558            entity references, or a document with "standalone='yes'",
4559            ...  ... The declaration of a parameter entity must
4560            precede any reference to it...  [ VC: Entity Declared ] In
4561            a document with an external subset or external parameter
4562            entities with "standalone='no'", ...  ... The declaration
4563            of a parameter entity must precede any reference to it... 
4564            [ WFC: In DTD ] Parameter-entity references may only
4565            appear in the DTD. NOTE: misleading but this is handled. 
4566            A PEReference may have been detected in the current input
4567            stream the handling is done accordingly to
4568            http://www.w3.org/TR/REC-xml#entproc i.e. - Included in
4569            literal in entity values - Included as Parameter Entity
4570            reference within DTDs """
4571         libxml2mod.xmlParserHandlePEReference(self._o)
4572
4573     def parserHandleReference(self):
4574         """TODO: Remove, now deprecated ... the test is done directly
4575            in the content parsing routines.  [67] Reference ::=
4576            EntityRef | CharRef  [68] EntityRef ::= '&' Name ';'  [
4577            WFC: Entity Declared ] the Name given in the entity
4578            reference must match that in an entity declaration, except
4579            that well-formed documents need not declare any of the
4580            following entities: amp, lt, gt, apos, quot.  [ WFC:
4581            Parsed Entity ] An entity reference must not contain the
4582            name of an unparsed entity  [66] CharRef ::= '&#' [0-9]+
4583            ';' | '&#x' [0-9a-fA-F]+ ';'  A PEReference may have been
4584            detected in the current input stream the handling is done
4585            accordingly to http://www.w3.org/TR/REC-xml#entproc """
4586         libxml2mod.xmlParserHandleReference(self._o)
4587
4588     def popInput(self):
4589         """xmlPopInput: the current input pointed by ctxt->input came
4590            to an end pop it and return the next char. """
4591         ret = libxml2mod.xmlPopInput(self._o)
4592         return ret
4593
4594     def scanName(self):
4595         """Trickery: parse an XML name but without consuming the input
4596            flow Needed for rollback cases. Used only when parsing
4597            entities references.  TODO: seems deprecated now, only
4598            used in the default part of xmlParserHandleReference  [4]
4599            NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
4600            CombiningChar | Extender  [5] Name ::= (Letter | '_' |
4601            ':') (NameChar)*  [6] Names ::= Name (S Name)* """
4602         ret = libxml2mod.xmlScanName(self._o)
4603         return ret
4604
4605     def skipBlankChars(self):
4606         """skip all blanks character found at that point in the input
4607            streams. It pops up finished entities in the process if
4608            allowable at that point. """
4609         ret = libxml2mod.xmlSkipBlankChars(self._o)
4610         return ret
4611
4612     def stringDecodeEntities(self, str, what, end, end2, end3):
4613         """Takes a entity string content and process to do the
4614            adequate substitutions.  [67] Reference ::= EntityRef |
4615            CharRef  [69] PEReference ::= '%' Name ';' """
4616         ret = libxml2mod.xmlStringDecodeEntities(self._o, str, what, end, end2, end3)
4617         return ret
4618
4619 class xmlDtd(xmlNode):
4620     def __init__(self, _obj=None):
4621         self._o = None
4622         xmlNode.__init__(self, _obj=_obj)
4623
4624     def __repr__(self):
4625         return "<xmlDtd (%s) object at 0x%x>" % (self.name, id (self))
4626
4627     #
4628     # xmlDtd functions from module debugXML
4629     #
4630
4631     def debugDumpDTD(self, output):
4632         """Dumps debug information for the DTD """
4633         libxml2mod.xmlDebugDumpDTD(output, self._o)
4634
4635     #
4636     # xmlDtd functions from module tree
4637     #
4638
4639     def copyDtd(self):
4640         """Do a copy of the dtd. """
4641         ret = libxml2mod.xmlCopyDtd(self._o)
4642         if ret is None:raise treeError('xmlCopyDtd() failed')
4643         __tmp = xmlDtd(_obj=ret)
4644         return __tmp
4645
4646     def freeDtd(self):
4647         """Free a DTD structure. """
4648         libxml2mod.xmlFreeDtd(self._o)
4649
4650     #
4651     # xmlDtd functions from module valid
4652     #
4653
4654     def dtdAttrDesc(self, elem, name):
4655         """Search the DTD for the description of this attribute on
4656            this element. """
4657         ret = libxml2mod.xmlGetDtdAttrDesc(self._o, elem, name)
4658         if ret is None:raise treeError('xmlGetDtdAttrDesc() failed')
4659         __tmp = xmlAttribute(_obj=ret)
4660         return __tmp
4661
4662     def dtdElementDesc(self, name):
4663         """Search the DTD for the description of this element """
4664         ret = libxml2mod.xmlGetDtdElementDesc(self._o, name)
4665         if ret is None:raise treeError('xmlGetDtdElementDesc() failed')
4666         __tmp = xmlElement(_obj=ret)
4667         return __tmp
4668
4669     def dtdQAttrDesc(self, elem, name, prefix):
4670         """Search the DTD for the description of this qualified
4671            attribute on this element. """
4672         ret = libxml2mod.xmlGetDtdQAttrDesc(self._o, elem, name, prefix)
4673         if ret is None:raise treeError('xmlGetDtdQAttrDesc() failed')
4674         __tmp = xmlAttribute(_obj=ret)
4675         return __tmp
4676
4677     def dtdQElementDesc(self, name, prefix):
4678         """Search the DTD for the description of this element """
4679         ret = libxml2mod.xmlGetDtdQElementDesc(self._o, name, prefix)
4680         if ret is None:raise treeError('xmlGetDtdQElementDesc() failed')
4681         __tmp = xmlElement(_obj=ret)
4682         return __tmp
4683
4684 class xmlNs(xmlNode):
4685     def __init__(self, _obj=None):
4686         self._o = None
4687         xmlNode.__init__(self, _obj=_obj)
4688
4689     def __repr__(self):
4690         return "<xmlNs (%s) object at 0x%x>" % (self.name, id (self))
4691
4692     #
4693     # xmlNs functions from module tree
4694     #
4695
4696     def copyNamespace(self):
4697         """Do a copy of the namespace. """
4698         ret = libxml2mod.xmlCopyNamespace(self._o)
4699         if ret is None:raise treeError('xmlCopyNamespace() failed')
4700         __tmp = xmlNs(_obj=ret)
4701         return __tmp
4702
4703     def copyNamespaceList(self):
4704         """Do a copy of an namespace list. """
4705         ret = libxml2mod.xmlCopyNamespaceList(self._o)
4706         if ret is None:raise treeError('xmlCopyNamespaceList() failed')
4707         __tmp = xmlNs(_obj=ret)
4708         return __tmp
4709
4710     def freeNs(self):
4711         """Free up the structures associated to a namespace """
4712         libxml2mod.xmlFreeNs(self._o)
4713
4714     def freeNsList(self):
4715         """Free up all the structures associated to the chained
4716            namespaces. """
4717         libxml2mod.xmlFreeNsList(self._o)
4718
4719     def newNodeEatName(self, name):
4720         """Creation of a new node element. @ns is optional (None). """
4721         ret = libxml2mod.xmlNewNodeEatName(self._o, name)
4722         if ret is None:raise treeError('xmlNewNodeEatName() failed')
4723         __tmp = xmlNode(_obj=ret)
4724         return __tmp
4725
4726     #
4727     # xmlNs functions from module xpathInternals
4728     #
4729
4730     def xpathNodeSetFreeNs(self):
4731         """Namespace node in libxml don't match the XPath semantic. In
4732            a node set the namespace nodes are duplicated and the next
4733            pointer is set to the parent node in the XPath semantic.
4734            Check if such a node need to be freed """
4735         libxml2mod.xmlXPathNodeSetFreeNs(self._o)
4736
4737 class inputBuffer(ioReadWrapper):
4738     def __init__(self, _obj=None):
4739         self._o = None
4740         ioReadWrapper.__init__(self, _obj=_obj)
4741
4742     def __del__(self):
4743         if self._o != None:
4744             libxml2mod.xmlFreeParserInputBuffer(self._o)
4745         self._o = None
4746
4747     #
4748     # inputBuffer functions from module xmlIO
4749     #
4750
4751     def freeParserInputBuffer(self):
4752         """Free up the memory used by a buffered parser input """
4753         libxml2mod.xmlFreeParserInputBuffer(self._o)
4754
4755     def grow(self, len):
4756         """Grow up the content of the input buffer, the old data are
4757            preserved This routine handle the I18N transcoding to
4758            internal UTF-8 This routine is used when operating the
4759            parser in normal (pull) mode  TODO: one should be able to
4760            remove one extra copy by copying directly onto in->buffer
4761            or in->raw """
4762         ret = libxml2mod.xmlParserInputBufferGrow(self._o, len)
4763         return ret
4764
4765     def push(self, len, buf):
4766         """Push the content of the arry in the input buffer This
4767            routine handle the I18N transcoding to internal UTF-8 This
4768            is used when operating the parser in progressive (push)
4769            mode. """
4770         ret = libxml2mod.xmlParserInputBufferPush(self._o, len, buf)
4771         return ret
4772
4773     def read(self, len):
4774         """Refresh the content of the input buffer, the old data are
4775            considered consumed This routine handle the I18N
4776            transcoding to internal UTF-8 """
4777         ret = libxml2mod.xmlParserInputBufferRead(self._o, len)
4778         return ret
4779
4780     #
4781     # inputBuffer functions from module xmlreader
4782     #
4783
4784     def newTextReader(self, URI):
4785         """Create an xmlTextReader structure fed with @input """
4786         ret = libxml2mod.xmlNewTextReader(self._o, URI)
4787         if ret is None:raise treeError('xmlNewTextReader() failed')
4788         __tmp = xmlTextReader(_obj=ret)
4789         __tmp.input = self
4790         return __tmp
4791
4792 class relaxNgParserCtxt:
4793     def __init__(self, _obj=None):
4794         if _obj != None:self._o = _obj;return
4795         self._o = None
4796
4797     def __del__(self):
4798         if self._o != None:
4799             libxml2mod.xmlRelaxNGFreeParserCtxt(self._o)
4800         self._o = None
4801
4802     #
4803     # relaxNgParserCtxt functions from module relaxng
4804     #
4805
4806     def relaxNGFreeParserCtxt(self):
4807         """Free the resources associated to the schema parser context """
4808         libxml2mod.xmlRelaxNGFreeParserCtxt(self._o)
4809
4810     def relaxNGParse(self):
4811         """parse a schema definition resource and build an internal
4812            XML Shema struture which can be used to validate
4813            instances. *WARNING* this interface is highly subject to
4814            change """
4815         ret = libxml2mod.xmlRelaxNGParse(self._o)
4816         if ret is None:raise parserError('xmlRelaxNGParse() failed')
4817         __tmp = relaxNgSchema(_obj=ret)
4818         return __tmp
4819
4820 class outputBuffer(ioWriteWrapper):
4821     def __init__(self, _obj=None):
4822         self._o = None
4823         ioWriteWrapper.__init__(self, _obj=_obj)
4824
4825     #
4826     # outputBuffer functions from module xmlIO
4827     #
4828
4829     def close(self):
4830         """flushes and close the output I/O channel and free up all
4831            the associated resources """
4832         ret = libxml2mod.xmlOutputBufferClose(self._o)
4833         return ret
4834
4835     def flush(self):
4836         """flushes the output I/O channel """
4837         ret = libxml2mod.xmlOutputBufferFlush(self._o)
4838         return ret
4839
4840     def write(self, len, buf):
4841         """Write the content of the array in the output I/O buffer
4842            This routine handle the I18N transcoding from internal
4843            UTF-8 The buffer is lossless, i.e. will store in case of
4844            partial or delayed writes. """
4845         ret = libxml2mod.xmlOutputBufferWrite(self._o, len, buf)
4846         return ret
4847
4848     def writeString(self, str):
4849         """Write the content of the string in the output I/O buffer
4850            This routine handle the I18N transcoding from internal
4851            UTF-8 The buffer is lossless, i.e. will store in case of
4852            partial or delayed writes. """
4853         ret = libxml2mod.xmlOutputBufferWriteString(self._o, str)
4854         return ret
4855
4856 class xmlTextReaderLocator:
4857     def __init__(self, _obj=None):
4858         if _obj != None:self._o = _obj;return
4859         self._o = None
4860
4861     #
4862     # xmlTextReaderLocator functions from module xmlreader
4863     #
4864
4865     def BaseURI(self):
4866         """Obtain the base URI for the given locator. """
4867         ret = libxml2mod.xmlTextReaderLocatorBaseURI(self._o)
4868         return ret
4869
4870     def LineNumber(self):
4871         """Obtain the line number for the given locator. """
4872         ret = libxml2mod.xmlTextReaderLocatorLineNumber(self._o)
4873         return ret
4874
4875 class URI:
4876     def __init__(self, _obj=None):
4877         if _obj != None:self._o = _obj;return
4878         self._o = None
4879
4880     def __del__(self):
4881         if self._o != None:
4882             libxml2mod.xmlFreeURI(self._o)
4883         self._o = None
4884
4885     # accessors for URI
4886     def authority(self):
4887         """Get the authority part from an URI """
4888         ret = libxml2mod.xmlURIGetAuthority(self._o)
4889         return ret
4890
4891     def fragment(self):
4892         """Get the fragment part from an URI """
4893         ret = libxml2mod.xmlURIGetFragment(self._o)
4894         return ret
4895
4896     def opaque(self):
4897         """Get the opaque part from an URI """
4898         ret = libxml2mod.xmlURIGetOpaque(self._o)
4899         return ret
4900
4901     def path(self):
4902         """Get the path part from an URI """
4903         ret = libxml2mod.xmlURIGetPath(self._o)
4904         return ret
4905
4906     def port(self):
4907         """Get the port part from an URI """
4908         ret = libxml2mod.xmlURIGetPort(self._o)
4909         return ret
4910
4911     def query(self):
4912         """Get the query part from an URI """
4913         ret = libxml2mod.xmlURIGetQuery(self._o)
4914         return ret
4915
4916     def scheme(self):
4917         """Get the scheme part from an URI """
4918         ret = libxml2mod.xmlURIGetScheme(self._o)
4919         return ret
4920
4921     def server(self):
4922         """Get the server part from an URI """
4923         ret = libxml2mod.xmlURIGetServer(self._o)
4924         return ret
4925
4926     def setAuthority(self, authority):
4927         """Set the authority part of an URI. """
4928         libxml2mod.xmlURISetAuthority(self._o, authority)
4929
4930     def setFragment(self, fragment):
4931         """Set the fragment part of an URI. """
4932         libxml2mod.xmlURISetFragment(self._o, fragment)
4933
4934     def setOpaque(self, opaque):
4935         """Set the opaque part of an URI. """
4936         libxml2mod.xmlURISetOpaque(self._o, opaque)
4937
4938     def setPath(self, path):
4939         """Set the path part of an URI. """
4940         libxml2mod.xmlURISetPath(self._o, path)
4941
4942     def setPort(self, port):
4943         """Set the port part of an URI. """
4944         libxml2mod.xmlURISetPort(self._o, port)
4945
4946     def setQuery(self, query):
4947         """Set the query part of an URI. """
4948         libxml2mod.xmlURISetQuery(self._o, query)
4949
4950     def setScheme(self, scheme):
4951         """Set the scheme part of an URI. """
4952         libxml2mod.xmlURISetScheme(self._o, scheme)
4953
4954     def setServer(self, server):
4955         """Set the server part of an URI. """
4956         libxml2mod.xmlURISetServer(self._o, server)
4957
4958     def setUser(self, user):
4959         """Set the user part of an URI. """
4960         libxml2mod.xmlURISetUser(self._o, user)
4961
4962     def user(self):
4963         """Get the user part from an URI """
4964         ret = libxml2mod.xmlURIGetUser(self._o)
4965         return ret
4966
4967     #
4968     # URI functions from module uri
4969     #
4970
4971     def freeURI(self):
4972         """Free up the xmlURI struct """
4973         libxml2mod.xmlFreeURI(self._o)
4974
4975     def parseURIReference(self, str):
4976         """Parse an URI reference string and fills in the appropriate
4977            fields of the @uri structure  URI-reference = [
4978            absoluteURI | relativeURI ] [ "#" fragment ] """
4979         ret = libxml2mod.xmlParseURIReference(self._o, str)
4980         return ret
4981
4982     def printURI(self, stream):
4983         """Prints the URI in the stream @steam. """
4984         libxml2mod.xmlPrintURI(stream, self._o)
4985
4986     def saveUri(self):
4987         """Save the URI as an escaped string """
4988         ret = libxml2mod.xmlSaveUri(self._o)
4989         return ret
4990