Annotation of embedaddon/libxml2/python/libxml2class.py, revision 1.1.1.1
1.1 misho 1: #
2: # Functions from module HTMLparser
3: #
4:
5: def htmlCreateMemoryParserCtxt(buffer, size):
6: """Create a parser context for an HTML in-memory document. """
7: ret = libxml2mod.htmlCreateMemoryParserCtxt(buffer, size)
8: if ret is None:raise parserError('htmlCreateMemoryParserCtxt() failed')
9: return parserCtxt(_obj=ret)
10:
11: def htmlHandleOmittedElem(val):
12: """Set and return the previous value for handling HTML omitted
13: tags. """
14: ret = libxml2mod.htmlHandleOmittedElem(val)
15: return ret
16:
17: def htmlIsScriptAttribute(name):
18: """Check if an attribute is of content type Script """
19: ret = libxml2mod.htmlIsScriptAttribute(name)
20: return ret
21:
22: def htmlNewParserCtxt():
23: """Allocate and initialize a new parser context. """
24: ret = libxml2mod.htmlNewParserCtxt()
25: if ret is None:raise parserError('htmlNewParserCtxt() failed')
26: return parserCtxt(_obj=ret)
27:
28: def htmlParseDoc(cur, encoding):
29: """parse an HTML in-memory document and build a tree. """
30: ret = libxml2mod.htmlParseDoc(cur, encoding)
31: if ret is None:raise parserError('htmlParseDoc() failed')
32: return xmlDoc(_obj=ret)
33:
34: def htmlParseFile(filename, encoding):
35: """parse an HTML file and build a tree. Automatic support for
36: ZLIB/Compress compressed document is provided by default if
37: found at compile-time. """
38: ret = libxml2mod.htmlParseFile(filename, encoding)
39: if ret is None:raise parserError('htmlParseFile() failed')
40: return xmlDoc(_obj=ret)
41:
42: def htmlReadDoc(cur, URL, encoding, options):
43: """parse an XML in-memory document and build a tree. """
44: ret = libxml2mod.htmlReadDoc(cur, URL, encoding, options)
45: if ret is None:raise treeError('htmlReadDoc() failed')
46: return xmlDoc(_obj=ret)
47:
48: def htmlReadFd(fd, URL, encoding, options):
49: """parse an XML from a file descriptor and build a tree. """
50: ret = libxml2mod.htmlReadFd(fd, URL, encoding, options)
51: if ret is None:raise treeError('htmlReadFd() failed')
52: return xmlDoc(_obj=ret)
53:
54: def htmlReadFile(filename, encoding, options):
55: """parse an XML file from the filesystem or the network. """
56: ret = libxml2mod.htmlReadFile(filename, encoding, options)
57: if ret is None:raise treeError('htmlReadFile() failed')
58: return xmlDoc(_obj=ret)
59:
60: def htmlReadMemory(buffer, size, URL, encoding, options):
61: """parse an XML in-memory document and build a tree. """
62: ret = libxml2mod.htmlReadMemory(buffer, size, URL, encoding, options)
63: if ret is None:raise treeError('htmlReadMemory() failed')
64: return xmlDoc(_obj=ret)
65:
66: #
67: # Functions from module HTMLtree
68: #
69:
70: def htmlIsBooleanAttr(name):
71: """Determine if a given attribute is a boolean attribute. """
72: ret = libxml2mod.htmlIsBooleanAttr(name)
73: return ret
74:
75: def htmlNewDoc(URI, ExternalID):
76: """Creates a new HTML document """
77: ret = libxml2mod.htmlNewDoc(URI, ExternalID)
78: if ret is None:raise treeError('htmlNewDoc() failed')
79: return xmlDoc(_obj=ret)
80:
81: def htmlNewDocNoDtD(URI, ExternalID):
82: """Creates a new HTML document without a DTD node if @URI and
83: @ExternalID are None """
84: ret = libxml2mod.htmlNewDocNoDtD(URI, ExternalID)
85: if ret is None:raise treeError('htmlNewDocNoDtD() failed')
86: return xmlDoc(_obj=ret)
87:
88: #
89: # Functions from module SAX2
90: #
91:
92: def SAXDefaultVersion(version):
93: """Set the default version of SAX used globally by the
94: library. By default, during initialization the default is
95: set to 2. Note that it is generally a better coding style
96: to use xmlSAXVersion() to set up the version explicitly for
97: a given parsing context. """
98: ret = libxml2mod.xmlSAXDefaultVersion(version)
99: return ret
100:
101: def defaultSAXHandlerInit():
102: """Initialize the default SAX2 handler """
103: libxml2mod.xmlDefaultSAXHandlerInit()
104:
105: def docbDefaultSAXHandlerInit():
106: """Initialize the default SAX handler """
107: libxml2mod.docbDefaultSAXHandlerInit()
108:
109: def htmlDefaultSAXHandlerInit():
110: """Initialize the default SAX handler """
111: libxml2mod.htmlDefaultSAXHandlerInit()
112:
113: #
114: # Functions from module catalog
115: #
116:
117: def catalogAdd(type, orig, replace):
118: """Add an entry in the catalog, it may overwrite existing but
119: different entries. If called before any other catalog
120: routine, allows to override the default shared catalog put
121: in place by xmlInitializeCatalog(); """
122: ret = libxml2mod.xmlCatalogAdd(type, orig, replace)
123: return ret
124:
125: def catalogCleanup():
126: """Free up all the memory associated with catalogs """
127: libxml2mod.xmlCatalogCleanup()
128:
129: def catalogConvert():
130: """Convert all the SGML catalog entries as XML ones """
131: ret = libxml2mod.xmlCatalogConvert()
132: return ret
133:
134: def catalogDump(out):
135: """Dump all the global catalog content to the given file. """
136: if out is not None: out.flush()
137: libxml2mod.xmlCatalogDump(out)
138:
139: def catalogGetPublic(pubID):
140: """Try to lookup the catalog reference associated to a public
141: ID DEPRECATED, use xmlCatalogResolvePublic() """
142: ret = libxml2mod.xmlCatalogGetPublic(pubID)
143: return ret
144:
145: def catalogGetSystem(sysID):
146: """Try to lookup the catalog reference associated to a system
147: ID DEPRECATED, use xmlCatalogResolveSystem() """
148: ret = libxml2mod.xmlCatalogGetSystem(sysID)
149: return ret
150:
151: def catalogRemove(value):
152: """Remove an entry from the catalog """
153: ret = libxml2mod.xmlCatalogRemove(value)
154: return ret
155:
156: def catalogResolve(pubID, sysID):
157: """Do a complete resolution lookup of an External Identifier """
158: ret = libxml2mod.xmlCatalogResolve(pubID, sysID)
159: return ret
160:
161: def catalogResolvePublic(pubID):
162: """Try to lookup the catalog reference associated to a public
163: ID """
164: ret = libxml2mod.xmlCatalogResolvePublic(pubID)
165: return ret
166:
167: def catalogResolveSystem(sysID):
168: """Try to lookup the catalog resource for a system ID """
169: ret = libxml2mod.xmlCatalogResolveSystem(sysID)
170: return ret
171:
172: def catalogResolveURI(URI):
173: """Do a complete resolution lookup of an URI """
174: ret = libxml2mod.xmlCatalogResolveURI(URI)
175: return ret
176:
177: def catalogSetDebug(level):
178: """Used to set the debug level for catalog operation, 0
179: disable debugging, 1 enable it """
180: ret = libxml2mod.xmlCatalogSetDebug(level)
181: return ret
182:
183: def initializeCatalog():
184: """Do the catalog initialization. this function is not thread
185: safe, catalog initialization should preferably be done once
186: at startup """
187: libxml2mod.xmlInitializeCatalog()
188:
189: def loadACatalog(filename):
190: """Load the catalog and build the associated data structures.
191: This can be either an XML Catalog or an SGML Catalog It
192: will recurse in SGML CATALOG entries. On the other hand XML
193: Catalogs are not handled recursively. """
194: ret = libxml2mod.xmlLoadACatalog(filename)
195: if ret is None:raise treeError('xmlLoadACatalog() failed')
196: return catalog(_obj=ret)
197:
198: def loadCatalog(filename):
199: """Load the catalog and makes its definitions effective for
200: the default external entity loader. It will recurse in SGML
201: CATALOG entries. this function is not thread safe, catalog
202: initialization should preferably be done once at startup """
203: ret = libxml2mod.xmlLoadCatalog(filename)
204: return ret
205:
206: def loadCatalogs(pathss):
207: """Load the catalogs and makes their definitions effective for
208: the default external entity loader. this function is not
209: thread safe, catalog initialization should preferably be
210: done once at startup """
211: libxml2mod.xmlLoadCatalogs(pathss)
212:
213: def loadSGMLSuperCatalog(filename):
214: """Load an SGML super catalog. It won't expand CATALOG or
215: DELEGATE references. This is only needed for manipulating
216: SGML Super Catalogs like adding and removing CATALOG or
217: DELEGATE entries. """
218: ret = libxml2mod.xmlLoadSGMLSuperCatalog(filename)
219: if ret is None:raise treeError('xmlLoadSGMLSuperCatalog() failed')
220: return catalog(_obj=ret)
221:
222: def newCatalog(sgml):
223: """create a new Catalog. """
224: ret = libxml2mod.xmlNewCatalog(sgml)
225: if ret is None:raise treeError('xmlNewCatalog() failed')
226: return catalog(_obj=ret)
227:
228: def parseCatalogFile(filename):
229: """parse an XML file and build a tree. It's like
230: xmlParseFile() except it bypass all catalog lookups. """
231: ret = libxml2mod.xmlParseCatalogFile(filename)
232: if ret is None:raise parserError('xmlParseCatalogFile() failed')
233: return xmlDoc(_obj=ret)
234:
235: #
236: # Functions from module chvalid
237: #
238:
239: def isBaseChar(ch):
240: """This function is DEPRECATED. Use xmlIsBaseChar_ch or
241: xmlIsBaseCharQ instead """
242: ret = libxml2mod.xmlIsBaseChar(ch)
243: return ret
244:
245: def isBlank(ch):
246: """This function is DEPRECATED. Use xmlIsBlank_ch or
247: xmlIsBlankQ instead """
248: ret = libxml2mod.xmlIsBlank(ch)
249: return ret
250:
251: def isChar(ch):
252: """This function is DEPRECATED. Use xmlIsChar_ch or xmlIsCharQ
253: instead """
254: ret = libxml2mod.xmlIsChar(ch)
255: return ret
256:
257: def isCombining(ch):
258: """This function is DEPRECATED. Use xmlIsCombiningQ instead """
259: ret = libxml2mod.xmlIsCombining(ch)
260: return ret
261:
262: def isDigit(ch):
263: """This function is DEPRECATED. Use xmlIsDigit_ch or
264: xmlIsDigitQ instead """
265: ret = libxml2mod.xmlIsDigit(ch)
266: return ret
267:
268: def isExtender(ch):
269: """This function is DEPRECATED. Use xmlIsExtender_ch or
270: xmlIsExtenderQ instead """
271: ret = libxml2mod.xmlIsExtender(ch)
272: return ret
273:
274: def isIdeographic(ch):
275: """This function is DEPRECATED. Use xmlIsIdeographicQ instead """
276: ret = libxml2mod.xmlIsIdeographic(ch)
277: return ret
278:
279: def isPubidChar(ch):
280: """This function is DEPRECATED. Use xmlIsPubidChar_ch or
281: xmlIsPubidCharQ instead """
282: ret = libxml2mod.xmlIsPubidChar(ch)
283: return ret
284:
285: #
286: # Functions from module debugXML
287: #
288:
289: def boolToText(boolval):
290: """Convenient way to turn bool into text """
291: ret = libxml2mod.xmlBoolToText(boolval)
292: return ret
293:
294: def debugDumpString(output, str):
295: """Dumps informations about the string, shorten it if necessary """
296: if output is not None: output.flush()
297: libxml2mod.xmlDebugDumpString(output, str)
298:
299: def shellPrintXPathError(errorType, arg):
300: """Print the xpath error to libxml default error channel """
301: libxml2mod.xmlShellPrintXPathError(errorType, arg)
302:
303: #
304: # Functions from module dict
305: #
306:
307: def dictCleanup():
308: """Free the dictionary mutex. Do not call unless sure the
309: library is not in use anymore ! """
310: libxml2mod.xmlDictCleanup()
311:
312: def initializeDict():
313: """Do the dictionary mutex initialization. this function is
314: deprecated """
315: ret = libxml2mod.xmlInitializeDict()
316: return ret
317:
318: #
319: # Functions from module encoding
320: #
321:
322: def addEncodingAlias(name, alias):
323: """Registers an alias @alias for an encoding named @name.
324: Existing alias will be overwritten. """
325: ret = libxml2mod.xmlAddEncodingAlias(name, alias)
326: return ret
327:
328: def cleanupCharEncodingHandlers():
329: """Cleanup the memory allocated for the char encoding support,
330: it unregisters all the encoding handlers and the aliases. """
331: libxml2mod.xmlCleanupCharEncodingHandlers()
332:
333: def cleanupEncodingAliases():
334: """Unregisters all aliases """
335: libxml2mod.xmlCleanupEncodingAliases()
336:
337: def delEncodingAlias(alias):
338: """Unregisters an encoding alias @alias """
339: ret = libxml2mod.xmlDelEncodingAlias(alias)
340: return ret
341:
342: def encodingAlias(alias):
343: """Lookup an encoding name for the given alias. """
344: ret = libxml2mod.xmlGetEncodingAlias(alias)
345: return ret
346:
347: def initCharEncodingHandlers():
348: """Initialize the char encoding support, it registers the
349: default encoding supported. NOTE: while public, this
350: function usually doesn't need to be called in normal
351: processing. """
352: libxml2mod.xmlInitCharEncodingHandlers()
353:
354: #
355: # Functions from module entities
356: #
357:
358: def cleanupPredefinedEntities():
359: """Cleanup up the predefined entities table. Deprecated call """
360: libxml2mod.xmlCleanupPredefinedEntities()
361:
362: def initializePredefinedEntities():
363: """Set up the predefined entities. Deprecated call """
364: libxml2mod.xmlInitializePredefinedEntities()
365:
366: def predefinedEntity(name):
367: """Check whether this name is an predefined entity. """
368: ret = libxml2mod.xmlGetPredefinedEntity(name)
369: if ret is None:raise treeError('xmlGetPredefinedEntity() failed')
370: return xmlEntity(_obj=ret)
371:
372: #
373: # Functions from module globals
374: #
375:
376: def cleanupGlobals():
377: """Additional cleanup for multi-threading """
378: libxml2mod.xmlCleanupGlobals()
379:
380: def initGlobals():
381: """Additional initialisation for multi-threading """
382: libxml2mod.xmlInitGlobals()
383:
384: def thrDefDefaultBufferSize(v):
385: ret = libxml2mod.xmlThrDefDefaultBufferSize(v)
386: return ret
387:
388: def thrDefDoValidityCheckingDefaultValue(v):
389: ret = libxml2mod.xmlThrDefDoValidityCheckingDefaultValue(v)
390: return ret
391:
392: def thrDefGetWarningsDefaultValue(v):
393: ret = libxml2mod.xmlThrDefGetWarningsDefaultValue(v)
394: return ret
395:
396: def thrDefIndentTreeOutput(v):
397: ret = libxml2mod.xmlThrDefIndentTreeOutput(v)
398: return ret
399:
400: def thrDefKeepBlanksDefaultValue(v):
401: ret = libxml2mod.xmlThrDefKeepBlanksDefaultValue(v)
402: return ret
403:
404: def thrDefLineNumbersDefaultValue(v):
405: ret = libxml2mod.xmlThrDefLineNumbersDefaultValue(v)
406: return ret
407:
408: def thrDefLoadExtDtdDefaultValue(v):
409: ret = libxml2mod.xmlThrDefLoadExtDtdDefaultValue(v)
410: return ret
411:
412: def thrDefParserDebugEntities(v):
413: ret = libxml2mod.xmlThrDefParserDebugEntities(v)
414: return ret
415:
416: def thrDefPedanticParserDefaultValue(v):
417: ret = libxml2mod.xmlThrDefPedanticParserDefaultValue(v)
418: return ret
419:
420: def thrDefSaveNoEmptyTags(v):
421: ret = libxml2mod.xmlThrDefSaveNoEmptyTags(v)
422: return ret
423:
424: def thrDefSubstituteEntitiesDefaultValue(v):
425: ret = libxml2mod.xmlThrDefSubstituteEntitiesDefaultValue(v)
426: return ret
427:
428: def thrDefTreeIndentString(v):
429: ret = libxml2mod.xmlThrDefTreeIndentString(v)
430: return ret
431:
432: #
433: # Functions from module nanoftp
434: #
435:
436: def nanoFTPCleanup():
437: """Cleanup the FTP protocol layer. This cleanup proxy
438: informations. """
439: libxml2mod.xmlNanoFTPCleanup()
440:
441: def nanoFTPInit():
442: """Initialize the FTP protocol layer. Currently it just checks
443: for proxy informations, and get the hostname """
444: libxml2mod.xmlNanoFTPInit()
445:
446: def nanoFTPProxy(host, port, user, passwd, type):
447: """Setup the FTP proxy informations. This can also be done by
448: using ftp_proxy ftp_proxy_user and ftp_proxy_password
449: environment variables. """
450: libxml2mod.xmlNanoFTPProxy(host, port, user, passwd, type)
451:
452: def nanoFTPScanProxy(URL):
453: """(Re)Initialize the FTP Proxy context by parsing the URL and
454: finding the protocol host port it indicates. Should be like
455: ftp://myproxy/ or ftp://myproxy:3128/ A None URL cleans up
456: proxy informations. """
457: libxml2mod.xmlNanoFTPScanProxy(URL)
458:
459: #
460: # Functions from module nanohttp
461: #
462:
463: def nanoHTTPCleanup():
464: """Cleanup the HTTP protocol layer. """
465: libxml2mod.xmlNanoHTTPCleanup()
466:
467: def nanoHTTPInit():
468: """Initialize the HTTP protocol layer. Currently it just
469: checks for proxy informations """
470: libxml2mod.xmlNanoHTTPInit()
471:
472: def nanoHTTPScanProxy(URL):
473: """(Re)Initialize the HTTP Proxy context by parsing the URL
474: and finding the protocol host port it indicates. Should be
475: like http://myproxy/ or http://myproxy:3128/ A None URL
476: cleans up proxy informations. """
477: libxml2mod.xmlNanoHTTPScanProxy(URL)
478:
479: #
480: # Functions from module parser
481: #
482:
483: def createDocParserCtxt(cur):
484: """Creates a parser context for an XML in-memory document. """
485: ret = libxml2mod.xmlCreateDocParserCtxt(cur)
486: if ret is None:raise parserError('xmlCreateDocParserCtxt() failed')
487: return parserCtxt(_obj=ret)
488:
489: def initParser():
490: """Initialization function for the XML parser. This is not
491: reentrant. Call once before processing in case of use in
492: multithreaded programs. """
493: libxml2mod.xmlInitParser()
494:
495: def keepBlanksDefault(val):
496: """Set and return the previous value for default blanks text
497: nodes support. The 1.x version of the parser used an
498: heuristic to try to detect ignorable white spaces. As a
499: result the SAX callback was generating
500: xmlSAX2IgnorableWhitespace() callbacks instead of
501: characters() one, and when using the DOM output text nodes
502: containing those blanks were not generated. The 2.x and
503: later version will switch to the XML standard way and
504: ignorableWhitespace() are only generated when running the
505: parser in validating mode and when the current element
506: doesn't allow CDATA or mixed content. This function is
507: provided as a way to force the standard behavior on 1.X
508: libs and to switch back to the old mode for compatibility
509: when running 1.X client code on 2.X . Upgrade of 1.X code
510: should be done by using xmlIsBlankNode() commodity function
511: to detect the "empty" nodes generated. This value also
512: affect autogeneration of indentation when saving code if
513: blanks sections are kept, indentation is not generated. """
514: ret = libxml2mod.xmlKeepBlanksDefault(val)
515: return ret
516:
517: def lineNumbersDefault(val):
518: """Set and return the previous value for enabling line numbers
519: in elements contents. This may break on old application and
520: is turned off by default. """
521: ret = libxml2mod.xmlLineNumbersDefault(val)
522: return ret
523:
524: def newParserCtxt():
525: """Allocate and initialize a new parser context. """
526: ret = libxml2mod.xmlNewParserCtxt()
527: if ret is None:raise parserError('xmlNewParserCtxt() failed')
528: return parserCtxt(_obj=ret)
529:
530: def parseDTD(ExternalID, SystemID):
531: """Load and parse an external subset. """
532: ret = libxml2mod.xmlParseDTD(ExternalID, SystemID)
533: if ret is None:raise parserError('xmlParseDTD() failed')
534: return xmlDtd(_obj=ret)
535:
536: def parseDoc(cur):
537: """parse an XML in-memory document and build a tree. """
538: ret = libxml2mod.xmlParseDoc(cur)
539: if ret is None:raise parserError('xmlParseDoc() failed')
540: return xmlDoc(_obj=ret)
541:
542: def parseEntity(filename):
543: """parse an XML external entity out of context and build a
544: tree. [78] extParsedEnt ::= TextDecl? content This
545: correspond to a "Well Balanced" chunk """
546: ret = libxml2mod.xmlParseEntity(filename)
547: if ret is None:raise parserError('xmlParseEntity() failed')
548: return xmlDoc(_obj=ret)
549:
550: def parseFile(filename):
551: """parse an XML file and build a tree. Automatic support for
552: ZLIB/Compress compressed document is provided by default if
553: found at compile-time. """
554: ret = libxml2mod.xmlParseFile(filename)
555: if ret is None:raise parserError('xmlParseFile() failed')
556: return xmlDoc(_obj=ret)
557:
558: def parseMemory(buffer, size):
559: """parse an XML in-memory block and build a tree. """
560: ret = libxml2mod.xmlParseMemory(buffer, size)
561: if ret is None:raise parserError('xmlParseMemory() failed')
562: return xmlDoc(_obj=ret)
563:
564: def pedanticParserDefault(val):
565: """Set and return the previous value for enabling pedantic
566: warnings. """
567: ret = libxml2mod.xmlPedanticParserDefault(val)
568: return ret
569:
570: def readDoc(cur, URL, encoding, options):
571: """parse an XML in-memory document and build a tree. """
572: ret = libxml2mod.xmlReadDoc(cur, URL, encoding, options)
573: if ret is None:raise treeError('xmlReadDoc() failed')
574: return xmlDoc(_obj=ret)
575:
576: def readFd(fd, URL, encoding, options):
577: """parse an XML from a file descriptor and build a tree. NOTE
578: that the file descriptor will not be closed when the reader
579: is closed or reset. """
580: ret = libxml2mod.xmlReadFd(fd, URL, encoding, options)
581: if ret is None:raise treeError('xmlReadFd() failed')
582: return xmlDoc(_obj=ret)
583:
584: def readFile(filename, encoding, options):
585: """parse an XML file from the filesystem or the network. """
586: ret = libxml2mod.xmlReadFile(filename, encoding, options)
587: if ret is None:raise treeError('xmlReadFile() failed')
588: return xmlDoc(_obj=ret)
589:
590: def readMemory(buffer, size, URL, encoding, options):
591: """parse an XML in-memory document and build a tree. """
592: ret = libxml2mod.xmlReadMemory(buffer, size, URL, encoding, options)
593: if ret is None:raise treeError('xmlReadMemory() failed')
594: return xmlDoc(_obj=ret)
595:
596: def recoverDoc(cur):
597: """parse an XML in-memory document and build a tree. In the
598: case the document is not Well Formed, a attempt to build a
599: tree is tried anyway """
600: ret = libxml2mod.xmlRecoverDoc(cur)
601: if ret is None:raise treeError('xmlRecoverDoc() failed')
602: return xmlDoc(_obj=ret)
603:
604: def recoverFile(filename):
605: """parse an XML file and build a tree. Automatic support for
606: ZLIB/Compress compressed document is provided by default if
607: found at compile-time. In the case the document is not Well
608: Formed, it attempts to build a tree anyway """
609: ret = libxml2mod.xmlRecoverFile(filename)
610: if ret is None:raise treeError('xmlRecoverFile() failed')
611: return xmlDoc(_obj=ret)
612:
613: def recoverMemory(buffer, size):
614: """parse an XML in-memory block and build a tree. In the case
615: the document is not Well Formed, an attempt to build a tree
616: is tried anyway """
617: ret = libxml2mod.xmlRecoverMemory(buffer, size)
618: if ret is None:raise treeError('xmlRecoverMemory() failed')
619: return xmlDoc(_obj=ret)
620:
621: def substituteEntitiesDefault(val):
622: """Set and return the previous value for default entity
623: support. Initially the parser always keep entity references
624: instead of substituting entity values in the output. This
625: function has to be used to change the default parser
626: behavior SAX::substituteEntities() has to be used for
627: changing that on a file by file basis. """
628: ret = libxml2mod.xmlSubstituteEntitiesDefault(val)
629: return ret
630:
631: #
632: # Functions from module parserInternals
633: #
634:
635: def checkLanguageID(lang):
636: """Checks that the value conforms to the LanguageID
637: production: NOTE: this is somewhat deprecated, those
638: productions were removed from the XML Second edition. [33]
639: LanguageID ::= Langcode ('-' Subcode)* [34] Langcode ::=
640: ISO639Code | IanaCode | UserCode [35] ISO639Code ::=
641: ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= ('i' |
642: 'I') '-' ([a-z] | [A-Z])+ [37] UserCode ::= ('x' | 'X') '-'
643: ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+ The
644: current REC reference the sucessors of RFC 1766, currently
645: 5646 http://www.rfc-editor.org/rfc/rfc5646.txt langtag
646: = language ["-" script] ["-" region] *("-" variant) *("-"
647: extension) ["-" privateuse] language = 2*3ALPHA
648: ; shortest ISO 639 code ["-" extlang] ; sometimes
649: followed by ; extended language subtags / 4ALPHA
650: ; or reserved for future use / 5*8ALPHA ; or
651: registered language subtag extlang = 3ALPHA
652: ; selected ISO 639 codes *2("-" 3ALPHA) ; permanently
653: reserved script = 4ALPHA ; ISO 15924
654: code region = 2ALPHA ; ISO 3166-1 code
655: / 3DIGIT ; UN M.49 code variant =
656: 5*8alphanum ; registered variants / (DIGIT
657: 3alphanum) extension = singleton 1*("-" (2*8alphanum))
658: ; Single alphanumerics ; "x" reserved for private use
659: singleton = DIGIT ; 0 - 9 / %x41-57
660: ; A - W / %x59-5A ; Y - Z / %x61-77
661: ; a - w / %x79-7A ; y - z it sounds right to
662: still allow Irregular i-xxx IANA and user codes too The
663: parser below doesn't try to cope with extension or
664: privateuse that could be added but that's not interoperable
665: anyway """
666: ret = libxml2mod.xmlCheckLanguageID(lang)
667: return ret
668:
669: def copyChar(len, out, val):
670: """append the char value in the array """
671: ret = libxml2mod.xmlCopyChar(len, out, val)
672: return ret
673:
674: def copyCharMultiByte(out, val):
675: """append the char value in the array """
676: ret = libxml2mod.xmlCopyCharMultiByte(out, val)
677: return ret
678:
679: def createEntityParserCtxt(URL, ID, base):
680: """Create a parser context for an external entity Automatic
681: support for ZLIB/Compress compressed document is provided
682: by default if found at compile-time. """
683: ret = libxml2mod.xmlCreateEntityParserCtxt(URL, ID, base)
684: if ret is None:raise parserError('xmlCreateEntityParserCtxt() failed')
685: return parserCtxt(_obj=ret)
686:
687: def createFileParserCtxt(filename):
688: """Create a parser context for a file content. Automatic
689: support for ZLIB/Compress compressed document is provided
690: by default if found at compile-time. """
691: ret = libxml2mod.xmlCreateFileParserCtxt(filename)
692: if ret is None:raise parserError('xmlCreateFileParserCtxt() failed')
693: return parserCtxt(_obj=ret)
694:
695: def createMemoryParserCtxt(buffer, size):
696: """Create a parser context for an XML in-memory document. """
697: ret = libxml2mod.xmlCreateMemoryParserCtxt(buffer, size)
698: if ret is None:raise parserError('xmlCreateMemoryParserCtxt() failed')
699: return parserCtxt(_obj=ret)
700:
701: def createURLParserCtxt(filename, options):
702: """Create a parser context for a file or URL content.
703: Automatic support for ZLIB/Compress compressed document is
704: provided by default if found at compile-time and for file
705: accesses """
706: ret = libxml2mod.xmlCreateURLParserCtxt(filename, options)
707: if ret is None:raise parserError('xmlCreateURLParserCtxt() failed')
708: return parserCtxt(_obj=ret)
709:
710: def htmlCreateFileParserCtxt(filename, encoding):
711: """Create a parser context for a file content. Automatic
712: support for ZLIB/Compress compressed document is provided
713: by default if found at compile-time. """
714: ret = libxml2mod.htmlCreateFileParserCtxt(filename, encoding)
715: if ret is None:raise parserError('htmlCreateFileParserCtxt() failed')
716: return parserCtxt(_obj=ret)
717:
718: def htmlInitAutoClose():
719: """Initialize the htmlStartCloseIndex for fast lookup of
720: closing tags names. This is not reentrant. Call
721: xmlInitParser() once before processing in case of use in
722: multithreaded programs. """
723: libxml2mod.htmlInitAutoClose()
724:
725: def isLetter(c):
726: """Check whether the character is allowed by the production
727: [84] Letter ::= BaseChar | Ideographic """
728: ret = libxml2mod.xmlIsLetter(c)
729: return ret
730:
731: def namePop(ctxt):
732: """Pops the top element name from the name stack """
733: if ctxt is None: ctxt__o = None
734: else: ctxt__o = ctxt._o
735: ret = libxml2mod.namePop(ctxt__o)
736: return ret
737:
738: def namePush(ctxt, value):
739: """Pushes a new element name on top of the name stack """
740: if ctxt is None: ctxt__o = None
741: else: ctxt__o = ctxt._o
742: ret = libxml2mod.namePush(ctxt__o, value)
743: return ret
744:
745: def nodePop(ctxt):
746: """Pops the top element node from the node stack """
747: if ctxt is None: ctxt__o = None
748: else: ctxt__o = ctxt._o
749: ret = libxml2mod.nodePop(ctxt__o)
750: if ret is None:raise treeError('nodePop() failed')
751: return xmlNode(_obj=ret)
752:
753: def nodePush(ctxt, value):
754: """Pushes a new element node on top of the node stack """
755: if ctxt is None: ctxt__o = None
756: else: ctxt__o = ctxt._o
757: if value is None: value__o = None
758: else: value__o = value._o
759: ret = libxml2mod.nodePush(ctxt__o, value__o)
760: return ret
761:
762: #
763: # Functions from module python
764: #
765:
766: def SAXParseFile(SAX, URI, recover):
767: """Interface to parse an XML file or resource pointed by an
768: URI to build an event flow to the SAX object """
769: libxml2mod.xmlSAXParseFile(SAX, URI, recover)
770:
771: def createInputBuffer(file, encoding):
772: """Create a libxml2 input buffer from a Python file """
773: ret = libxml2mod.xmlCreateInputBuffer(file, encoding)
774: if ret is None:raise treeError('xmlCreateInputBuffer() failed')
775: return inputBuffer(_obj=ret)
776:
777: def createOutputBuffer(file, encoding):
778: """Create a libxml2 output buffer from a Python file """
779: ret = libxml2mod.xmlCreateOutputBuffer(file, encoding)
780: if ret is None:raise treeError('xmlCreateOutputBuffer() failed')
781: return outputBuffer(_obj=ret)
782:
783: def createPushParser(SAX, chunk, size, URI):
784: """Create a progressive XML parser context to build either an
785: event flow if the SAX object is not None, or a DOM tree
786: otherwise. """
787: ret = libxml2mod.xmlCreatePushParser(SAX, chunk, size, URI)
788: if ret is None:raise parserError('xmlCreatePushParser() failed')
789: return parserCtxt(_obj=ret)
790:
791: def debugMemory(activate):
792: """Switch on the generation of line number for elements nodes.
793: Also returns the number of bytes allocated and not freed by
794: libxml2 since memory debugging was switched on. """
795: ret = libxml2mod.xmlDebugMemory(activate)
796: return ret
797:
798: def dumpMemory():
799: """dump the memory allocated in the file .memdump """
800: libxml2mod.xmlDumpMemory()
801:
802: def htmlCreatePushParser(SAX, chunk, size, URI):
803: """Create a progressive HTML parser context to build either an
804: event flow if the SAX object is not None, or a DOM tree
805: otherwise. """
806: ret = libxml2mod.htmlCreatePushParser(SAX, chunk, size, URI)
807: if ret is None:raise parserError('htmlCreatePushParser() failed')
808: return parserCtxt(_obj=ret)
809:
810: def htmlSAXParseFile(SAX, URI, encoding):
811: """Interface to parse an HTML file or resource pointed by an
812: URI to build an event flow to the SAX object """
813: libxml2mod.htmlSAXParseFile(SAX, URI, encoding)
814:
815: def memoryUsed():
816: """Returns the total amount of memory allocated by libxml2 """
817: ret = libxml2mod.xmlMemoryUsed()
818: return ret
819:
820: def newNode(name):
821: """Create a new Node """
822: ret = libxml2mod.xmlNewNode(name)
823: if ret is None:raise treeError('xmlNewNode() failed')
824: return xmlNode(_obj=ret)
825:
826: def pythonCleanupParser():
827: """Cleanup function for the XML library. It tries to reclaim
828: all parsing related global memory allocated for the library
829: processing. It doesn't deallocate any document related
830: memory. Calling this function should not prevent reusing
831: the library but one should call xmlCleanupParser() only
832: when the process has finished using the library or XML
833: document built with it. """
834: libxml2mod.xmlPythonCleanupParser()
835:
836: def setEntityLoader(resolver):
837: """Set the entity resolver as a python function """
838: ret = libxml2mod.xmlSetEntityLoader(resolver)
839: return ret
840:
841: #
842: # Functions from module relaxng
843: #
844:
845: def relaxNGCleanupTypes():
846: """Cleanup the default Schemas type library associated to
847: RelaxNG """
848: libxml2mod.xmlRelaxNGCleanupTypes()
849:
850: def relaxNGInitTypes():
851: """Initilize the default type libraries. """
852: ret = libxml2mod.xmlRelaxNGInitTypes()
853: return ret
854:
855: def relaxNGNewMemParserCtxt(buffer, size):
856: """Create an XML RelaxNGs parse context for that memory buffer
857: expected to contain an XML RelaxNGs file. """
858: ret = libxml2mod.xmlRelaxNGNewMemParserCtxt(buffer, size)
859: if ret is None:raise parserError('xmlRelaxNGNewMemParserCtxt() failed')
860: return relaxNgParserCtxt(_obj=ret)
861:
862: def relaxNGNewParserCtxt(URL):
863: """Create an XML RelaxNGs parse context for that file/resource
864: expected to contain an XML RelaxNGs file. """
865: ret = libxml2mod.xmlRelaxNGNewParserCtxt(URL)
866: if ret is None:raise parserError('xmlRelaxNGNewParserCtxt() failed')
867: return relaxNgParserCtxt(_obj=ret)
868:
869: #
870: # Functions from module tree
871: #
872:
873: def buildQName(ncname, prefix, memory, len):
874: """Builds the QName @prefix:@ncname in @memory if there is
875: enough space and prefix is not None nor empty, otherwise
876: allocate a new string. If prefix is None or empty it
877: returns ncname. """
878: ret = libxml2mod.xmlBuildQName(ncname, prefix, memory, len)
879: return ret
880:
881: def compressMode():
882: """get the default compression mode used, ZLIB based. """
883: ret = libxml2mod.xmlGetCompressMode()
884: return ret
885:
886: def isXHTML(systemID, publicID):
887: """Try to find if the document correspond to an XHTML DTD """
888: ret = libxml2mod.xmlIsXHTML(systemID, publicID)
889: return ret
890:
891: def newComment(content):
892: """Creation of a new node containing a comment. """
893: ret = libxml2mod.xmlNewComment(content)
894: if ret is None:raise treeError('xmlNewComment() failed')
895: return xmlNode(_obj=ret)
896:
897: def newDoc(version):
898: """Creates a new XML document """
899: ret = libxml2mod.xmlNewDoc(version)
900: if ret is None:raise treeError('xmlNewDoc() failed')
901: return xmlDoc(_obj=ret)
902:
903: def newPI(name, content):
904: """Creation of a processing instruction element. Use
905: xmlDocNewPI preferably to get string interning """
906: ret = libxml2mod.xmlNewPI(name, content)
907: if ret is None:raise treeError('xmlNewPI() failed')
908: return xmlNode(_obj=ret)
909:
910: def newText(content):
911: """Creation of a new text node. """
912: ret = libxml2mod.xmlNewText(content)
913: if ret is None:raise treeError('xmlNewText() failed')
914: return xmlNode(_obj=ret)
915:
916: def newTextLen(content, len):
917: """Creation of a new text node with an extra parameter for the
918: content's length """
919: ret = libxml2mod.xmlNewTextLen(content, len)
920: if ret is None:raise treeError('xmlNewTextLen() failed')
921: return xmlNode(_obj=ret)
922:
923: def setCompressMode(mode):
924: """set the default compression mode used, ZLIB based Correct
925: values: 0 (uncompressed) to 9 (max compression) """
926: libxml2mod.xmlSetCompressMode(mode)
927:
928: def validateNCName(value, space):
929: """Check that a value conforms to the lexical space of NCName """
930: ret = libxml2mod.xmlValidateNCName(value, space)
931: return ret
932:
933: def validateNMToken(value, space):
934: """Check that a value conforms to the lexical space of NMToken """
935: ret = libxml2mod.xmlValidateNMToken(value, space)
936: return ret
937:
938: def validateName(value, space):
939: """Check that a value conforms to the lexical space of Name """
940: ret = libxml2mod.xmlValidateName(value, space)
941: return ret
942:
943: def validateQName(value, space):
944: """Check that a value conforms to the lexical space of QName """
945: ret = libxml2mod.xmlValidateQName(value, space)
946: return ret
947:
948: #
949: # Functions from module uri
950: #
951:
952: def URIEscape(str):
953: """Escaping routine, does not do validity checks ! It will try
954: to escape the chars needing this, but this is heuristic
955: based it's impossible to be sure. """
956: ret = libxml2mod.xmlURIEscape(str)
957: return ret
958:
959: def URIEscapeStr(str, list):
960: """This routine escapes a string to hex, ignoring reserved
961: characters (a-z) and the characters in the exception list. """
962: ret = libxml2mod.xmlURIEscapeStr(str, list)
963: return ret
964:
965: def URIUnescapeString(str, len, target):
966: """Unescaping routine, but does not check that the string is
967: an URI. The output is a direct unsigned char translation of
968: %XX values (no encoding) Note that the length of the result
969: can only be smaller or same size as the input string. """
970: ret = libxml2mod.xmlURIUnescapeString(str, len, target)
971: return ret
972:
973: def buildRelativeURI(URI, base):
974: """Expresses the URI of the reference in terms relative to the
975: base. Some examples of this operation include: base =
976: "http://site1.com/docs/book1.html" URI input
977: URI returned docs/pic1.gif pic1.gif
978: docs/img/pic1.gif img/pic1.gif img/pic1.gif
979: ../img/pic1.gif http://site1.com/docs/pic1.gif pic1.gif
980: http://site2.com/docs/pic1.gif
981: http://site2.com/docs/pic1.gif base = "docs/book1.html"
982: URI input URI returned docs/pic1.gif
983: pic1.gif docs/img/pic1.gif img/pic1.gif
984: img/pic1.gif ../img/pic1.gif
985: http://site1.com/docs/pic1.gif
986: http://site1.com/docs/pic1.gif Note: if the URI reference
987: is really wierd or complicated, it may be worthwhile to
988: first convert it into a "nice" one by calling xmlBuildURI
989: (using 'base') before calling this routine, since this
990: routine (for reasonable efficiency) assumes URI has already
991: been through some validation. """
992: ret = libxml2mod.xmlBuildRelativeURI(URI, base)
993: return ret
994:
995: def buildURI(URI, base):
996: """Computes he final URI of the reference done by checking
997: that the given URI is valid, and building the final URI
998: using the base URI. This is processed according to section
999: 5.2 of the RFC 2396 5.2. Resolving Relative References to
1000: Absolute Form """
1001: ret = libxml2mod.xmlBuildURI(URI, base)
1002: return ret
1003:
1004: def canonicPath(path):
1005: """Constructs a canonic path from the specified path. """
1006: ret = libxml2mod.xmlCanonicPath(path)
1007: return ret
1008:
1009: def createURI():
1010: """Simply creates an empty xmlURI """
1011: ret = libxml2mod.xmlCreateURI()
1012: if ret is None:raise uriError('xmlCreateURI() failed')
1013: return URI(_obj=ret)
1014:
1015: def normalizeURIPath(path):
1016: """Applies the 5 normalization steps to a path string--that
1017: is, RFC 2396 Section 5.2, steps 6.c through 6.g.
1018: Normalization occurs directly on the string, no new
1019: allocation is done """
1020: ret = libxml2mod.xmlNormalizeURIPath(path)
1021: return ret
1022:
1023: def parseURI(str):
1024: """Parse an URI based on RFC 3986 URI-reference = [
1025: absoluteURI | relativeURI ] [ "#" fragment ] """
1026: ret = libxml2mod.xmlParseURI(str)
1027: if ret is None:raise uriError('xmlParseURI() failed')
1028: return URI(_obj=ret)
1029:
1030: def parseURIRaw(str, raw):
1031: """Parse an URI but allows to keep intact the original
1032: fragments. URI-reference = URI / relative-ref """
1033: ret = libxml2mod.xmlParseURIRaw(str, raw)
1034: if ret is None:raise uriError('xmlParseURIRaw() failed')
1035: return URI(_obj=ret)
1036:
1037: def pathToURI(path):
1038: """Constructs an URI expressing the existing path """
1039: ret = libxml2mod.xmlPathToURI(path)
1040: return ret
1041:
1042: #
1043: # Functions from module valid
1044: #
1045:
1046: def newValidCtxt():
1047: """Allocate a validation context structure. """
1048: ret = libxml2mod.xmlNewValidCtxt()
1049: if ret is None:raise treeError('xmlNewValidCtxt() failed')
1050: return ValidCtxt(_obj=ret)
1051:
1052: def validateNameValue(value):
1053: """Validate that the given value match Name production """
1054: ret = libxml2mod.xmlValidateNameValue(value)
1055: return ret
1056:
1057: def validateNamesValue(value):
1058: """Validate that the given value match Names production """
1059: ret = libxml2mod.xmlValidateNamesValue(value)
1060: return ret
1061:
1062: def validateNmtokenValue(value):
1063: """Validate that the given value match Nmtoken production [
1064: VC: Name Token ] """
1065: ret = libxml2mod.xmlValidateNmtokenValue(value)
1066: return ret
1067:
1068: def validateNmtokensValue(value):
1069: """Validate that the given value match Nmtokens production [
1070: VC: Name Token ] """
1071: ret = libxml2mod.xmlValidateNmtokensValue(value)
1072: return ret
1073:
1074: #
1075: # Functions from module xmlIO
1076: #
1077:
1078: def checkFilename(path):
1079: """function checks to see if @path is a valid source (file,
1080: socket...) for XML. if stat is not available on the target
1081: machine, """
1082: ret = libxml2mod.xmlCheckFilename(path)
1083: return ret
1084:
1085: def cleanupInputCallbacks():
1086: """clears the entire input callback table. this includes the
1087: compiled-in I/O. """
1088: libxml2mod.xmlCleanupInputCallbacks()
1089:
1090: def cleanupOutputCallbacks():
1091: """clears the entire output callback table. this includes the
1092: compiled-in I/O callbacks. """
1093: libxml2mod.xmlCleanupOutputCallbacks()
1094:
1095: def fileMatch(filename):
1096: """input from FILE * """
1097: ret = libxml2mod.xmlFileMatch(filename)
1098: return ret
1099:
1100: def iOFTPMatch(filename):
1101: """check if the URI matches an FTP one """
1102: ret = libxml2mod.xmlIOFTPMatch(filename)
1103: return ret
1104:
1105: def iOHTTPMatch(filename):
1106: """check if the URI matches an HTTP one """
1107: ret = libxml2mod.xmlIOHTTPMatch(filename)
1108: return ret
1109:
1110: def normalizeWindowsPath(path):
1111: """This function is obsolete. Please see xmlURIFromPath in
1112: uri.c for a better solution. """
1113: ret = libxml2mod.xmlNormalizeWindowsPath(path)
1114: return ret
1115:
1116: def parserGetDirectory(filename):
1117: """lookup the directory for that file """
1118: ret = libxml2mod.xmlParserGetDirectory(filename)
1119: return ret
1120:
1121: def registerDefaultInputCallbacks():
1122: """Registers the default compiled-in I/O handlers. """
1123: libxml2mod.xmlRegisterDefaultInputCallbacks()
1124:
1125: def registerDefaultOutputCallbacks():
1126: """Registers the default compiled-in I/O handlers. """
1127: libxml2mod.xmlRegisterDefaultOutputCallbacks()
1128:
1129: def registerHTTPPostCallbacks():
1130: """By default, libxml submits HTTP output requests using the
1131: "PUT" method. Calling this method changes the HTTP output
1132: method to use the "POST" method instead. """
1133: libxml2mod.xmlRegisterHTTPPostCallbacks()
1134:
1135: #
1136: # Functions from module xmlerror
1137: #
1138:
1139: def lastError():
1140: """Get the last global error registered. This is per thread if
1141: compiled with thread support. """
1142: ret = libxml2mod.xmlGetLastError()
1143: if ret is None:raise treeError('xmlGetLastError() failed')
1144: return Error(_obj=ret)
1145:
1146: def resetLastError():
1147: """Cleanup the last global error registered. For parsing error
1148: this does not change the well-formedness result. """
1149: libxml2mod.xmlResetLastError()
1150:
1151: #
1152: # Functions from module xmlreader
1153: #
1154:
1155: def newTextReaderFilename(URI):
1156: """Create an xmlTextReader structure fed with the resource at
1157: @URI """
1158: ret = libxml2mod.xmlNewTextReaderFilename(URI)
1159: if ret is None:raise treeError('xmlNewTextReaderFilename() failed')
1160: return xmlTextReader(_obj=ret)
1161:
1162: def readerForDoc(cur, URL, encoding, options):
1163: """Create an xmltextReader for an XML in-memory document. The
1164: parsing flags @options are a combination of xmlParserOption. """
1165: ret = libxml2mod.xmlReaderForDoc(cur, URL, encoding, options)
1166: if ret is None:raise treeError('xmlReaderForDoc() failed')
1167: return xmlTextReader(_obj=ret)
1168:
1169: def readerForFd(fd, URL, encoding, options):
1170: """Create an xmltextReader for an XML from a file descriptor.
1171: The parsing flags @options are a combination of
1172: xmlParserOption. NOTE that the file descriptor will not be
1173: closed when the reader is closed or reset. """
1174: ret = libxml2mod.xmlReaderForFd(fd, URL, encoding, options)
1175: if ret is None:raise treeError('xmlReaderForFd() failed')
1176: return xmlTextReader(_obj=ret)
1177:
1178: def readerForFile(filename, encoding, options):
1179: """parse an XML file from the filesystem or the network. The
1180: parsing flags @options are a combination of xmlParserOption. """
1181: ret = libxml2mod.xmlReaderForFile(filename, encoding, options)
1182: if ret is None:raise treeError('xmlReaderForFile() failed')
1183: return xmlTextReader(_obj=ret)
1184:
1185: def readerForMemory(buffer, size, URL, encoding, options):
1186: """Create an xmltextReader for an XML in-memory document. The
1187: parsing flags @options are a combination of xmlParserOption. """
1188: ret = libxml2mod.xmlReaderForMemory(buffer, size, URL, encoding, options)
1189: if ret is None:raise treeError('xmlReaderForMemory() failed')
1190: return xmlTextReader(_obj=ret)
1191:
1192: #
1193: # Functions from module xmlregexp
1194: #
1195:
1196: def regexpCompile(regexp):
1197: """Parses a regular expression conforming to XML Schemas Part
1198: 2 Datatype Appendix F and builds an automata suitable for
1199: testing strings against that regular expression """
1200: ret = libxml2mod.xmlRegexpCompile(regexp)
1201: if ret is None:raise treeError('xmlRegexpCompile() failed')
1202: return xmlReg(_obj=ret)
1203:
1204: #
1205: # Functions from module xmlschemas
1206: #
1207:
1208: def schemaNewMemParserCtxt(buffer, size):
1209: """Create an XML Schemas parse context for that memory buffer
1210: expected to contain an XML Schemas file. """
1211: ret = libxml2mod.xmlSchemaNewMemParserCtxt(buffer, size)
1212: if ret is None:raise parserError('xmlSchemaNewMemParserCtxt() failed')
1213: return SchemaParserCtxt(_obj=ret)
1214:
1215: def schemaNewParserCtxt(URL):
1216: """Create an XML Schemas parse context for that file/resource
1217: expected to contain an XML Schemas file. """
1218: ret = libxml2mod.xmlSchemaNewParserCtxt(URL)
1219: if ret is None:raise parserError('xmlSchemaNewParserCtxt() failed')
1220: return SchemaParserCtxt(_obj=ret)
1221:
1222: #
1223: # Functions from module xmlschemastypes
1224: #
1225:
1226: def schemaCleanupTypes():
1227: """Cleanup the default XML Schemas type library """
1228: libxml2mod.xmlSchemaCleanupTypes()
1229:
1230: def schemaCollapseString(value):
1231: """Removes and normalize white spaces in the string """
1232: ret = libxml2mod.xmlSchemaCollapseString(value)
1233: return ret
1234:
1235: def schemaInitTypes():
1236: """Initialize the default XML Schemas type library """
1237: libxml2mod.xmlSchemaInitTypes()
1238:
1239: def schemaWhiteSpaceReplace(value):
1240: """Replaces 0xd, 0x9 and 0xa with a space. """
1241: ret = libxml2mod.xmlSchemaWhiteSpaceReplace(value)
1242: return ret
1243:
1244: #
1245: # Functions from module xmlstring
1246: #
1247:
1248: def UTF8Charcmp(utf1, utf2):
1249: """compares the two UCS4 values """
1250: ret = libxml2mod.xmlUTF8Charcmp(utf1, utf2)
1251: return ret
1252:
1253: def UTF8Size(utf):
1254: """calculates the internal size of a UTF8 character """
1255: ret = libxml2mod.xmlUTF8Size(utf)
1256: return ret
1257:
1258: def UTF8Strlen(utf):
1259: """compute the length of an UTF8 string, it doesn't do a full
1260: UTF8 checking of the content of the string. """
1261: ret = libxml2mod.xmlUTF8Strlen(utf)
1262: return ret
1263:
1264: def UTF8Strloc(utf, utfchar):
1265: """a function to provide the relative location of a UTF8 char """
1266: ret = libxml2mod.xmlUTF8Strloc(utf, utfchar)
1267: return ret
1268:
1269: def UTF8Strndup(utf, len):
1270: """a strndup for array of UTF8's """
1271: ret = libxml2mod.xmlUTF8Strndup(utf, len)
1272: return ret
1273:
1274: def UTF8Strpos(utf, pos):
1275: """a function to provide the equivalent of fetching a
1276: character from a string array """
1277: ret = libxml2mod.xmlUTF8Strpos(utf, pos)
1278: return ret
1279:
1280: def UTF8Strsize(utf, len):
1281: """storage size of an UTF8 string the behaviour is not
1282: garanteed if the input string is not UTF-8 """
1283: ret = libxml2mod.xmlUTF8Strsize(utf, len)
1284: return ret
1285:
1286: def UTF8Strsub(utf, start, len):
1287: """Create a substring from a given UTF-8 string Note:
1288: positions are given in units of UTF-8 chars """
1289: ret = libxml2mod.xmlUTF8Strsub(utf, start, len)
1290: return ret
1291:
1292: def checkUTF8(utf):
1293: """Checks @utf for being valid UTF-8. @utf is assumed to be
1294: null-terminated. This function is not super-strict, as it
1295: will allow longer UTF-8 sequences than necessary. Note that
1296: Java is capable of producing these sequences if provoked.
1297: Also note, this routine checks for the 4-byte maximum size,
1298: but does not check for 0x10ffff maximum value. """
1299: ret = libxml2mod.xmlCheckUTF8(utf)
1300: return ret
1301:
1302: #
1303: # Functions from module xmlunicode
1304: #
1305:
1306: def uCSIsAegeanNumbers(code):
1307: """Check whether the character is part of AegeanNumbers UCS
1308: Block """
1309: ret = libxml2mod.xmlUCSIsAegeanNumbers(code)
1310: return ret
1311:
1312: def uCSIsAlphabeticPresentationForms(code):
1313: """Check whether the character is part of
1314: AlphabeticPresentationForms UCS Block """
1315: ret = libxml2mod.xmlUCSIsAlphabeticPresentationForms(code)
1316: return ret
1317:
1318: def uCSIsArabic(code):
1319: """Check whether the character is part of Arabic UCS Block """
1320: ret = libxml2mod.xmlUCSIsArabic(code)
1321: return ret
1322:
1323: def uCSIsArabicPresentationFormsA(code):
1324: """Check whether the character is part of
1325: ArabicPresentationForms-A UCS Block """
1326: ret = libxml2mod.xmlUCSIsArabicPresentationFormsA(code)
1327: return ret
1328:
1329: def uCSIsArabicPresentationFormsB(code):
1330: """Check whether the character is part of
1331: ArabicPresentationForms-B UCS Block """
1332: ret = libxml2mod.xmlUCSIsArabicPresentationFormsB(code)
1333: return ret
1334:
1335: def uCSIsArmenian(code):
1336: """Check whether the character is part of Armenian UCS Block """
1337: ret = libxml2mod.xmlUCSIsArmenian(code)
1338: return ret
1339:
1340: def uCSIsArrows(code):
1341: """Check whether the character is part of Arrows UCS Block """
1342: ret = libxml2mod.xmlUCSIsArrows(code)
1343: return ret
1344:
1345: def uCSIsBasicLatin(code):
1346: """Check whether the character is part of BasicLatin UCS Block """
1347: ret = libxml2mod.xmlUCSIsBasicLatin(code)
1348: return ret
1349:
1350: def uCSIsBengali(code):
1351: """Check whether the character is part of Bengali UCS Block """
1352: ret = libxml2mod.xmlUCSIsBengali(code)
1353: return ret
1354:
1355: def uCSIsBlock(code, block):
1356: """Check whether the character is part of the UCS Block """
1357: ret = libxml2mod.xmlUCSIsBlock(code, block)
1358: return ret
1359:
1360: def uCSIsBlockElements(code):
1361: """Check whether the character is part of BlockElements UCS
1362: Block """
1363: ret = libxml2mod.xmlUCSIsBlockElements(code)
1364: return ret
1365:
1366: def uCSIsBopomofo(code):
1367: """Check whether the character is part of Bopomofo UCS Block """
1368: ret = libxml2mod.xmlUCSIsBopomofo(code)
1369: return ret
1370:
1371: def uCSIsBopomofoExtended(code):
1372: """Check whether the character is part of BopomofoExtended UCS
1373: Block """
1374: ret = libxml2mod.xmlUCSIsBopomofoExtended(code)
1375: return ret
1376:
1377: def uCSIsBoxDrawing(code):
1378: """Check whether the character is part of BoxDrawing UCS Block """
1379: ret = libxml2mod.xmlUCSIsBoxDrawing(code)
1380: return ret
1381:
1382: def uCSIsBraillePatterns(code):
1383: """Check whether the character is part of BraillePatterns UCS
1384: Block """
1385: ret = libxml2mod.xmlUCSIsBraillePatterns(code)
1386: return ret
1387:
1388: def uCSIsBuhid(code):
1389: """Check whether the character is part of Buhid UCS Block """
1390: ret = libxml2mod.xmlUCSIsBuhid(code)
1391: return ret
1392:
1393: def uCSIsByzantineMusicalSymbols(code):
1394: """Check whether the character is part of
1395: ByzantineMusicalSymbols UCS Block """
1396: ret = libxml2mod.xmlUCSIsByzantineMusicalSymbols(code)
1397: return ret
1398:
1399: def uCSIsCJKCompatibility(code):
1400: """Check whether the character is part of CJKCompatibility UCS
1401: Block """
1402: ret = libxml2mod.xmlUCSIsCJKCompatibility(code)
1403: return ret
1404:
1405: def uCSIsCJKCompatibilityForms(code):
1406: """Check whether the character is part of
1407: CJKCompatibilityForms UCS Block """
1408: ret = libxml2mod.xmlUCSIsCJKCompatibilityForms(code)
1409: return ret
1410:
1411: def uCSIsCJKCompatibilityIdeographs(code):
1412: """Check whether the character is part of
1413: CJKCompatibilityIdeographs UCS Block """
1414: ret = libxml2mod.xmlUCSIsCJKCompatibilityIdeographs(code)
1415: return ret
1416:
1417: def uCSIsCJKCompatibilityIdeographsSupplement(code):
1418: """Check whether the character is part of
1419: CJKCompatibilityIdeographsSupplement UCS Block """
1420: ret = libxml2mod.xmlUCSIsCJKCompatibilityIdeographsSupplement(code)
1421: return ret
1422:
1423: def uCSIsCJKRadicalsSupplement(code):
1424: """Check whether the character is part of
1425: CJKRadicalsSupplement UCS Block """
1426: ret = libxml2mod.xmlUCSIsCJKRadicalsSupplement(code)
1427: return ret
1428:
1429: def uCSIsCJKSymbolsandPunctuation(code):
1430: """Check whether the character is part of
1431: CJKSymbolsandPunctuation UCS Block """
1432: ret = libxml2mod.xmlUCSIsCJKSymbolsandPunctuation(code)
1433: return ret
1434:
1435: def uCSIsCJKUnifiedIdeographs(code):
1436: """Check whether the character is part of CJKUnifiedIdeographs
1437: UCS Block """
1438: ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographs(code)
1439: return ret
1440:
1441: def uCSIsCJKUnifiedIdeographsExtensionA(code):
1442: """Check whether the character is part of
1443: CJKUnifiedIdeographsExtensionA UCS Block """
1444: ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographsExtensionA(code)
1445: return ret
1446:
1447: def uCSIsCJKUnifiedIdeographsExtensionB(code):
1448: """Check whether the character is part of
1449: CJKUnifiedIdeographsExtensionB UCS Block """
1450: ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographsExtensionB(code)
1451: return ret
1452:
1453: def uCSIsCat(code, cat):
1454: """Check whether the character is part of the UCS Category """
1455: ret = libxml2mod.xmlUCSIsCat(code, cat)
1456: return ret
1457:
1458: def uCSIsCatC(code):
1459: """Check whether the character is part of C UCS Category """
1460: ret = libxml2mod.xmlUCSIsCatC(code)
1461: return ret
1462:
1463: def uCSIsCatCc(code):
1464: """Check whether the character is part of Cc UCS Category """
1465: ret = libxml2mod.xmlUCSIsCatCc(code)
1466: return ret
1467:
1468: def uCSIsCatCf(code):
1469: """Check whether the character is part of Cf UCS Category """
1470: ret = libxml2mod.xmlUCSIsCatCf(code)
1471: return ret
1472:
1473: def uCSIsCatCo(code):
1474: """Check whether the character is part of Co UCS Category """
1475: ret = libxml2mod.xmlUCSIsCatCo(code)
1476: return ret
1477:
1478: def uCSIsCatCs(code):
1479: """Check whether the character is part of Cs UCS Category """
1480: ret = libxml2mod.xmlUCSIsCatCs(code)
1481: return ret
1482:
1483: def uCSIsCatL(code):
1484: """Check whether the character is part of L UCS Category """
1485: ret = libxml2mod.xmlUCSIsCatL(code)
1486: return ret
1487:
1488: def uCSIsCatLl(code):
1489: """Check whether the character is part of Ll UCS Category """
1490: ret = libxml2mod.xmlUCSIsCatLl(code)
1491: return ret
1492:
1493: def uCSIsCatLm(code):
1494: """Check whether the character is part of Lm UCS Category """
1495: ret = libxml2mod.xmlUCSIsCatLm(code)
1496: return ret
1497:
1498: def uCSIsCatLo(code):
1499: """Check whether the character is part of Lo UCS Category """
1500: ret = libxml2mod.xmlUCSIsCatLo(code)
1501: return ret
1502:
1503: def uCSIsCatLt(code):
1504: """Check whether the character is part of Lt UCS Category """
1505: ret = libxml2mod.xmlUCSIsCatLt(code)
1506: return ret
1507:
1508: def uCSIsCatLu(code):
1509: """Check whether the character is part of Lu UCS Category """
1510: ret = libxml2mod.xmlUCSIsCatLu(code)
1511: return ret
1512:
1513: def uCSIsCatM(code):
1514: """Check whether the character is part of M UCS Category """
1515: ret = libxml2mod.xmlUCSIsCatM(code)
1516: return ret
1517:
1518: def uCSIsCatMc(code):
1519: """Check whether the character is part of Mc UCS Category """
1520: ret = libxml2mod.xmlUCSIsCatMc(code)
1521: return ret
1522:
1523: def uCSIsCatMe(code):
1524: """Check whether the character is part of Me UCS Category """
1525: ret = libxml2mod.xmlUCSIsCatMe(code)
1526: return ret
1527:
1528: def uCSIsCatMn(code):
1529: """Check whether the character is part of Mn UCS Category """
1530: ret = libxml2mod.xmlUCSIsCatMn(code)
1531: return ret
1532:
1533: def uCSIsCatN(code):
1534: """Check whether the character is part of N UCS Category """
1535: ret = libxml2mod.xmlUCSIsCatN(code)
1536: return ret
1537:
1538: def uCSIsCatNd(code):
1539: """Check whether the character is part of Nd UCS Category """
1540: ret = libxml2mod.xmlUCSIsCatNd(code)
1541: return ret
1542:
1543: def uCSIsCatNl(code):
1544: """Check whether the character is part of Nl UCS Category """
1545: ret = libxml2mod.xmlUCSIsCatNl(code)
1546: return ret
1547:
1548: def uCSIsCatNo(code):
1549: """Check whether the character is part of No UCS Category """
1550: ret = libxml2mod.xmlUCSIsCatNo(code)
1551: return ret
1552:
1553: def uCSIsCatP(code):
1554: """Check whether the character is part of P UCS Category """
1555: ret = libxml2mod.xmlUCSIsCatP(code)
1556: return ret
1557:
1558: def uCSIsCatPc(code):
1559: """Check whether the character is part of Pc UCS Category """
1560: ret = libxml2mod.xmlUCSIsCatPc(code)
1561: return ret
1562:
1563: def uCSIsCatPd(code):
1564: """Check whether the character is part of Pd UCS Category """
1565: ret = libxml2mod.xmlUCSIsCatPd(code)
1566: return ret
1567:
1568: def uCSIsCatPe(code):
1569: """Check whether the character is part of Pe UCS Category """
1570: ret = libxml2mod.xmlUCSIsCatPe(code)
1571: return ret
1572:
1573: def uCSIsCatPf(code):
1574: """Check whether the character is part of Pf UCS Category """
1575: ret = libxml2mod.xmlUCSIsCatPf(code)
1576: return ret
1577:
1578: def uCSIsCatPi(code):
1579: """Check whether the character is part of Pi UCS Category """
1580: ret = libxml2mod.xmlUCSIsCatPi(code)
1581: return ret
1582:
1583: def uCSIsCatPo(code):
1584: """Check whether the character is part of Po UCS Category """
1585: ret = libxml2mod.xmlUCSIsCatPo(code)
1586: return ret
1587:
1588: def uCSIsCatPs(code):
1589: """Check whether the character is part of Ps UCS Category """
1590: ret = libxml2mod.xmlUCSIsCatPs(code)
1591: return ret
1592:
1593: def uCSIsCatS(code):
1594: """Check whether the character is part of S UCS Category """
1595: ret = libxml2mod.xmlUCSIsCatS(code)
1596: return ret
1597:
1598: def uCSIsCatSc(code):
1599: """Check whether the character is part of Sc UCS Category """
1600: ret = libxml2mod.xmlUCSIsCatSc(code)
1601: return ret
1602:
1603: def uCSIsCatSk(code):
1604: """Check whether the character is part of Sk UCS Category """
1605: ret = libxml2mod.xmlUCSIsCatSk(code)
1606: return ret
1607:
1608: def uCSIsCatSm(code):
1609: """Check whether the character is part of Sm UCS Category """
1610: ret = libxml2mod.xmlUCSIsCatSm(code)
1611: return ret
1612:
1613: def uCSIsCatSo(code):
1614: """Check whether the character is part of So UCS Category """
1615: ret = libxml2mod.xmlUCSIsCatSo(code)
1616: return ret
1617:
1618: def uCSIsCatZ(code):
1619: """Check whether the character is part of Z UCS Category """
1620: ret = libxml2mod.xmlUCSIsCatZ(code)
1621: return ret
1622:
1623: def uCSIsCatZl(code):
1624: """Check whether the character is part of Zl UCS Category """
1625: ret = libxml2mod.xmlUCSIsCatZl(code)
1626: return ret
1627:
1628: def uCSIsCatZp(code):
1629: """Check whether the character is part of Zp UCS Category """
1630: ret = libxml2mod.xmlUCSIsCatZp(code)
1631: return ret
1632:
1633: def uCSIsCatZs(code):
1634: """Check whether the character is part of Zs UCS Category """
1635: ret = libxml2mod.xmlUCSIsCatZs(code)
1636: return ret
1637:
1638: def uCSIsCherokee(code):
1639: """Check whether the character is part of Cherokee UCS Block """
1640: ret = libxml2mod.xmlUCSIsCherokee(code)
1641: return ret
1642:
1643: def uCSIsCombiningDiacriticalMarks(code):
1644: """Check whether the character is part of
1645: CombiningDiacriticalMarks UCS Block """
1646: ret = libxml2mod.xmlUCSIsCombiningDiacriticalMarks(code)
1647: return ret
1648:
1649: def uCSIsCombiningDiacriticalMarksforSymbols(code):
1650: """Check whether the character is part of
1651: CombiningDiacriticalMarksforSymbols UCS Block """
1652: ret = libxml2mod.xmlUCSIsCombiningDiacriticalMarksforSymbols(code)
1653: return ret
1654:
1655: def uCSIsCombiningHalfMarks(code):
1656: """Check whether the character is part of CombiningHalfMarks
1657: UCS Block """
1658: ret = libxml2mod.xmlUCSIsCombiningHalfMarks(code)
1659: return ret
1660:
1661: def uCSIsCombiningMarksforSymbols(code):
1662: """Check whether the character is part of
1663: CombiningMarksforSymbols UCS Block """
1664: ret = libxml2mod.xmlUCSIsCombiningMarksforSymbols(code)
1665: return ret
1666:
1667: def uCSIsControlPictures(code):
1668: """Check whether the character is part of ControlPictures UCS
1669: Block """
1670: ret = libxml2mod.xmlUCSIsControlPictures(code)
1671: return ret
1672:
1673: def uCSIsCurrencySymbols(code):
1674: """Check whether the character is part of CurrencySymbols UCS
1675: Block """
1676: ret = libxml2mod.xmlUCSIsCurrencySymbols(code)
1677: return ret
1678:
1679: def uCSIsCypriotSyllabary(code):
1680: """Check whether the character is part of CypriotSyllabary UCS
1681: Block """
1682: ret = libxml2mod.xmlUCSIsCypriotSyllabary(code)
1683: return ret
1684:
1685: def uCSIsCyrillic(code):
1686: """Check whether the character is part of Cyrillic UCS Block """
1687: ret = libxml2mod.xmlUCSIsCyrillic(code)
1688: return ret
1689:
1690: def uCSIsCyrillicSupplement(code):
1691: """Check whether the character is part of CyrillicSupplement
1692: UCS Block """
1693: ret = libxml2mod.xmlUCSIsCyrillicSupplement(code)
1694: return ret
1695:
1696: def uCSIsDeseret(code):
1697: """Check whether the character is part of Deseret UCS Block """
1698: ret = libxml2mod.xmlUCSIsDeseret(code)
1699: return ret
1700:
1701: def uCSIsDevanagari(code):
1702: """Check whether the character is part of Devanagari UCS Block """
1703: ret = libxml2mod.xmlUCSIsDevanagari(code)
1704: return ret
1705:
1706: def uCSIsDingbats(code):
1707: """Check whether the character is part of Dingbats UCS Block """
1708: ret = libxml2mod.xmlUCSIsDingbats(code)
1709: return ret
1710:
1711: def uCSIsEnclosedAlphanumerics(code):
1712: """Check whether the character is part of
1713: EnclosedAlphanumerics UCS Block """
1714: ret = libxml2mod.xmlUCSIsEnclosedAlphanumerics(code)
1715: return ret
1716:
1717: def uCSIsEnclosedCJKLettersandMonths(code):
1718: """Check whether the character is part of
1719: EnclosedCJKLettersandMonths UCS Block """
1720: ret = libxml2mod.xmlUCSIsEnclosedCJKLettersandMonths(code)
1721: return ret
1722:
1723: def uCSIsEthiopic(code):
1724: """Check whether the character is part of Ethiopic UCS Block """
1725: ret = libxml2mod.xmlUCSIsEthiopic(code)
1726: return ret
1727:
1728: def uCSIsGeneralPunctuation(code):
1729: """Check whether the character is part of GeneralPunctuation
1730: UCS Block """
1731: ret = libxml2mod.xmlUCSIsGeneralPunctuation(code)
1732: return ret
1733:
1734: def uCSIsGeometricShapes(code):
1735: """Check whether the character is part of GeometricShapes UCS
1736: Block """
1737: ret = libxml2mod.xmlUCSIsGeometricShapes(code)
1738: return ret
1739:
1740: def uCSIsGeorgian(code):
1741: """Check whether the character is part of Georgian UCS Block """
1742: ret = libxml2mod.xmlUCSIsGeorgian(code)
1743: return ret
1744:
1745: def uCSIsGothic(code):
1746: """Check whether the character is part of Gothic UCS Block """
1747: ret = libxml2mod.xmlUCSIsGothic(code)
1748: return ret
1749:
1750: def uCSIsGreek(code):
1751: """Check whether the character is part of Greek UCS Block """
1752: ret = libxml2mod.xmlUCSIsGreek(code)
1753: return ret
1754:
1755: def uCSIsGreekExtended(code):
1756: """Check whether the character is part of GreekExtended UCS
1757: Block """
1758: ret = libxml2mod.xmlUCSIsGreekExtended(code)
1759: return ret
1760:
1761: def uCSIsGreekandCoptic(code):
1762: """Check whether the character is part of GreekandCoptic UCS
1763: Block """
1764: ret = libxml2mod.xmlUCSIsGreekandCoptic(code)
1765: return ret
1766:
1767: def uCSIsGujarati(code):
1768: """Check whether the character is part of Gujarati UCS Block """
1769: ret = libxml2mod.xmlUCSIsGujarati(code)
1770: return ret
1771:
1772: def uCSIsGurmukhi(code):
1773: """Check whether the character is part of Gurmukhi UCS Block """
1774: ret = libxml2mod.xmlUCSIsGurmukhi(code)
1775: return ret
1776:
1777: def uCSIsHalfwidthandFullwidthForms(code):
1778: """Check whether the character is part of
1779: HalfwidthandFullwidthForms UCS Block """
1780: ret = libxml2mod.xmlUCSIsHalfwidthandFullwidthForms(code)
1781: return ret
1782:
1783: def uCSIsHangulCompatibilityJamo(code):
1784: """Check whether the character is part of
1785: HangulCompatibilityJamo UCS Block """
1786: ret = libxml2mod.xmlUCSIsHangulCompatibilityJamo(code)
1787: return ret
1788:
1789: def uCSIsHangulJamo(code):
1790: """Check whether the character is part of HangulJamo UCS Block """
1791: ret = libxml2mod.xmlUCSIsHangulJamo(code)
1792: return ret
1793:
1794: def uCSIsHangulSyllables(code):
1795: """Check whether the character is part of HangulSyllables UCS
1796: Block """
1797: ret = libxml2mod.xmlUCSIsHangulSyllables(code)
1798: return ret
1799:
1800: def uCSIsHanunoo(code):
1801: """Check whether the character is part of Hanunoo UCS Block """
1802: ret = libxml2mod.xmlUCSIsHanunoo(code)
1803: return ret
1804:
1805: def uCSIsHebrew(code):
1806: """Check whether the character is part of Hebrew UCS Block """
1807: ret = libxml2mod.xmlUCSIsHebrew(code)
1808: return ret
1809:
1810: def uCSIsHighPrivateUseSurrogates(code):
1811: """Check whether the character is part of
1812: HighPrivateUseSurrogates UCS Block """
1813: ret = libxml2mod.xmlUCSIsHighPrivateUseSurrogates(code)
1814: return ret
1815:
1816: def uCSIsHighSurrogates(code):
1817: """Check whether the character is part of HighSurrogates UCS
1818: Block """
1819: ret = libxml2mod.xmlUCSIsHighSurrogates(code)
1820: return ret
1821:
1822: def uCSIsHiragana(code):
1823: """Check whether the character is part of Hiragana UCS Block """
1824: ret = libxml2mod.xmlUCSIsHiragana(code)
1825: return ret
1826:
1827: def uCSIsIPAExtensions(code):
1828: """Check whether the character is part of IPAExtensions UCS
1829: Block """
1830: ret = libxml2mod.xmlUCSIsIPAExtensions(code)
1831: return ret
1832:
1833: def uCSIsIdeographicDescriptionCharacters(code):
1834: """Check whether the character is part of
1835: IdeographicDescriptionCharacters UCS Block """
1836: ret = libxml2mod.xmlUCSIsIdeographicDescriptionCharacters(code)
1837: return ret
1838:
1839: def uCSIsKanbun(code):
1840: """Check whether the character is part of Kanbun UCS Block """
1841: ret = libxml2mod.xmlUCSIsKanbun(code)
1842: return ret
1843:
1844: def uCSIsKangxiRadicals(code):
1845: """Check whether the character is part of KangxiRadicals UCS
1846: Block """
1847: ret = libxml2mod.xmlUCSIsKangxiRadicals(code)
1848: return ret
1849:
1850: def uCSIsKannada(code):
1851: """Check whether the character is part of Kannada UCS Block """
1852: ret = libxml2mod.xmlUCSIsKannada(code)
1853: return ret
1854:
1855: def uCSIsKatakana(code):
1856: """Check whether the character is part of Katakana UCS Block """
1857: ret = libxml2mod.xmlUCSIsKatakana(code)
1858: return ret
1859:
1860: def uCSIsKatakanaPhoneticExtensions(code):
1861: """Check whether the character is part of
1862: KatakanaPhoneticExtensions UCS Block """
1863: ret = libxml2mod.xmlUCSIsKatakanaPhoneticExtensions(code)
1864: return ret
1865:
1866: def uCSIsKhmer(code):
1867: """Check whether the character is part of Khmer UCS Block """
1868: ret = libxml2mod.xmlUCSIsKhmer(code)
1869: return ret
1870:
1871: def uCSIsKhmerSymbols(code):
1872: """Check whether the character is part of KhmerSymbols UCS
1873: Block """
1874: ret = libxml2mod.xmlUCSIsKhmerSymbols(code)
1875: return ret
1876:
1877: def uCSIsLao(code):
1878: """Check whether the character is part of Lao UCS Block """
1879: ret = libxml2mod.xmlUCSIsLao(code)
1880: return ret
1881:
1882: def uCSIsLatin1Supplement(code):
1883: """Check whether the character is part of Latin-1Supplement
1884: UCS Block """
1885: ret = libxml2mod.xmlUCSIsLatin1Supplement(code)
1886: return ret
1887:
1888: def uCSIsLatinExtendedA(code):
1889: """Check whether the character is part of LatinExtended-A UCS
1890: Block """
1891: ret = libxml2mod.xmlUCSIsLatinExtendedA(code)
1892: return ret
1893:
1894: def uCSIsLatinExtendedAdditional(code):
1895: """Check whether the character is part of
1896: LatinExtendedAdditional UCS Block """
1897: ret = libxml2mod.xmlUCSIsLatinExtendedAdditional(code)
1898: return ret
1899:
1900: def uCSIsLatinExtendedB(code):
1901: """Check whether the character is part of LatinExtended-B UCS
1902: Block """
1903: ret = libxml2mod.xmlUCSIsLatinExtendedB(code)
1904: return ret
1905:
1906: def uCSIsLetterlikeSymbols(code):
1907: """Check whether the character is part of LetterlikeSymbols
1908: UCS Block """
1909: ret = libxml2mod.xmlUCSIsLetterlikeSymbols(code)
1910: return ret
1911:
1912: def uCSIsLimbu(code):
1913: """Check whether the character is part of Limbu UCS Block """
1914: ret = libxml2mod.xmlUCSIsLimbu(code)
1915: return ret
1916:
1917: def uCSIsLinearBIdeograms(code):
1918: """Check whether the character is part of LinearBIdeograms UCS
1919: Block """
1920: ret = libxml2mod.xmlUCSIsLinearBIdeograms(code)
1921: return ret
1922:
1923: def uCSIsLinearBSyllabary(code):
1924: """Check whether the character is part of LinearBSyllabary UCS
1925: Block """
1926: ret = libxml2mod.xmlUCSIsLinearBSyllabary(code)
1927: return ret
1928:
1929: def uCSIsLowSurrogates(code):
1930: """Check whether the character is part of LowSurrogates UCS
1931: Block """
1932: ret = libxml2mod.xmlUCSIsLowSurrogates(code)
1933: return ret
1934:
1935: def uCSIsMalayalam(code):
1936: """Check whether the character is part of Malayalam UCS Block """
1937: ret = libxml2mod.xmlUCSIsMalayalam(code)
1938: return ret
1939:
1940: def uCSIsMathematicalAlphanumericSymbols(code):
1941: """Check whether the character is part of
1942: MathematicalAlphanumericSymbols UCS Block """
1943: ret = libxml2mod.xmlUCSIsMathematicalAlphanumericSymbols(code)
1944: return ret
1945:
1946: def uCSIsMathematicalOperators(code):
1947: """Check whether the character is part of
1948: MathematicalOperators UCS Block """
1949: ret = libxml2mod.xmlUCSIsMathematicalOperators(code)
1950: return ret
1951:
1952: def uCSIsMiscellaneousMathematicalSymbolsA(code):
1953: """Check whether the character is part of
1954: MiscellaneousMathematicalSymbols-A UCS Block """
1955: ret = libxml2mod.xmlUCSIsMiscellaneousMathematicalSymbolsA(code)
1956: return ret
1957:
1958: def uCSIsMiscellaneousMathematicalSymbolsB(code):
1959: """Check whether the character is part of
1960: MiscellaneousMathematicalSymbols-B UCS Block """
1961: ret = libxml2mod.xmlUCSIsMiscellaneousMathematicalSymbolsB(code)
1962: return ret
1963:
1964: def uCSIsMiscellaneousSymbols(code):
1965: """Check whether the character is part of MiscellaneousSymbols
1966: UCS Block """
1967: ret = libxml2mod.xmlUCSIsMiscellaneousSymbols(code)
1968: return ret
1969:
1970: def uCSIsMiscellaneousSymbolsandArrows(code):
1971: """Check whether the character is part of
1972: MiscellaneousSymbolsandArrows UCS Block """
1973: ret = libxml2mod.xmlUCSIsMiscellaneousSymbolsandArrows(code)
1974: return ret
1975:
1976: def uCSIsMiscellaneousTechnical(code):
1977: """Check whether the character is part of
1978: MiscellaneousTechnical UCS Block """
1979: ret = libxml2mod.xmlUCSIsMiscellaneousTechnical(code)
1980: return ret
1981:
1982: def uCSIsMongolian(code):
1983: """Check whether the character is part of Mongolian UCS Block """
1984: ret = libxml2mod.xmlUCSIsMongolian(code)
1985: return ret
1986:
1987: def uCSIsMusicalSymbols(code):
1988: """Check whether the character is part of MusicalSymbols UCS
1989: Block """
1990: ret = libxml2mod.xmlUCSIsMusicalSymbols(code)
1991: return ret
1992:
1993: def uCSIsMyanmar(code):
1994: """Check whether the character is part of Myanmar UCS Block """
1995: ret = libxml2mod.xmlUCSIsMyanmar(code)
1996: return ret
1997:
1998: def uCSIsNumberForms(code):
1999: """Check whether the character is part of NumberForms UCS Block """
2000: ret = libxml2mod.xmlUCSIsNumberForms(code)
2001: return ret
2002:
2003: def uCSIsOgham(code):
2004: """Check whether the character is part of Ogham UCS Block """
2005: ret = libxml2mod.xmlUCSIsOgham(code)
2006: return ret
2007:
2008: def uCSIsOldItalic(code):
2009: """Check whether the character is part of OldItalic UCS Block """
2010: ret = libxml2mod.xmlUCSIsOldItalic(code)
2011: return ret
2012:
2013: def uCSIsOpticalCharacterRecognition(code):
2014: """Check whether the character is part of
2015: OpticalCharacterRecognition UCS Block """
2016: ret = libxml2mod.xmlUCSIsOpticalCharacterRecognition(code)
2017: return ret
2018:
2019: def uCSIsOriya(code):
2020: """Check whether the character is part of Oriya UCS Block """
2021: ret = libxml2mod.xmlUCSIsOriya(code)
2022: return ret
2023:
2024: def uCSIsOsmanya(code):
2025: """Check whether the character is part of Osmanya UCS Block """
2026: ret = libxml2mod.xmlUCSIsOsmanya(code)
2027: return ret
2028:
2029: def uCSIsPhoneticExtensions(code):
2030: """Check whether the character is part of PhoneticExtensions
2031: UCS Block """
2032: ret = libxml2mod.xmlUCSIsPhoneticExtensions(code)
2033: return ret
2034:
2035: def uCSIsPrivateUse(code):
2036: """Check whether the character is part of PrivateUse UCS Block """
2037: ret = libxml2mod.xmlUCSIsPrivateUse(code)
2038: return ret
2039:
2040: def uCSIsPrivateUseArea(code):
2041: """Check whether the character is part of PrivateUseArea UCS
2042: Block """
2043: ret = libxml2mod.xmlUCSIsPrivateUseArea(code)
2044: return ret
2045:
2046: def uCSIsRunic(code):
2047: """Check whether the character is part of Runic UCS Block """
2048: ret = libxml2mod.xmlUCSIsRunic(code)
2049: return ret
2050:
2051: def uCSIsShavian(code):
2052: """Check whether the character is part of Shavian UCS Block """
2053: ret = libxml2mod.xmlUCSIsShavian(code)
2054: return ret
2055:
2056: def uCSIsSinhala(code):
2057: """Check whether the character is part of Sinhala UCS Block """
2058: ret = libxml2mod.xmlUCSIsSinhala(code)
2059: return ret
2060:
2061: def uCSIsSmallFormVariants(code):
2062: """Check whether the character is part of SmallFormVariants
2063: UCS Block """
2064: ret = libxml2mod.xmlUCSIsSmallFormVariants(code)
2065: return ret
2066:
2067: def uCSIsSpacingModifierLetters(code):
2068: """Check whether the character is part of
2069: SpacingModifierLetters UCS Block """
2070: ret = libxml2mod.xmlUCSIsSpacingModifierLetters(code)
2071: return ret
2072:
2073: def uCSIsSpecials(code):
2074: """Check whether the character is part of Specials UCS Block """
2075: ret = libxml2mod.xmlUCSIsSpecials(code)
2076: return ret
2077:
2078: def uCSIsSuperscriptsandSubscripts(code):
2079: """Check whether the character is part of
2080: SuperscriptsandSubscripts UCS Block """
2081: ret = libxml2mod.xmlUCSIsSuperscriptsandSubscripts(code)
2082: return ret
2083:
2084: def uCSIsSupplementalArrowsA(code):
2085: """Check whether the character is part of SupplementalArrows-A
2086: UCS Block """
2087: ret = libxml2mod.xmlUCSIsSupplementalArrowsA(code)
2088: return ret
2089:
2090: def uCSIsSupplementalArrowsB(code):
2091: """Check whether the character is part of SupplementalArrows-B
2092: UCS Block """
2093: ret = libxml2mod.xmlUCSIsSupplementalArrowsB(code)
2094: return ret
2095:
2096: def uCSIsSupplementalMathematicalOperators(code):
2097: """Check whether the character is part of
2098: SupplementalMathematicalOperators UCS Block """
2099: ret = libxml2mod.xmlUCSIsSupplementalMathematicalOperators(code)
2100: return ret
2101:
2102: def uCSIsSupplementaryPrivateUseAreaA(code):
2103: """Check whether the character is part of
2104: SupplementaryPrivateUseArea-A UCS Block """
2105: ret = libxml2mod.xmlUCSIsSupplementaryPrivateUseAreaA(code)
2106: return ret
2107:
2108: def uCSIsSupplementaryPrivateUseAreaB(code):
2109: """Check whether the character is part of
2110: SupplementaryPrivateUseArea-B UCS Block """
2111: ret = libxml2mod.xmlUCSIsSupplementaryPrivateUseAreaB(code)
2112: return ret
2113:
2114: def uCSIsSyriac(code):
2115: """Check whether the character is part of Syriac UCS Block """
2116: ret = libxml2mod.xmlUCSIsSyriac(code)
2117: return ret
2118:
2119: def uCSIsTagalog(code):
2120: """Check whether the character is part of Tagalog UCS Block """
2121: ret = libxml2mod.xmlUCSIsTagalog(code)
2122: return ret
2123:
2124: def uCSIsTagbanwa(code):
2125: """Check whether the character is part of Tagbanwa UCS Block """
2126: ret = libxml2mod.xmlUCSIsTagbanwa(code)
2127: return ret
2128:
2129: def uCSIsTags(code):
2130: """Check whether the character is part of Tags UCS Block """
2131: ret = libxml2mod.xmlUCSIsTags(code)
2132: return ret
2133:
2134: def uCSIsTaiLe(code):
2135: """Check whether the character is part of TaiLe UCS Block """
2136: ret = libxml2mod.xmlUCSIsTaiLe(code)
2137: return ret
2138:
2139: def uCSIsTaiXuanJingSymbols(code):
2140: """Check whether the character is part of TaiXuanJingSymbols
2141: UCS Block """
2142: ret = libxml2mod.xmlUCSIsTaiXuanJingSymbols(code)
2143: return ret
2144:
2145: def uCSIsTamil(code):
2146: """Check whether the character is part of Tamil UCS Block """
2147: ret = libxml2mod.xmlUCSIsTamil(code)
2148: return ret
2149:
2150: def uCSIsTelugu(code):
2151: """Check whether the character is part of Telugu UCS Block """
2152: ret = libxml2mod.xmlUCSIsTelugu(code)
2153: return ret
2154:
2155: def uCSIsThaana(code):
2156: """Check whether the character is part of Thaana UCS Block """
2157: ret = libxml2mod.xmlUCSIsThaana(code)
2158: return ret
2159:
2160: def uCSIsThai(code):
2161: """Check whether the character is part of Thai UCS Block """
2162: ret = libxml2mod.xmlUCSIsThai(code)
2163: return ret
2164:
2165: def uCSIsTibetan(code):
2166: """Check whether the character is part of Tibetan UCS Block """
2167: ret = libxml2mod.xmlUCSIsTibetan(code)
2168: return ret
2169:
2170: def uCSIsUgaritic(code):
2171: """Check whether the character is part of Ugaritic UCS Block """
2172: ret = libxml2mod.xmlUCSIsUgaritic(code)
2173: return ret
2174:
2175: def uCSIsUnifiedCanadianAboriginalSyllabics(code):
2176: """Check whether the character is part of
2177: UnifiedCanadianAboriginalSyllabics UCS Block """
2178: ret = libxml2mod.xmlUCSIsUnifiedCanadianAboriginalSyllabics(code)
2179: return ret
2180:
2181: def uCSIsVariationSelectors(code):
2182: """Check whether the character is part of VariationSelectors
2183: UCS Block """
2184: ret = libxml2mod.xmlUCSIsVariationSelectors(code)
2185: return ret
2186:
2187: def uCSIsVariationSelectorsSupplement(code):
2188: """Check whether the character is part of
2189: VariationSelectorsSupplement UCS Block """
2190: ret = libxml2mod.xmlUCSIsVariationSelectorsSupplement(code)
2191: return ret
2192:
2193: def uCSIsYiRadicals(code):
2194: """Check whether the character is part of YiRadicals UCS Block """
2195: ret = libxml2mod.xmlUCSIsYiRadicals(code)
2196: return ret
2197:
2198: def uCSIsYiSyllables(code):
2199: """Check whether the character is part of YiSyllables UCS Block """
2200: ret = libxml2mod.xmlUCSIsYiSyllables(code)
2201: return ret
2202:
2203: def uCSIsYijingHexagramSymbols(code):
2204: """Check whether the character is part of
2205: YijingHexagramSymbols UCS Block """
2206: ret = libxml2mod.xmlUCSIsYijingHexagramSymbols(code)
2207: return ret
2208:
2209: #
2210: # Functions from module xmlversion
2211: #
2212:
2213: def checkVersion(version):
2214: """check the compiled lib version against the include one.
2215: This can warn or immediately kill the application """
2216: libxml2mod.xmlCheckVersion(version)
2217:
2218: #
2219: # Functions from module xpathInternals
2220: #
2221:
2222: def valuePop(ctxt):
2223: """Pops the top XPath object from the value stack """
2224: if ctxt is None: ctxt__o = None
2225: else: ctxt__o = ctxt._o
2226: ret = libxml2mod.valuePop(ctxt__o)
2227: return ret
2228:
2229: class xmlNode(xmlCore):
2230: def __init__(self, _obj=None):
2231: if checkWrapper(_obj) != 0: raise TypeError('xmlNode got a wrong wrapper object type')
2232: self._o = _obj
2233: xmlCore.__init__(self, _obj=_obj)
2234:
2235: def __repr__(self):
2236: return "<xmlNode (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
2237:
2238: # accessors for xmlNode
2239: def ns(self):
2240: """Get the namespace of a node """
2241: ret = libxml2mod.xmlNodeGetNs(self._o)
2242: if ret is None:return None
2243: __tmp = xmlNs(_obj=ret)
2244: return __tmp
2245:
2246: def nsDefs(self):
2247: """Get the namespace of a node """
2248: ret = libxml2mod.xmlNodeGetNsDefs(self._o)
2249: if ret is None:return None
2250: __tmp = xmlNs(_obj=ret)
2251: return __tmp
2252:
2253: #
2254: # xmlNode functions from module debugXML
2255: #
2256:
2257: def debugDumpNode(self, output, depth):
2258: """Dumps debug information for the element node, it is
2259: recursive """
2260: libxml2mod.xmlDebugDumpNode(output, self._o, depth)
2261:
2262: def debugDumpNodeList(self, output, depth):
2263: """Dumps debug information for the list of element node, it is
2264: recursive """
2265: libxml2mod.xmlDebugDumpNodeList(output, self._o, depth)
2266:
2267: def debugDumpOneNode(self, output, depth):
2268: """Dumps debug information for the element node, it is not
2269: recursive """
2270: libxml2mod.xmlDebugDumpOneNode(output, self._o, depth)
2271:
2272: def lsCountNode(self):
2273: """Count the children of @node. """
2274: ret = libxml2mod.xmlLsCountNode(self._o)
2275: return ret
2276:
2277: def lsOneNode(self, output):
2278: """Dump to @output the type and name of @node. """
2279: libxml2mod.xmlLsOneNode(output, self._o)
2280:
2281: def shellPrintNode(self):
2282: """Print node to the output FILE """
2283: libxml2mod.xmlShellPrintNode(self._o)
2284:
2285: #
2286: # xmlNode functions from module tree
2287: #
2288:
2289: def addChild(self, cur):
2290: """Add a new node to @parent, at the end of the child (or
2291: property) list merging adjacent TEXT nodes (in which case
2292: @cur is freed) If the new node is ATTRIBUTE, it is added
2293: into properties instead of children. If there is an
2294: attribute with equal name, it is first destroyed. """
2295: if cur is None: cur__o = None
2296: else: cur__o = cur._o
2297: ret = libxml2mod.xmlAddChild(self._o, cur__o)
2298: if ret is None:raise treeError('xmlAddChild() failed')
2299: __tmp = xmlNode(_obj=ret)
2300: return __tmp
2301:
2302: def addChildList(self, cur):
2303: """Add a list of node at the end of the child list of the
2304: parent merging adjacent TEXT nodes (@cur may be freed) """
2305: if cur is None: cur__o = None
2306: else: cur__o = cur._o
2307: ret = libxml2mod.xmlAddChildList(self._o, cur__o)
2308: if ret is None:raise treeError('xmlAddChildList() failed')
2309: __tmp = xmlNode(_obj=ret)
2310: return __tmp
2311:
2312: def addContent(self, content):
2313: """Append the extra substring to the node content. NOTE: In
2314: contrast to xmlNodeSetContent(), @content is supposed to be
2315: raw text, so unescaped XML special chars are allowed,
2316: entity references are not supported. """
2317: libxml2mod.xmlNodeAddContent(self._o, content)
2318:
2319: def addContentLen(self, content, len):
2320: """Append the extra substring to the node content. NOTE: In
2321: contrast to xmlNodeSetContentLen(), @content is supposed to
2322: be raw text, so unescaped XML special chars are allowed,
2323: entity references are not supported. """
2324: libxml2mod.xmlNodeAddContentLen(self._o, content, len)
2325:
2326: def addNextSibling(self, elem):
2327: """Add a new node @elem as the next sibling of @cur If the new
2328: node was already inserted in a document it is first
2329: unlinked from its existing context. As a result of text
2330: merging @elem may be freed. If the new node is ATTRIBUTE,
2331: it is added into properties instead of children. If there
2332: is an attribute with equal name, it is first destroyed. """
2333: if elem is None: elem__o = None
2334: else: elem__o = elem._o
2335: ret = libxml2mod.xmlAddNextSibling(self._o, elem__o)
2336: if ret is None:raise treeError('xmlAddNextSibling() failed')
2337: __tmp = xmlNode(_obj=ret)
2338: return __tmp
2339:
2340: def addPrevSibling(self, elem):
2341: """Add a new node @elem as the previous sibling of @cur
2342: merging adjacent TEXT nodes (@elem may be freed) If the new
2343: node was already inserted in a document it is first
2344: unlinked from its existing context. If the new node is
2345: ATTRIBUTE, it is added into properties instead of children.
2346: If there is an attribute with equal name, it is first
2347: destroyed. """
2348: if elem is None: elem__o = None
2349: else: elem__o = elem._o
2350: ret = libxml2mod.xmlAddPrevSibling(self._o, elem__o)
2351: if ret is None:raise treeError('xmlAddPrevSibling() failed')
2352: __tmp = xmlNode(_obj=ret)
2353: return __tmp
2354:
2355: def addSibling(self, elem):
2356: """Add a new element @elem to the list of siblings of @cur
2357: merging adjacent TEXT nodes (@elem may be freed) If the new
2358: element was already inserted in a document it is first
2359: unlinked from its existing context. """
2360: if elem is None: elem__o = None
2361: else: elem__o = elem._o
2362: ret = libxml2mod.xmlAddSibling(self._o, elem__o)
2363: if ret is None:raise treeError('xmlAddSibling() failed')
2364: __tmp = xmlNode(_obj=ret)
2365: return __tmp
2366:
2367: def copyNode(self, extended):
2368: """Do a copy of the node. """
2369: ret = libxml2mod.xmlCopyNode(self._o, extended)
2370: if ret is None:raise treeError('xmlCopyNode() failed')
2371: __tmp = xmlNode(_obj=ret)
2372: return __tmp
2373:
2374: def copyNodeList(self):
2375: """Do a recursive copy of the node list. Use
2376: xmlDocCopyNodeList() if possible to ensure string interning. """
2377: ret = libxml2mod.xmlCopyNodeList(self._o)
2378: if ret is None:raise treeError('xmlCopyNodeList() failed')
2379: __tmp = xmlNode(_obj=ret)
2380: return __tmp
2381:
2382: def copyProp(self, cur):
2383: """Do a copy of the attribute. """
2384: if cur is None: cur__o = None
2385: else: cur__o = cur._o
2386: ret = libxml2mod.xmlCopyProp(self._o, cur__o)
2387: if ret is None:raise treeError('xmlCopyProp() failed')
2388: __tmp = xmlAttr(_obj=ret)
2389: return __tmp
2390:
2391: def copyPropList(self, cur):
2392: """Do a copy of an attribute list. """
2393: if cur is None: cur__o = None
2394: else: cur__o = cur._o
2395: ret = libxml2mod.xmlCopyPropList(self._o, cur__o)
2396: if ret is None:raise treeError('xmlCopyPropList() failed')
2397: __tmp = xmlAttr(_obj=ret)
2398: return __tmp
2399:
2400: def docCopyNode(self, doc, extended):
2401: """Do a copy of the node to a given document. """
2402: if doc is None: doc__o = None
2403: else: doc__o = doc._o
2404: ret = libxml2mod.xmlDocCopyNode(self._o, doc__o, extended)
2405: if ret is None:raise treeError('xmlDocCopyNode() failed')
2406: __tmp = xmlNode(_obj=ret)
2407: return __tmp
2408:
2409: def docCopyNodeList(self, doc):
2410: """Do a recursive copy of the node list. """
2411: if doc is None: doc__o = None
2412: else: doc__o = doc._o
2413: ret = libxml2mod.xmlDocCopyNodeList(doc__o, self._o)
2414: if ret is None:raise treeError('xmlDocCopyNodeList() failed')
2415: __tmp = xmlNode(_obj=ret)
2416: return __tmp
2417:
2418: def docSetRootElement(self, doc):
2419: """Set the root element of the document (doc->children is a
2420: list containing possibly comments, PIs, etc ...). """
2421: if doc is None: doc__o = None
2422: else: doc__o = doc._o
2423: ret = libxml2mod.xmlDocSetRootElement(doc__o, self._o)
2424: if ret is None:return None
2425: __tmp = xmlNode(_obj=ret)
2426: return __tmp
2427:
2428: def firstElementChild(self):
2429: """Finds the first child node of that element which is a
2430: Element node Note the handling of entities references is
2431: different than in the W3C DOM element traversal spec since
2432: we don't have back reference from entities content to
2433: entities references. """
2434: ret = libxml2mod.xmlFirstElementChild(self._o)
2435: if ret is None:return None
2436: __tmp = xmlNode(_obj=ret)
2437: return __tmp
2438:
2439: def freeNode(self):
2440: """Free a node, this is a recursive behaviour, all the
2441: children are freed too. This doesn't unlink the child from
2442: the list, use xmlUnlinkNode() first. """
2443: libxml2mod.xmlFreeNode(self._o)
2444:
2445: def freeNodeList(self):
2446: """Free a node and all its siblings, this is a recursive
2447: behaviour, all the children are freed too. """
2448: libxml2mod.xmlFreeNodeList(self._o)
2449:
2450: def getBase(self, doc):
2451: """Searches for the BASE URL. The code should work on both XML
2452: and HTML document even if base mechanisms are completely
2453: different. It returns the base as defined in RFC 2396
2454: sections 5.1.1. Base URI within Document Content and 5.1.2.
2455: Base URI from the Encapsulating Entity However it does not
2456: return the document base (5.1.3), use doc->URL in this case """
2457: if doc is None: doc__o = None
2458: else: doc__o = doc._o
2459: ret = libxml2mod.xmlNodeGetBase(doc__o, self._o)
2460: return ret
2461:
2462: def getContent(self):
2463: """Read the value of a node, this can be either the text
2464: carried directly by this node if it's a TEXT node or the
2465: aggregate string of the values carried by this node child's
2466: (TEXT and ENTITY_REF). Entity references are substituted. """
2467: ret = libxml2mod.xmlNodeGetContent(self._o)
2468: return ret
2469:
2470: def getLang(self):
2471: """Searches the language of a node, i.e. the values of the
2472: xml:lang attribute or the one carried by the nearest
2473: ancestor. """
2474: ret = libxml2mod.xmlNodeGetLang(self._o)
2475: return ret
2476:
2477: def getSpacePreserve(self):
2478: """Searches the space preserving behaviour of a node, i.e. the
2479: values of the xml:space attribute or the one carried by the
2480: nearest ancestor. """
2481: ret = libxml2mod.xmlNodeGetSpacePreserve(self._o)
2482: return ret
2483:
2484: def hasNsProp(self, name, nameSpace):
2485: """Search for an attribute associated to a node This attribute
2486: has to be anchored in the namespace specified. This does
2487: the entity substitution. This function looks in DTD
2488: attribute declaration for #FIXED or default declaration
2489: values unless DTD use has been turned off. Note that a
2490: namespace of None indicates to use the default namespace. """
2491: ret = libxml2mod.xmlHasNsProp(self._o, name, nameSpace)
2492: if ret is None:return None
2493: __tmp = xmlAttr(_obj=ret)
2494: return __tmp
2495:
2496: def hasProp(self, name):
2497: """Search an attribute associated to a node This function also
2498: looks in DTD attribute declaration for #FIXED or default
2499: declaration values unless DTD use has been turned off. """
2500: ret = libxml2mod.xmlHasProp(self._o, name)
2501: if ret is None:return None
2502: __tmp = xmlAttr(_obj=ret)
2503: return __tmp
2504:
2505: def isBlankNode(self):
2506: """Checks whether this node is an empty or whitespace only
2507: (and possibly ignorable) text-node. """
2508: ret = libxml2mod.xmlIsBlankNode(self._o)
2509: return ret
2510:
2511: def isText(self):
2512: """Is this node a Text node ? """
2513: ret = libxml2mod.xmlNodeIsText(self._o)
2514: return ret
2515:
2516: def lastChild(self):
2517: """Search the last child of a node. """
2518: ret = libxml2mod.xmlGetLastChild(self._o)
2519: if ret is None:raise treeError('xmlGetLastChild() failed')
2520: __tmp = xmlNode(_obj=ret)
2521: return __tmp
2522:
2523: def lastElementChild(self):
2524: """Finds the last child node of that element which is a
2525: Element node Note the handling of entities references is
2526: different than in the W3C DOM element traversal spec since
2527: we don't have back reference from entities content to
2528: entities references. """
2529: ret = libxml2mod.xmlLastElementChild(self._o)
2530: if ret is None:return None
2531: __tmp = xmlNode(_obj=ret)
2532: return __tmp
2533:
2534: def lineNo(self):
2535: """Get line number of @node. Try to override the limitation of
2536: lines being store in 16 bits ints if XML_PARSE_BIG_LINES
2537: parser option was used """
2538: ret = libxml2mod.xmlGetLineNo(self._o)
2539: return ret
2540:
2541: def listGetRawString(self, doc, inLine):
2542: """Builds the string equivalent to the text contained in the
2543: Node list made of TEXTs and ENTITY_REFs, contrary to
2544: xmlNodeListGetString() this function doesn't do any
2545: character encoding handling. """
2546: if doc is None: doc__o = None
2547: else: doc__o = doc._o
2548: ret = libxml2mod.xmlNodeListGetRawString(doc__o, self._o, inLine)
2549: return ret
2550:
2551: def listGetString(self, doc, inLine):
2552: """Build the string equivalent to the text contained in the
2553: Node list made of TEXTs and ENTITY_REFs """
2554: if doc is None: doc__o = None
2555: else: doc__o = doc._o
2556: ret = libxml2mod.xmlNodeListGetString(doc__o, self._o, inLine)
2557: return ret
2558:
2559: def newChild(self, ns, name, content):
2560: """Creation of a new child element, added at the end of
2561: @parent children list. @ns and @content parameters are
2562: optional (None). If @ns is None, the newly created element
2563: inherits the namespace of @parent. If @content is non None,
2564: a child list containing the TEXTs and ENTITY_REFs node will
2565: be created. NOTE: @content is supposed to be a piece of XML
2566: CDATA, so it allows entity references. XML special chars
2567: must be escaped first by using
2568: xmlEncodeEntitiesReentrant(), or xmlNewTextChild() should
2569: be used. """
2570: if ns is None: ns__o = None
2571: else: ns__o = ns._o
2572: ret = libxml2mod.xmlNewChild(self._o, ns__o, name, content)
2573: if ret is None:raise treeError('xmlNewChild() failed')
2574: __tmp = xmlNode(_obj=ret)
2575: return __tmp
2576:
2577: def newNs(self, href, prefix):
2578: """Creation of a new Namespace. This function will refuse to
2579: create a namespace with a similar prefix than an existing
2580: one present on this node. We use href==None in the case of
2581: an element creation where the namespace was not defined. """
2582: ret = libxml2mod.xmlNewNs(self._o, href, prefix)
2583: if ret is None:raise treeError('xmlNewNs() failed')
2584: __tmp = xmlNs(_obj=ret)
2585: return __tmp
2586:
2587: def newNsProp(self, ns, name, value):
2588: """Create a new property tagged with a namespace and carried
2589: by a node. """
2590: if ns is None: ns__o = None
2591: else: ns__o = ns._o
2592: ret = libxml2mod.xmlNewNsProp(self._o, ns__o, name, value)
2593: if ret is None:raise treeError('xmlNewNsProp() failed')
2594: __tmp = xmlAttr(_obj=ret)
2595: return __tmp
2596:
2597: def newNsPropEatName(self, ns, name, value):
2598: """Create a new property tagged with a namespace and carried
2599: by a node. """
2600: if ns is None: ns__o = None
2601: else: ns__o = ns._o
2602: ret = libxml2mod.xmlNewNsPropEatName(self._o, ns__o, name, value)
2603: if ret is None:raise treeError('xmlNewNsPropEatName() failed')
2604: __tmp = xmlAttr(_obj=ret)
2605: return __tmp
2606:
2607: def newProp(self, name, value):
2608: """Create a new property carried by a node. """
2609: ret = libxml2mod.xmlNewProp(self._o, name, value)
2610: if ret is None:raise treeError('xmlNewProp() failed')
2611: __tmp = xmlAttr(_obj=ret)
2612: return __tmp
2613:
2614: def newTextChild(self, ns, name, content):
2615: """Creation of a new child element, added at the end of
2616: @parent children list. @ns and @content parameters are
2617: optional (None). If @ns is None, the newly created element
2618: inherits the namespace of @parent. If @content is non None,
2619: a child TEXT node will be created containing the string
2620: @content. NOTE: Use xmlNewChild() if @content will contain
2621: entities that need to be preserved. Use this function,
2622: xmlNewTextChild(), if you need to ensure that reserved XML
2623: chars that might appear in @content, such as the ampersand,
2624: greater-than or less-than signs, are automatically replaced
2625: by their XML escaped entity representations. """
2626: if ns is None: ns__o = None
2627: else: ns__o = ns._o
2628: ret = libxml2mod.xmlNewTextChild(self._o, ns__o, name, content)
2629: if ret is None:raise treeError('xmlNewTextChild() failed')
2630: __tmp = xmlNode(_obj=ret)
2631: return __tmp
2632:
2633: def nextElementSibling(self):
2634: """Finds the first closest next sibling of the node which is
2635: an element node. Note the handling of entities references
2636: is different than in the W3C DOM element traversal spec
2637: since we don't have back reference from entities content to
2638: entities references. """
2639: ret = libxml2mod.xmlNextElementSibling(self._o)
2640: if ret is None:return None
2641: __tmp = xmlNode(_obj=ret)
2642: return __tmp
2643:
2644: def noNsProp(self, name):
2645: """Search and get the value of an attribute associated to a
2646: node This does the entity substitution. This function looks
2647: in DTD attribute declaration for #FIXED or default
2648: declaration values unless DTD use has been turned off. This
2649: function is similar to xmlGetProp except it will accept
2650: only an attribute in no namespace. """
2651: ret = libxml2mod.xmlGetNoNsProp(self._o, name)
2652: return ret
2653:
2654: def nodePath(self):
2655: """Build a structure based Path for the given node """
2656: ret = libxml2mod.xmlGetNodePath(self._o)
2657: return ret
2658:
2659: def nsProp(self, name, nameSpace):
2660: """Search and get the value of an attribute associated to a
2661: node This attribute has to be anchored in the namespace
2662: specified. This does the entity substitution. This function
2663: looks in DTD attribute declaration for #FIXED or default
2664: declaration values unless DTD use has been turned off. """
2665: ret = libxml2mod.xmlGetNsProp(self._o, name, nameSpace)
2666: return ret
2667:
2668: def previousElementSibling(self):
2669: """Finds the first closest previous sibling of the node which
2670: is an element node. Note the handling of entities
2671: references is different than in the W3C DOM element
2672: traversal spec since we don't have back reference from
2673: entities content to entities references. """
2674: ret = libxml2mod.xmlPreviousElementSibling(self._o)
2675: if ret is None:return None
2676: __tmp = xmlNode(_obj=ret)
2677: return __tmp
2678:
2679: def prop(self, name):
2680: """Search and get the value of an attribute associated to a
2681: node This does the entity substitution. This function looks
2682: in DTD attribute declaration for #FIXED or default
2683: declaration values unless DTD use has been turned off.
2684: NOTE: this function acts independently of namespaces
2685: associated to the attribute. Use xmlGetNsProp() or
2686: xmlGetNoNsProp() for namespace aware processing. """
2687: ret = libxml2mod.xmlGetProp(self._o, name)
2688: return ret
2689:
2690: def reconciliateNs(self, doc):
2691: """This function checks that all the namespaces declared
2692: within the given tree are properly declared. This is needed
2693: for example after Copy or Cut and then paste operations.
2694: The subtree may still hold pointers to namespace
2695: declarations outside the subtree or invalid/masked. As much
2696: as possible the function try to reuse the existing
2697: namespaces found in the new environment. If not possible
2698: the new namespaces are redeclared on @tree at the top of
2699: the given subtree. """
2700: if doc is None: doc__o = None
2701: else: doc__o = doc._o
2702: ret = libxml2mod.xmlReconciliateNs(doc__o, self._o)
2703: return ret
2704:
2705: def replaceNode(self, cur):
2706: """Unlink the old node from its current context, prune the new
2707: one at the same place. If @cur was already inserted in a
2708: document it is first unlinked from its existing context. """
2709: if cur is None: cur__o = None
2710: else: cur__o = cur._o
2711: ret = libxml2mod.xmlReplaceNode(self._o, cur__o)
2712: if ret is None:raise treeError('xmlReplaceNode() failed')
2713: __tmp = xmlNode(_obj=ret)
2714: return __tmp
2715:
2716: def searchNs(self, doc, nameSpace):
2717: """Search a Ns registered under a given name space for a
2718: document. recurse on the parents until it finds the defined
2719: namespace or return None otherwise. @nameSpace can be None,
2720: this is a search for the default namespace. We don't allow
2721: to cross entities boundaries. If you don't declare the
2722: namespace within those you will be in troubles !!! A
2723: warning is generated to cover this case. """
2724: if doc is None: doc__o = None
2725: else: doc__o = doc._o
2726: ret = libxml2mod.xmlSearchNs(doc__o, self._o, nameSpace)
2727: if ret is None:raise treeError('xmlSearchNs() failed')
2728: __tmp = xmlNs(_obj=ret)
2729: return __tmp
2730:
2731: def searchNsByHref(self, doc, href):
2732: """Search a Ns aliasing a given URI. Recurse on the parents
2733: until it finds the defined namespace or return None
2734: otherwise. """
2735: if doc is None: doc__o = None
2736: else: doc__o = doc._o
2737: ret = libxml2mod.xmlSearchNsByHref(doc__o, self._o, href)
2738: if ret is None:raise treeError('xmlSearchNsByHref() failed')
2739: __tmp = xmlNs(_obj=ret)
2740: return __tmp
2741:
2742: def setBase(self, uri):
2743: """Set (or reset) the base URI of a node, i.e. the value of
2744: the xml:base attribute. """
2745: libxml2mod.xmlNodeSetBase(self._o, uri)
2746:
2747: def setContent(self, content):
2748: """Replace the content of a node. NOTE: @content is supposed
2749: to be a piece of XML CDATA, so it allows entity references,
2750: but XML special chars need to be escaped first by using
2751: xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars(). """
2752: libxml2mod.xmlNodeSetContent(self._o, content)
2753:
2754: def setContentLen(self, content, len):
2755: """Replace the content of a node. NOTE: @content is supposed
2756: to be a piece of XML CDATA, so it allows entity references,
2757: but XML special chars need to be escaped first by using
2758: xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars(). """
2759: libxml2mod.xmlNodeSetContentLen(self._o, content, len)
2760:
2761: def setLang(self, lang):
2762: """Set the language of a node, i.e. the values of the xml:lang
2763: attribute. """
2764: libxml2mod.xmlNodeSetLang(self._o, lang)
2765:
2766: def setListDoc(self, doc):
2767: """update all nodes in the list to point to the right document """
2768: if doc is None: doc__o = None
2769: else: doc__o = doc._o
2770: libxml2mod.xmlSetListDoc(self._o, doc__o)
2771:
2772: def setName(self, name):
2773: """Set (or reset) the name of a node. """
2774: libxml2mod.xmlNodeSetName(self._o, name)
2775:
2776: def setNs(self, ns):
2777: """Associate a namespace to a node, a posteriori. """
2778: if ns is None: ns__o = None
2779: else: ns__o = ns._o
2780: libxml2mod.xmlSetNs(self._o, ns__o)
2781:
2782: def setNsProp(self, ns, name, value):
2783: """Set (or reset) an attribute carried by a node. The ns
2784: structure must be in scope, this is not checked """
2785: if ns is None: ns__o = None
2786: else: ns__o = ns._o
2787: ret = libxml2mod.xmlSetNsProp(self._o, ns__o, name, value)
2788: if ret is None:raise treeError('xmlSetNsProp() failed')
2789: __tmp = xmlAttr(_obj=ret)
2790: return __tmp
2791:
2792: def setProp(self, name, value):
2793: """Set (or reset) an attribute carried by a node. If @name has
2794: a prefix, then the corresponding namespace-binding will be
2795: used, if in scope; it is an error it there's no such
2796: ns-binding for the prefix in scope. """
2797: ret = libxml2mod.xmlSetProp(self._o, name, value)
2798: if ret is None:raise treeError('xmlSetProp() failed')
2799: __tmp = xmlAttr(_obj=ret)
2800: return __tmp
2801:
2802: def setSpacePreserve(self, val):
2803: """Set (or reset) the space preserving behaviour of a node,
2804: i.e. the value of the xml:space attribute. """
2805: libxml2mod.xmlNodeSetSpacePreserve(self._o, val)
2806:
2807: def setTreeDoc(self, doc):
2808: """update all nodes under the tree to point to the right
2809: document """
2810: if doc is None: doc__o = None
2811: else: doc__o = doc._o
2812: libxml2mod.xmlSetTreeDoc(self._o, doc__o)
2813:
2814: def textConcat(self, content, len):
2815: """Concat the given string at the end of the existing node
2816: content """
2817: ret = libxml2mod.xmlTextConcat(self._o, content, len)
2818: return ret
2819:
2820: def textMerge(self, second):
2821: """Merge two text nodes into one """
2822: if second is None: second__o = None
2823: else: second__o = second._o
2824: ret = libxml2mod.xmlTextMerge(self._o, second__o)
2825: if ret is None:raise treeError('xmlTextMerge() failed')
2826: __tmp = xmlNode(_obj=ret)
2827: return __tmp
2828:
2829: def unlinkNode(self):
2830: """Unlink a node from it's current context, the node is not
2831: freed If one need to free the node, use xmlFreeNode()
2832: routine after the unlink to discard it. Note that namespace
2833: nodes can't be unlinked as they do not have pointer to
2834: their parent. """
2835: libxml2mod.xmlUnlinkNode(self._o)
2836:
2837: def unsetNsProp(self, ns, name):
2838: """Remove an attribute carried by a node. """
2839: if ns is None: ns__o = None
2840: else: ns__o = ns._o
2841: ret = libxml2mod.xmlUnsetNsProp(self._o, ns__o, name)
2842: return ret
2843:
2844: def unsetProp(self, name):
2845: """Remove an attribute carried by a node. This handles only
2846: attributes in no namespace. """
2847: ret = libxml2mod.xmlUnsetProp(self._o, name)
2848: return ret
2849:
2850: #
2851: # xmlNode functions from module valid
2852: #
2853:
2854: def isID(self, doc, attr):
2855: """Determine whether an attribute is of type ID. In case we
2856: have DTD(s) then this is done if DTD loading has been
2857: requested. In the case of HTML documents parsed with the
2858: HTML parser, then ID detection is done systematically. """
2859: if doc is None: doc__o = None
2860: else: doc__o = doc._o
2861: if attr is None: attr__o = None
2862: else: attr__o = attr._o
2863: ret = libxml2mod.xmlIsID(doc__o, self._o, attr__o)
2864: return ret
2865:
2866: def isRef(self, doc, attr):
2867: """Determine whether an attribute is of type Ref. In case we
2868: have DTD(s) then this is simple, otherwise we use an
2869: heuristic: name Ref (upper or lowercase). """
2870: if doc is None: doc__o = None
2871: else: doc__o = doc._o
2872: if attr is None: attr__o = None
2873: else: attr__o = attr._o
2874: ret = libxml2mod.xmlIsRef(doc__o, self._o, attr__o)
2875: return ret
2876:
2877: def validNormalizeAttributeValue(self, doc, name, value):
2878: """Does the validation related extra step of the normalization
2879: of attribute values: If the declared value is not CDATA,
2880: then the XML processor must further process the normalized
2881: attribute value by discarding any leading and trailing
2882: space (#x20) characters, and by replacing sequences of
2883: space (#x20) characters by single space (#x20) character. """
2884: if doc is None: doc__o = None
2885: else: doc__o = doc._o
2886: ret = libxml2mod.xmlValidNormalizeAttributeValue(doc__o, self._o, name, value)
2887: return ret
2888:
2889: #
2890: # xmlNode functions from module xinclude
2891: #
2892:
2893: def xincludeProcessTree(self):
2894: """Implement the XInclude substitution for the given subtree """
2895: ret = libxml2mod.xmlXIncludeProcessTree(self._o)
2896: return ret
2897:
2898: def xincludeProcessTreeFlags(self, flags):
2899: """Implement the XInclude substitution for the given subtree """
2900: ret = libxml2mod.xmlXIncludeProcessTreeFlags(self._o, flags)
2901: return ret
2902:
2903: #
2904: # xmlNode functions from module xmlschemas
2905: #
2906:
2907: def schemaValidateOneElement(self, ctxt):
2908: """Validate a branch of a tree, starting with the given @elem. """
2909: if ctxt is None: ctxt__o = None
2910: else: ctxt__o = ctxt._o
2911: ret = libxml2mod.xmlSchemaValidateOneElement(ctxt__o, self._o)
2912: return ret
2913:
2914: #
2915: # xmlNode functions from module xpath
2916: #
2917:
2918: def xpathCastNodeToNumber(self):
2919: """Converts a node to its number value """
2920: ret = libxml2mod.xmlXPathCastNodeToNumber(self._o)
2921: return ret
2922:
2923: def xpathCastNodeToString(self):
2924: """Converts a node to its string value. """
2925: ret = libxml2mod.xmlXPathCastNodeToString(self._o)
2926: return ret
2927:
2928: def xpathCmpNodes(self, node2):
2929: """Compare two nodes w.r.t document order """
2930: if node2 is None: node2__o = None
2931: else: node2__o = node2._o
2932: ret = libxml2mod.xmlXPathCmpNodes(self._o, node2__o)
2933: return ret
2934:
2935: def xpathNodeEval(self, str, ctx):
2936: """Evaluate the XPath Location Path in the given context. The
2937: node 'node' is set as the context node. The context node is
2938: not restored. """
2939: if ctx is None: ctx__o = None
2940: else: ctx__o = ctx._o
2941: ret = libxml2mod.xmlXPathNodeEval(self._o, str, ctx__o)
2942: if ret is None:raise xpathError('xmlXPathNodeEval() failed')
2943: return xpathObjectRet(ret)
2944:
2945: #
2946: # xmlNode functions from module xpathInternals
2947: #
2948:
2949: def xpathNewNodeSet(self):
2950: """Create a new xmlXPathObjectPtr of type NodeSet and
2951: initialize it with the single Node @val """
2952: ret = libxml2mod.xmlXPathNewNodeSet(self._o)
2953: if ret is None:raise xpathError('xmlXPathNewNodeSet() failed')
2954: return xpathObjectRet(ret)
2955:
2956: def xpathNewValueTree(self):
2957: """Create a new xmlXPathObjectPtr of type Value Tree (XSLT)
2958: and initialize it with the tree root @val """
2959: ret = libxml2mod.xmlXPathNewValueTree(self._o)
2960: if ret is None:raise xpathError('xmlXPathNewValueTree() failed')
2961: return xpathObjectRet(ret)
2962:
2963: def xpathNextAncestor(self, ctxt):
2964: """Traversal function for the "ancestor" direction the
2965: ancestor axis contains the ancestors of the context node;
2966: the ancestors of the context node consist of the parent of
2967: context node and the parent's parent and so on; the nodes
2968: are ordered in reverse document order; thus the parent is
2969: the first node on the axis, and the parent's parent is the
2970: second node on the axis """
2971: if ctxt is None: ctxt__o = None
2972: else: ctxt__o = ctxt._o
2973: ret = libxml2mod.xmlXPathNextAncestor(ctxt__o, self._o)
2974: if ret is None:raise xpathError('xmlXPathNextAncestor() failed')
2975: __tmp = xmlNode(_obj=ret)
2976: return __tmp
2977:
2978: def xpathNextAncestorOrSelf(self, ctxt):
2979: """Traversal function for the "ancestor-or-self" direction he
2980: ancestor-or-self axis contains the context node and
2981: ancestors of the context node in reverse document order;
2982: thus the context node is the first node on the axis, and
2983: the context node's parent the second; parent here is
2984: defined the same as with the parent axis. """
2985: if ctxt is None: ctxt__o = None
2986: else: ctxt__o = ctxt._o
2987: ret = libxml2mod.xmlXPathNextAncestorOrSelf(ctxt__o, self._o)
2988: if ret is None:raise xpathError('xmlXPathNextAncestorOrSelf() failed')
2989: __tmp = xmlNode(_obj=ret)
2990: return __tmp
2991:
2992: def xpathNextAttribute(self, ctxt):
2993: """Traversal function for the "attribute" direction TODO:
2994: support DTD inherited default attributes """
2995: if ctxt is None: ctxt__o = None
2996: else: ctxt__o = ctxt._o
2997: ret = libxml2mod.xmlXPathNextAttribute(ctxt__o, self._o)
2998: if ret is None:raise xpathError('xmlXPathNextAttribute() failed')
2999: __tmp = xmlNode(_obj=ret)
3000: return __tmp
3001:
3002: def xpathNextChild(self, ctxt):
3003: """Traversal function for the "child" direction The child axis
3004: contains the children of the context node in document order. """
3005: if ctxt is None: ctxt__o = None
3006: else: ctxt__o = ctxt._o
3007: ret = libxml2mod.xmlXPathNextChild(ctxt__o, self._o)
3008: if ret is None:raise xpathError('xmlXPathNextChild() failed')
3009: __tmp = xmlNode(_obj=ret)
3010: return __tmp
3011:
3012: def xpathNextDescendant(self, ctxt):
3013: """Traversal function for the "descendant" direction the
3014: descendant axis contains the descendants of the context
3015: node in document order; a descendant is a child or a child
3016: of a child and so on. """
3017: if ctxt is None: ctxt__o = None
3018: else: ctxt__o = ctxt._o
3019: ret = libxml2mod.xmlXPathNextDescendant(ctxt__o, self._o)
3020: if ret is None:raise xpathError('xmlXPathNextDescendant() failed')
3021: __tmp = xmlNode(_obj=ret)
3022: return __tmp
3023:
3024: def xpathNextDescendantOrSelf(self, ctxt):
3025: """Traversal function for the "descendant-or-self" direction
3026: the descendant-or-self axis contains the context node and
3027: the descendants of the context node in document order; thus
3028: the context node is the first node on the axis, and the
3029: first child of the context node is the second node on the
3030: axis """
3031: if ctxt is None: ctxt__o = None
3032: else: ctxt__o = ctxt._o
3033: ret = libxml2mod.xmlXPathNextDescendantOrSelf(ctxt__o, self._o)
3034: if ret is None:raise xpathError('xmlXPathNextDescendantOrSelf() failed')
3035: __tmp = xmlNode(_obj=ret)
3036: return __tmp
3037:
3038: def xpathNextFollowing(self, ctxt):
3039: """Traversal function for the "following" direction The
3040: following axis contains all nodes in the same document as
3041: the context node that are after the context node in
3042: document order, excluding any descendants and excluding
3043: attribute nodes and namespace nodes; the nodes are ordered
3044: in document order """
3045: if ctxt is None: ctxt__o = None
3046: else: ctxt__o = ctxt._o
3047: ret = libxml2mod.xmlXPathNextFollowing(ctxt__o, self._o)
3048: if ret is None:raise xpathError('xmlXPathNextFollowing() failed')
3049: __tmp = xmlNode(_obj=ret)
3050: return __tmp
3051:
3052: def xpathNextFollowingSibling(self, ctxt):
3053: """Traversal function for the "following-sibling" direction
3054: The following-sibling axis contains the following siblings
3055: of the context node in document order. """
3056: if ctxt is None: ctxt__o = None
3057: else: ctxt__o = ctxt._o
3058: ret = libxml2mod.xmlXPathNextFollowingSibling(ctxt__o, self._o)
3059: if ret is None:raise xpathError('xmlXPathNextFollowingSibling() failed')
3060: __tmp = xmlNode(_obj=ret)
3061: return __tmp
3062:
3063: def xpathNextNamespace(self, ctxt):
3064: """Traversal function for the "namespace" direction the
3065: namespace axis contains the namespace nodes of the context
3066: node; the order of nodes on this axis is
3067: implementation-defined; the axis will be empty unless the
3068: context node is an element We keep the XML namespace node
3069: at the end of the list. """
3070: if ctxt is None: ctxt__o = None
3071: else: ctxt__o = ctxt._o
3072: ret = libxml2mod.xmlXPathNextNamespace(ctxt__o, self._o)
3073: if ret is None:raise xpathError('xmlXPathNextNamespace() failed')
3074: __tmp = xmlNode(_obj=ret)
3075: return __tmp
3076:
3077: def xpathNextParent(self, ctxt):
3078: """Traversal function for the "parent" direction The parent
3079: axis contains the parent of the context node, if there is
3080: one. """
3081: if ctxt is None: ctxt__o = None
3082: else: ctxt__o = ctxt._o
3083: ret = libxml2mod.xmlXPathNextParent(ctxt__o, self._o)
3084: if ret is None:raise xpathError('xmlXPathNextParent() failed')
3085: __tmp = xmlNode(_obj=ret)
3086: return __tmp
3087:
3088: def xpathNextPreceding(self, ctxt):
3089: """Traversal function for the "preceding" direction the
3090: preceding axis contains all nodes in the same document as
3091: the context node that are before the context node in
3092: document order, excluding any ancestors and excluding
3093: attribute nodes and namespace nodes; the nodes are ordered
3094: in reverse document order """
3095: if ctxt is None: ctxt__o = None
3096: else: ctxt__o = ctxt._o
3097: ret = libxml2mod.xmlXPathNextPreceding(ctxt__o, self._o)
3098: if ret is None:raise xpathError('xmlXPathNextPreceding() failed')
3099: __tmp = xmlNode(_obj=ret)
3100: return __tmp
3101:
3102: def xpathNextPrecedingSibling(self, ctxt):
3103: """Traversal function for the "preceding-sibling" direction
3104: The preceding-sibling axis contains the preceding siblings
3105: of the context node in reverse document order; the first
3106: preceding sibling is first on the axis; the sibling
3107: preceding that node is the second on the axis and so on. """
3108: if ctxt is None: ctxt__o = None
3109: else: ctxt__o = ctxt._o
3110: ret = libxml2mod.xmlXPathNextPrecedingSibling(ctxt__o, self._o)
3111: if ret is None:raise xpathError('xmlXPathNextPrecedingSibling() failed')
3112: __tmp = xmlNode(_obj=ret)
3113: return __tmp
3114:
3115: def xpathNextSelf(self, ctxt):
3116: """Traversal function for the "self" direction The self axis
3117: contains just the context node itself """
3118: if ctxt is None: ctxt__o = None
3119: else: ctxt__o = ctxt._o
3120: ret = libxml2mod.xmlXPathNextSelf(ctxt__o, self._o)
3121: if ret is None:raise xpathError('xmlXPathNextSelf() failed')
3122: __tmp = xmlNode(_obj=ret)
3123: return __tmp
3124:
3125: #
3126: # xmlNode functions from module xpointer
3127: #
3128:
3129: def xpointerNewCollapsedRange(self):
3130: """Create a new xmlXPathObjectPtr of type range using a single
3131: nodes """
3132: ret = libxml2mod.xmlXPtrNewCollapsedRange(self._o)
3133: if ret is None:raise treeError('xmlXPtrNewCollapsedRange() failed')
3134: return xpathObjectRet(ret)
3135:
3136: def xpointerNewContext(self, doc, origin):
3137: """Create a new XPointer context """
3138: if doc is None: doc__o = None
3139: else: doc__o = doc._o
3140: if origin is None: origin__o = None
3141: else: origin__o = origin._o
3142: ret = libxml2mod.xmlXPtrNewContext(doc__o, self._o, origin__o)
3143: if ret is None:raise treeError('xmlXPtrNewContext() failed')
3144: __tmp = xpathContext(_obj=ret)
3145: return __tmp
3146:
3147: def xpointerNewLocationSetNodes(self, end):
3148: """Create a new xmlXPathObjectPtr of type LocationSet and
3149: initialize it with the single range made of the two nodes
3150: @start and @end """
3151: if end is None: end__o = None
3152: else: end__o = end._o
3153: ret = libxml2mod.xmlXPtrNewLocationSetNodes(self._o, end__o)
3154: if ret is None:raise treeError('xmlXPtrNewLocationSetNodes() failed')
3155: return xpathObjectRet(ret)
3156:
3157: def xpointerNewRange(self, startindex, end, endindex):
3158: """Create a new xmlXPathObjectPtr of type range """
3159: if end is None: end__o = None
3160: else: end__o = end._o
3161: ret = libxml2mod.xmlXPtrNewRange(self._o, startindex, end__o, endindex)
3162: if ret is None:raise treeError('xmlXPtrNewRange() failed')
3163: return xpathObjectRet(ret)
3164:
3165: def xpointerNewRangeNodes(self, end):
3166: """Create a new xmlXPathObjectPtr of type range using 2 nodes """
3167: if end is None: end__o = None
3168: else: end__o = end._o
3169: ret = libxml2mod.xmlXPtrNewRangeNodes(self._o, end__o)
3170: if ret is None:raise treeError('xmlXPtrNewRangeNodes() failed')
3171: return xpathObjectRet(ret)
3172:
3173: class xmlDoc(xmlNode):
3174: def __init__(self, _obj=None):
3175: if checkWrapper(_obj) != 0: raise TypeError('xmlDoc got a wrong wrapper object type')
3176: self._o = _obj
3177: xmlNode.__init__(self, _obj=_obj)
3178:
3179: def __repr__(self):
3180: return "<xmlDoc (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
3181:
3182: #
3183: # xmlDoc functions from module HTMLparser
3184: #
3185:
3186: def htmlAutoCloseTag(self, name, elem):
3187: """The HTML DTD allows a tag to implicitly close other tags.
3188: The list is kept in htmlStartClose array. This function
3189: checks if the element or one of it's children would
3190: autoclose the given tag. """
3191: ret = libxml2mod.htmlAutoCloseTag(self._o, name, elem)
3192: return ret
3193:
3194: def htmlIsAutoClosed(self, elem):
3195: """The HTML DTD allows a tag to implicitly close other tags.
3196: The list is kept in htmlStartClose array. This function
3197: checks if a tag is autoclosed by one of it's child """
3198: ret = libxml2mod.htmlIsAutoClosed(self._o, elem)
3199: return ret
3200:
3201: #
3202: # xmlDoc functions from module HTMLtree
3203: #
3204:
3205: def htmlDocContentDumpFormatOutput(self, buf, encoding, format):
3206: """Dump an HTML document. """
3207: if buf is None: buf__o = None
3208: else: buf__o = buf._o
3209: libxml2mod.htmlDocContentDumpFormatOutput(buf__o, self._o, encoding, format)
3210:
3211: def htmlDocContentDumpOutput(self, buf, encoding):
3212: """Dump an HTML document. Formating return/spaces are added. """
3213: if buf is None: buf__o = None
3214: else: buf__o = buf._o
3215: libxml2mod.htmlDocContentDumpOutput(buf__o, self._o, encoding)
3216:
3217: def htmlDocDump(self, f):
3218: """Dump an HTML document to an open FILE. """
3219: ret = libxml2mod.htmlDocDump(f, self._o)
3220: return ret
3221:
3222: def htmlGetMetaEncoding(self):
3223: """Encoding definition lookup in the Meta tags """
3224: ret = libxml2mod.htmlGetMetaEncoding(self._o)
3225: return ret
3226:
3227: def htmlNodeDumpFile(self, out, cur):
3228: """Dump an HTML node, recursive behaviour,children are printed
3229: too, and formatting returns are added. """
3230: if cur is None: cur__o = None
3231: else: cur__o = cur._o
3232: libxml2mod.htmlNodeDumpFile(out, self._o, cur__o)
3233:
3234: def htmlNodeDumpFileFormat(self, out, cur, encoding, format):
3235: """Dump an HTML node, recursive behaviour,children are printed
3236: too. TODO: if encoding == None try to save in the doc
3237: encoding """
3238: if cur is None: cur__o = None
3239: else: cur__o = cur._o
3240: ret = libxml2mod.htmlNodeDumpFileFormat(out, self._o, cur__o, encoding, format)
3241: return ret
3242:
3243: def htmlNodeDumpFormatOutput(self, buf, cur, encoding, format):
3244: """Dump an HTML node, recursive behaviour,children are printed
3245: too. """
3246: if buf is None: buf__o = None
3247: else: buf__o = buf._o
3248: if cur is None: cur__o = None
3249: else: cur__o = cur._o
3250: libxml2mod.htmlNodeDumpFormatOutput(buf__o, self._o, cur__o, encoding, format)
3251:
3252: def htmlNodeDumpOutput(self, buf, cur, encoding):
3253: """Dump an HTML node, recursive behaviour,children are printed
3254: too, and formatting returns/spaces are added. """
3255: if buf is None: buf__o = None
3256: else: buf__o = buf._o
3257: if cur is None: cur__o = None
3258: else: cur__o = cur._o
3259: libxml2mod.htmlNodeDumpOutput(buf__o, self._o, cur__o, encoding)
3260:
3261: def htmlSaveFile(self, filename):
3262: """Dump an HTML document to a file. If @filename is "-" the
3263: stdout file is used. """
3264: ret = libxml2mod.htmlSaveFile(filename, self._o)
3265: return ret
3266:
3267: def htmlSaveFileEnc(self, filename, encoding):
3268: """Dump an HTML document to a file using a given encoding and
3269: formatting returns/spaces are added. """
3270: ret = libxml2mod.htmlSaveFileEnc(filename, self._o, encoding)
3271: return ret
3272:
3273: def htmlSaveFileFormat(self, filename, encoding, format):
3274: """Dump an HTML document to a file using a given encoding. """
3275: ret = libxml2mod.htmlSaveFileFormat(filename, self._o, encoding, format)
3276: return ret
3277:
3278: def htmlSetMetaEncoding(self, encoding):
3279: """Sets the current encoding in the Meta tags NOTE: this will
3280: not change the document content encoding, just the META
3281: flag associated. """
3282: ret = libxml2mod.htmlSetMetaEncoding(self._o, encoding)
3283: return ret
3284:
3285: #
3286: # xmlDoc functions from module debugXML
3287: #
3288:
3289: def debugCheckDocument(self, output):
3290: """Check the document for potential content problems, and
3291: output the errors to @output """
3292: ret = libxml2mod.xmlDebugCheckDocument(output, self._o)
3293: return ret
3294:
3295: def debugDumpDocument(self, output):
3296: """Dumps debug information for the document, it's recursive """
3297: libxml2mod.xmlDebugDumpDocument(output, self._o)
3298:
3299: def debugDumpDocumentHead(self, output):
3300: """Dumps debug information cncerning the document, not
3301: recursive """
3302: libxml2mod.xmlDebugDumpDocumentHead(output, self._o)
3303:
3304: def debugDumpEntities(self, output):
3305: """Dumps debug information for all the entities in use by the
3306: document """
3307: libxml2mod.xmlDebugDumpEntities(output, self._o)
3308:
3309: #
3310: # xmlDoc functions from module entities
3311: #
3312:
3313: def addDocEntity(self, name, type, ExternalID, SystemID, content):
3314: """Register a new entity for this document. """
3315: ret = libxml2mod.xmlAddDocEntity(self._o, name, type, ExternalID, SystemID, content)
3316: if ret is None:raise treeError('xmlAddDocEntity() failed')
3317: __tmp = xmlEntity(_obj=ret)
3318: return __tmp
3319:
3320: def addDtdEntity(self, name, type, ExternalID, SystemID, content):
3321: """Register a new entity for this document DTD external subset. """
3322: ret = libxml2mod.xmlAddDtdEntity(self._o, name, type, ExternalID, SystemID, content)
3323: if ret is None:raise treeError('xmlAddDtdEntity() failed')
3324: __tmp = xmlEntity(_obj=ret)
3325: return __tmp
3326:
3327: def docEntity(self, name):
3328: """Do an entity lookup in the document entity hash table and """
3329: ret = libxml2mod.xmlGetDocEntity(self._o, name)
3330: if ret is None:raise treeError('xmlGetDocEntity() failed')
3331: __tmp = xmlEntity(_obj=ret)
3332: return __tmp
3333:
3334: def dtdEntity(self, name):
3335: """Do an entity lookup in the DTD entity hash table and """
3336: ret = libxml2mod.xmlGetDtdEntity(self._o, name)
3337: if ret is None:raise treeError('xmlGetDtdEntity() failed')
3338: __tmp = xmlEntity(_obj=ret)
3339: return __tmp
3340:
3341: def encodeEntities(self, input):
3342: """TODO: remove xmlEncodeEntities, once we are not afraid of
3343: breaking binary compatibility People must migrate their
3344: code to xmlEncodeEntitiesReentrant ! This routine will
3345: issue a warning when encountered. """
3346: ret = libxml2mod.xmlEncodeEntities(self._o, input)
3347: return ret
3348:
3349: def encodeEntitiesReentrant(self, input):
3350: """Do a global encoding of a string, replacing the predefined
3351: entities and non ASCII values with their entities and
3352: CharRef counterparts. Contrary to xmlEncodeEntities, this
3353: routine is reentrant, and result must be deallocated. """
3354: ret = libxml2mod.xmlEncodeEntitiesReentrant(self._o, input)
3355: return ret
3356:
3357: def encodeSpecialChars(self, input):
3358: """Do a global encoding of a string, replacing the predefined
3359: entities this routine is reentrant, and result must be
3360: deallocated. """
3361: ret = libxml2mod.xmlEncodeSpecialChars(self._o, input)
3362: return ret
3363:
3364: def newEntity(self, name, type, ExternalID, SystemID, content):
3365: """Create a new entity, this differs from xmlAddDocEntity()
3366: that if the document is None or has no internal subset
3367: defined, then an unlinked entity structure will be
3368: returned, it is then the responsability of the caller to
3369: link it to the document later or free it when not needed
3370: anymore. """
3371: ret = libxml2mod.xmlNewEntity(self._o, name, type, ExternalID, SystemID, content)
3372: if ret is None:raise treeError('xmlNewEntity() failed')
3373: __tmp = xmlEntity(_obj=ret)
3374: return __tmp
3375:
3376: def parameterEntity(self, name):
3377: """Do an entity lookup in the internal and external subsets and """
3378: ret = libxml2mod.xmlGetParameterEntity(self._o, name)
3379: if ret is None:raise treeError('xmlGetParameterEntity() failed')
3380: __tmp = xmlEntity(_obj=ret)
3381: return __tmp
3382:
3383: #
3384: # xmlDoc functions from module relaxng
3385: #
3386:
3387: def relaxNGNewDocParserCtxt(self):
3388: """Create an XML RelaxNGs parser context for that document.
3389: Note: since the process of compiling a RelaxNG schemas
3390: modifies the document, the @doc parameter is duplicated
3391: internally. """
3392: ret = libxml2mod.xmlRelaxNGNewDocParserCtxt(self._o)
3393: if ret is None:raise parserError('xmlRelaxNGNewDocParserCtxt() failed')
3394: __tmp = relaxNgParserCtxt(_obj=ret)
3395: return __tmp
3396:
3397: def relaxNGValidateDoc(self, ctxt):
3398: """Validate a document tree in memory. """
3399: if ctxt is None: ctxt__o = None
3400: else: ctxt__o = ctxt._o
3401: ret = libxml2mod.xmlRelaxNGValidateDoc(ctxt__o, self._o)
3402: return ret
3403:
3404: def relaxNGValidateFullElement(self, ctxt, elem):
3405: """Validate a full subtree when
3406: xmlRelaxNGValidatePushElement() returned 0 and the content
3407: of the node has been expanded. """
3408: if ctxt is None: ctxt__o = None
3409: else: ctxt__o = ctxt._o
3410: if elem is None: elem__o = None
3411: else: elem__o = elem._o
3412: ret = libxml2mod.xmlRelaxNGValidateFullElement(ctxt__o, self._o, elem__o)
3413: return ret
3414:
3415: def relaxNGValidatePopElement(self, ctxt, elem):
3416: """Pop the element end from the RelaxNG validation stack. """
3417: if ctxt is None: ctxt__o = None
3418: else: ctxt__o = ctxt._o
3419: if elem is None: elem__o = None
3420: else: elem__o = elem._o
3421: ret = libxml2mod.xmlRelaxNGValidatePopElement(ctxt__o, self._o, elem__o)
3422: return ret
3423:
3424: def relaxNGValidatePushElement(self, ctxt, elem):
3425: """Push a new element start on the RelaxNG validation stack. """
3426: if ctxt is None: ctxt__o = None
3427: else: ctxt__o = ctxt._o
3428: if elem is None: elem__o = None
3429: else: elem__o = elem._o
3430: ret = libxml2mod.xmlRelaxNGValidatePushElement(ctxt__o, self._o, elem__o)
3431: return ret
3432:
3433: #
3434: # xmlDoc functions from module tree
3435: #
3436:
3437: def copyDoc(self, recursive):
3438: """Do a copy of the document info. If recursive, the content
3439: tree will be copied too as well as DTD, namespaces and
3440: entities. """
3441: ret = libxml2mod.xmlCopyDoc(self._o, recursive)
3442: if ret is None:raise treeError('xmlCopyDoc() failed')
3443: __tmp = xmlDoc(_obj=ret)
3444: return __tmp
3445:
3446: def copyNode(self, node, extended):
3447: """Do a copy of the node to a given document. """
3448: if node is None: node__o = None
3449: else: node__o = node._o
3450: ret = libxml2mod.xmlDocCopyNode(node__o, self._o, extended)
3451: if ret is None:raise treeError('xmlDocCopyNode() failed')
3452: __tmp = xmlNode(_obj=ret)
3453: return __tmp
3454:
3455: def copyNodeList(self, node):
3456: """Do a recursive copy of the node list. """
3457: if node is None: node__o = None
3458: else: node__o = node._o
3459: ret = libxml2mod.xmlDocCopyNodeList(self._o, node__o)
3460: if ret is None:raise treeError('xmlDocCopyNodeList() failed')
3461: __tmp = xmlNode(_obj=ret)
3462: return __tmp
3463:
3464: def createIntSubset(self, name, ExternalID, SystemID):
3465: """Create the internal subset of a document """
3466: ret = libxml2mod.xmlCreateIntSubset(self._o, name, ExternalID, SystemID)
3467: if ret is None:raise treeError('xmlCreateIntSubset() failed')
3468: __tmp = xmlDtd(_obj=ret)
3469: return __tmp
3470:
3471: def docCompressMode(self):
3472: """get the compression ratio for a document, ZLIB based """
3473: ret = libxml2mod.xmlGetDocCompressMode(self._o)
3474: return ret
3475:
3476: def dump(self, f):
3477: """Dump an XML document to an open FILE. """
3478: ret = libxml2mod.xmlDocDump(f, self._o)
3479: return ret
3480:
3481: def elemDump(self, f, cur):
3482: """Dump an XML/HTML node, recursive behaviour, children are
3483: printed too. """
3484: if cur is None: cur__o = None
3485: else: cur__o = cur._o
3486: libxml2mod.xmlElemDump(f, self._o, cur__o)
3487:
3488: def formatDump(self, f, format):
3489: """Dump an XML document to an open FILE. """
3490: ret = libxml2mod.xmlDocFormatDump(f, self._o, format)
3491: return ret
3492:
3493: def freeDoc(self):
3494: """Free up all the structures used by a document, tree
3495: included. """
3496: libxml2mod.xmlFreeDoc(self._o)
3497:
3498: def getRootElement(self):
3499: """Get the root element of the document (doc->children is a
3500: list containing possibly comments, PIs, etc ...). """
3501: ret = libxml2mod.xmlDocGetRootElement(self._o)
3502: if ret is None:raise treeError('xmlDocGetRootElement() failed')
3503: __tmp = xmlNode(_obj=ret)
3504: return __tmp
3505:
3506: def intSubset(self):
3507: """Get the internal subset of a document """
3508: ret = libxml2mod.xmlGetIntSubset(self._o)
3509: if ret is None:raise treeError('xmlGetIntSubset() failed')
3510: __tmp = xmlDtd(_obj=ret)
3511: return __tmp
3512:
3513: def newCDataBlock(self, content, len):
3514: """Creation of a new node containing a CDATA block. """
3515: ret = libxml2mod.xmlNewCDataBlock(self._o, content, len)
3516: if ret is None:raise treeError('xmlNewCDataBlock() failed')
3517: __tmp = xmlNode(_obj=ret)
3518: return __tmp
3519:
3520: def newCharRef(self, name):
3521: """Creation of a new character reference node. """
3522: ret = libxml2mod.xmlNewCharRef(self._o, name)
3523: if ret is None:raise treeError('xmlNewCharRef() failed')
3524: __tmp = xmlNode(_obj=ret)
3525: return __tmp
3526:
3527: def newDocComment(self, content):
3528: """Creation of a new node containing a comment within a
3529: document. """
3530: ret = libxml2mod.xmlNewDocComment(self._o, content)
3531: if ret is None:raise treeError('xmlNewDocComment() failed')
3532: __tmp = xmlNode(_obj=ret)
3533: return __tmp
3534:
3535: def newDocFragment(self):
3536: """Creation of a new Fragment node. """
3537: ret = libxml2mod.xmlNewDocFragment(self._o)
3538: if ret is None:raise treeError('xmlNewDocFragment() failed')
3539: __tmp = xmlNode(_obj=ret)
3540: return __tmp
3541:
3542: def newDocNode(self, ns, name, content):
3543: """Creation of a new node element within a document. @ns and
3544: @content are optional (None). NOTE: @content is supposed to
3545: be a piece of XML CDATA, so it allow entities references,
3546: but XML special chars need to be escaped first by using
3547: xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
3548: don't need entities support. """
3549: if ns is None: ns__o = None
3550: else: ns__o = ns._o
3551: ret = libxml2mod.xmlNewDocNode(self._o, ns__o, name, content)
3552: if ret is None:raise treeError('xmlNewDocNode() failed')
3553: __tmp = xmlNode(_obj=ret)
3554: return __tmp
3555:
3556: def newDocNodeEatName(self, ns, name, content):
3557: """Creation of a new node element within a document. @ns and
3558: @content are optional (None). NOTE: @content is supposed to
3559: be a piece of XML CDATA, so it allow entities references,
3560: but XML special chars need to be escaped first by using
3561: xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
3562: don't need entities support. """
3563: if ns is None: ns__o = None
3564: else: ns__o = ns._o
3565: ret = libxml2mod.xmlNewDocNodeEatName(self._o, ns__o, name, content)
3566: if ret is None:raise treeError('xmlNewDocNodeEatName() failed')
3567: __tmp = xmlNode(_obj=ret)
3568: return __tmp
3569:
3570: def newDocPI(self, name, content):
3571: """Creation of a processing instruction element. """
3572: ret = libxml2mod.xmlNewDocPI(self._o, name, content)
3573: if ret is None:raise treeError('xmlNewDocPI() failed')
3574: __tmp = xmlNode(_obj=ret)
3575: return __tmp
3576:
3577: def newDocProp(self, name, value):
3578: """Create a new property carried by a document. """
3579: ret = libxml2mod.xmlNewDocProp(self._o, name, value)
3580: if ret is None:raise treeError('xmlNewDocProp() failed')
3581: __tmp = xmlAttr(_obj=ret)
3582: return __tmp
3583:
3584: def newDocRawNode(self, ns, name, content):
3585: """Creation of a new node element within a document. @ns and
3586: @content are optional (None). """
3587: if ns is None: ns__o = None
3588: else: ns__o = ns._o
3589: ret = libxml2mod.xmlNewDocRawNode(self._o, ns__o, name, content)
3590: if ret is None:raise treeError('xmlNewDocRawNode() failed')
3591: __tmp = xmlNode(_obj=ret)
3592: return __tmp
3593:
3594: def newDocText(self, content):
3595: """Creation of a new text node within a document. """
3596: ret = libxml2mod.xmlNewDocText(self._o, content)
3597: if ret is None:raise treeError('xmlNewDocText() failed')
3598: __tmp = xmlNode(_obj=ret)
3599: return __tmp
3600:
3601: def newDocTextLen(self, content, len):
3602: """Creation of a new text node with an extra content length
3603: parameter. The text node pertain to a given document. """
3604: ret = libxml2mod.xmlNewDocTextLen(self._o, content, len)
3605: if ret is None:raise treeError('xmlNewDocTextLen() failed')
3606: __tmp = xmlNode(_obj=ret)
3607: return __tmp
3608:
3609: def newDtd(self, name, ExternalID, SystemID):
3610: """Creation of a new DTD for the external subset. To create an
3611: internal subset, use xmlCreateIntSubset(). """
3612: ret = libxml2mod.xmlNewDtd(self._o, name, ExternalID, SystemID)
3613: if ret is None:raise treeError('xmlNewDtd() failed')
3614: __tmp = xmlDtd(_obj=ret)
3615: return __tmp
3616:
3617: def newGlobalNs(self, href, prefix):
3618: """Creation of a Namespace, the old way using PI and without
3619: scoping DEPRECATED !!! """
3620: ret = libxml2mod.xmlNewGlobalNs(self._o, href, prefix)
3621: if ret is None:raise treeError('xmlNewGlobalNs() failed')
3622: __tmp = xmlNs(_obj=ret)
3623: return __tmp
3624:
3625: def newReference(self, name):
3626: """Creation of a new reference node. """
3627: ret = libxml2mod.xmlNewReference(self._o, name)
3628: if ret is None:raise treeError('xmlNewReference() failed')
3629: __tmp = xmlNode(_obj=ret)
3630: return __tmp
3631:
3632: def nodeDumpOutput(self, buf, cur, level, format, encoding):
3633: """Dump an XML node, recursive behaviour, children are printed
3634: too. Note that @format = 1 provide node indenting only if
3635: xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was
3636: called """
3637: if buf is None: buf__o = None
3638: else: buf__o = buf._o
3639: if cur is None: cur__o = None
3640: else: cur__o = cur._o
3641: libxml2mod.xmlNodeDumpOutput(buf__o, self._o, cur__o, level, format, encoding)
3642:
3643: def nodeGetBase(self, cur):
3644: """Searches for the BASE URL. The code should work on both XML
3645: and HTML document even if base mechanisms are completely
3646: different. It returns the base as defined in RFC 2396
3647: sections 5.1.1. Base URI within Document Content and 5.1.2.
3648: Base URI from the Encapsulating Entity However it does not
3649: return the document base (5.1.3), use doc->URL in this case """
3650: if cur is None: cur__o = None
3651: else: cur__o = cur._o
3652: ret = libxml2mod.xmlNodeGetBase(self._o, cur__o)
3653: return ret
3654:
3655: def nodeListGetRawString(self, list, inLine):
3656: """Builds the string equivalent to the text contained in the
3657: Node list made of TEXTs and ENTITY_REFs, contrary to
3658: xmlNodeListGetString() this function doesn't do any
3659: character encoding handling. """
3660: if list is None: list__o = None
3661: else: list__o = list._o
3662: ret = libxml2mod.xmlNodeListGetRawString(self._o, list__o, inLine)
3663: return ret
3664:
3665: def nodeListGetString(self, list, inLine):
3666: """Build the string equivalent to the text contained in the
3667: Node list made of TEXTs and ENTITY_REFs """
3668: if list is None: list__o = None
3669: else: list__o = list._o
3670: ret = libxml2mod.xmlNodeListGetString(self._o, list__o, inLine)
3671: return ret
3672:
3673: def reconciliateNs(self, tree):
3674: """This function checks that all the namespaces declared
3675: within the given tree are properly declared. This is needed
3676: for example after Copy or Cut and then paste operations.
3677: The subtree may still hold pointers to namespace
3678: declarations outside the subtree or invalid/masked. As much
3679: as possible the function try to reuse the existing
3680: namespaces found in the new environment. If not possible
3681: the new namespaces are redeclared on @tree at the top of
3682: the given subtree. """
3683: if tree is None: tree__o = None
3684: else: tree__o = tree._o
3685: ret = libxml2mod.xmlReconciliateNs(self._o, tree__o)
3686: return ret
3687:
3688: def saveFile(self, filename):
3689: """Dump an XML document to a file. Will use compression if
3690: compiled in and enabled. If @filename is "-" the stdout
3691: file is used. """
3692: ret = libxml2mod.xmlSaveFile(filename, self._o)
3693: return ret
3694:
3695: def saveFileEnc(self, filename, encoding):
3696: """Dump an XML document, converting it to the given encoding """
3697: ret = libxml2mod.xmlSaveFileEnc(filename, self._o, encoding)
3698: return ret
3699:
3700: def saveFileTo(self, buf, encoding):
3701: """Dump an XML document to an I/O buffer. Warning ! This call
3702: xmlOutputBufferClose() on buf which is not available after
3703: this call. """
3704: if buf is None: buf__o = None
3705: else: buf__o = buf._o
3706: ret = libxml2mod.xmlSaveFileTo(buf__o, self._o, encoding)
3707: return ret
3708:
3709: def saveFormatFile(self, filename, format):
3710: """Dump an XML document to a file. Will use compression if
3711: compiled in and enabled. If @filename is "-" the stdout
3712: file is used. If @format is set then the document will be
3713: indented on output. Note that @format = 1 provide node
3714: indenting only if xmlIndentTreeOutput = 1 or
3715: xmlKeepBlanksDefault(0) was called """
3716: ret = libxml2mod.xmlSaveFormatFile(filename, self._o, format)
3717: return ret
3718:
3719: def saveFormatFileEnc(self, filename, encoding, format):
3720: """Dump an XML document to a file or an URL. """
3721: ret = libxml2mod.xmlSaveFormatFileEnc(filename, self._o, encoding, format)
3722: return ret
3723:
3724: def saveFormatFileTo(self, buf, encoding, format):
3725: """Dump an XML document to an I/O buffer. Warning ! This call
3726: xmlOutputBufferClose() on buf which is not available after
3727: this call. """
3728: if buf is None: buf__o = None
3729: else: buf__o = buf._o
3730: ret = libxml2mod.xmlSaveFormatFileTo(buf__o, self._o, encoding, format)
3731: return ret
3732:
3733: def searchNs(self, node, nameSpace):
3734: """Search a Ns registered under a given name space for a
3735: document. recurse on the parents until it finds the defined
3736: namespace or return None otherwise. @nameSpace can be None,
3737: this is a search for the default namespace. We don't allow
3738: to cross entities boundaries. If you don't declare the
3739: namespace within those you will be in troubles !!! A
3740: warning is generated to cover this case. """
3741: if node is None: node__o = None
3742: else: node__o = node._o
3743: ret = libxml2mod.xmlSearchNs(self._o, node__o, nameSpace)
3744: if ret is None:raise treeError('xmlSearchNs() failed')
3745: __tmp = xmlNs(_obj=ret)
3746: return __tmp
3747:
3748: def searchNsByHref(self, node, href):
3749: """Search a Ns aliasing a given URI. Recurse on the parents
3750: until it finds the defined namespace or return None
3751: otherwise. """
3752: if node is None: node__o = None
3753: else: node__o = node._o
3754: ret = libxml2mod.xmlSearchNsByHref(self._o, node__o, href)
3755: if ret is None:raise treeError('xmlSearchNsByHref() failed')
3756: __tmp = xmlNs(_obj=ret)
3757: return __tmp
3758:
3759: def setDocCompressMode(self, mode):
3760: """set the compression ratio for a document, ZLIB based
3761: Correct values: 0 (uncompressed) to 9 (max compression) """
3762: libxml2mod.xmlSetDocCompressMode(self._o, mode)
3763:
3764: def setListDoc(self, list):
3765: """update all nodes in the list to point to the right document """
3766: if list is None: list__o = None
3767: else: list__o = list._o
3768: libxml2mod.xmlSetListDoc(list__o, self._o)
3769:
3770: def setRootElement(self, root):
3771: """Set the root element of the document (doc->children is a
3772: list containing possibly comments, PIs, etc ...). """
3773: if root is None: root__o = None
3774: else: root__o = root._o
3775: ret = libxml2mod.xmlDocSetRootElement(self._o, root__o)
3776: if ret is None:return None
3777: __tmp = xmlNode(_obj=ret)
3778: return __tmp
3779:
3780: def setTreeDoc(self, tree):
3781: """update all nodes under the tree to point to the right
3782: document """
3783: if tree is None: tree__o = None
3784: else: tree__o = tree._o
3785: libxml2mod.xmlSetTreeDoc(tree__o, self._o)
3786:
3787: def stringGetNodeList(self, value):
3788: """Parse the value string and build the node list associated.
3789: Should produce a flat tree with only TEXTs and ENTITY_REFs. """
3790: ret = libxml2mod.xmlStringGetNodeList(self._o, value)
3791: if ret is None:raise treeError('xmlStringGetNodeList() failed')
3792: __tmp = xmlNode(_obj=ret)
3793: return __tmp
3794:
3795: def stringLenGetNodeList(self, value, len):
3796: """Parse the value string and build the node list associated.
3797: Should produce a flat tree with only TEXTs and ENTITY_REFs. """
3798: ret = libxml2mod.xmlStringLenGetNodeList(self._o, value, len)
3799: if ret is None:raise treeError('xmlStringLenGetNodeList() failed')
3800: __tmp = xmlNode(_obj=ret)
3801: return __tmp
3802:
3803: #
3804: # xmlDoc functions from module valid
3805: #
3806:
3807: def ID(self, ID):
3808: """Search the attribute declaring the given ID """
3809: ret = libxml2mod.xmlGetID(self._o, ID)
3810: if ret is None:raise treeError('xmlGetID() failed')
3811: __tmp = xmlAttr(_obj=ret)
3812: return __tmp
3813:
3814: def isID(self, elem, attr):
3815: """Determine whether an attribute is of type ID. In case we
3816: have DTD(s) then this is done if DTD loading has been
3817: requested. In the case of HTML documents parsed with the
3818: HTML parser, then ID detection is done systematically. """
3819: if elem is None: elem__o = None
3820: else: elem__o = elem._o
3821: if attr is None: attr__o = None
3822: else: attr__o = attr._o
3823: ret = libxml2mod.xmlIsID(self._o, elem__o, attr__o)
3824: return ret
3825:
3826: def isMixedElement(self, name):
3827: """Search in the DtDs whether an element accept Mixed content
3828: (or ANY) basically if it is supposed to accept text childs """
3829: ret = libxml2mod.xmlIsMixedElement(self._o, name)
3830: return ret
3831:
3832: def isRef(self, elem, attr):
3833: """Determine whether an attribute is of type Ref. In case we
3834: have DTD(s) then this is simple, otherwise we use an
3835: heuristic: name Ref (upper or lowercase). """
3836: if elem is None: elem__o = None
3837: else: elem__o = elem._o
3838: if attr is None: attr__o = None
3839: else: attr__o = attr._o
3840: ret = libxml2mod.xmlIsRef(self._o, elem__o, attr__o)
3841: return ret
3842:
3843: def removeID(self, attr):
3844: """Remove the given attribute from the ID table maintained
3845: internally. """
3846: if attr is None: attr__o = None
3847: else: attr__o = attr._o
3848: ret = libxml2mod.xmlRemoveID(self._o, attr__o)
3849: return ret
3850:
3851: def removeRef(self, attr):
3852: """Remove the given attribute from the Ref table maintained
3853: internally. """
3854: if attr is None: attr__o = None
3855: else: attr__o = attr._o
3856: ret = libxml2mod.xmlRemoveRef(self._o, attr__o)
3857: return ret
3858:
3859: def validCtxtNormalizeAttributeValue(self, ctxt, elem, name, value):
3860: """Does the validation related extra step of the normalization
3861: of attribute values: If the declared value is not CDATA,
3862: then the XML processor must further process the normalized
3863: attribute value by discarding any leading and trailing
3864: space (#x20) characters, and by replacing sequences of
3865: space (#x20) characters by single space (#x20) character.
3866: Also check VC: Standalone Document Declaration in P32, and
3867: update ctxt->valid accordingly """
3868: if ctxt is None: ctxt__o = None
3869: else: ctxt__o = ctxt._o
3870: if elem is None: elem__o = None
3871: else: elem__o = elem._o
3872: ret = libxml2mod.xmlValidCtxtNormalizeAttributeValue(ctxt__o, self._o, elem__o, name, value)
3873: return ret
3874:
3875: def validNormalizeAttributeValue(self, elem, name, value):
3876: """Does the validation related extra step of the normalization
3877: of attribute values: If the declared value is not CDATA,
3878: then the XML processor must further process the normalized
3879: attribute value by discarding any leading and trailing
3880: space (#x20) characters, and by replacing sequences of
3881: space (#x20) characters by single space (#x20) character. """
3882: if elem is None: elem__o = None
3883: else: elem__o = elem._o
3884: ret = libxml2mod.xmlValidNormalizeAttributeValue(self._o, elem__o, name, value)
3885: return ret
3886:
3887: def validateDocument(self, ctxt):
3888: """Try to validate the document instance basically it does
3889: the all the checks described by the XML Rec i.e. validates
3890: the internal and external subset (if present) and validate
3891: the document tree. """
3892: if ctxt is None: ctxt__o = None
3893: else: ctxt__o = ctxt._o
3894: ret = libxml2mod.xmlValidateDocument(ctxt__o, self._o)
3895: return ret
3896:
3897: def validateDocumentFinal(self, ctxt):
3898: """Does the final step for the document validation once all
3899: the incremental validation steps have been completed
3900: basically it does the following checks described by the XML
3901: Rec Check all the IDREF/IDREFS attributes definition for
3902: validity """
3903: if ctxt is None: ctxt__o = None
3904: else: ctxt__o = ctxt._o
3905: ret = libxml2mod.xmlValidateDocumentFinal(ctxt__o, self._o)
3906: return ret
3907:
3908: def validateDtd(self, ctxt, dtd):
3909: """Try to validate the document against the dtd instance
3910: Basically it does check all the definitions in the DtD.
3911: Note the the internal subset (if present) is de-coupled
3912: (i.e. not used), which could give problems if ID or IDREF
3913: is present. """
3914: if ctxt is None: ctxt__o = None
3915: else: ctxt__o = ctxt._o
3916: if dtd is None: dtd__o = None
3917: else: dtd__o = dtd._o
3918: ret = libxml2mod.xmlValidateDtd(ctxt__o, self._o, dtd__o)
3919: return ret
3920:
3921: def validateDtdFinal(self, ctxt):
3922: """Does the final step for the dtds validation once all the
3923: subsets have been parsed basically it does the following
3924: checks described by the XML Rec - check that ENTITY and
3925: ENTITIES type attributes default or possible values matches
3926: one of the defined entities. - check that NOTATION type
3927: attributes default or possible values matches one of the
3928: defined notations. """
3929: if ctxt is None: ctxt__o = None
3930: else: ctxt__o = ctxt._o
3931: ret = libxml2mod.xmlValidateDtdFinal(ctxt__o, self._o)
3932: return ret
3933:
3934: def validateElement(self, ctxt, elem):
3935: """Try to validate the subtree under an element """
3936: if ctxt is None: ctxt__o = None
3937: else: ctxt__o = ctxt._o
3938: if elem is None: elem__o = None
3939: else: elem__o = elem._o
3940: ret = libxml2mod.xmlValidateElement(ctxt__o, self._o, elem__o)
3941: return ret
3942:
3943: def validateNotationUse(self, ctxt, notationName):
3944: """Validate that the given name match a notation declaration.
3945: - [ VC: Notation Declared ] """
3946: if ctxt is None: ctxt__o = None
3947: else: ctxt__o = ctxt._o
3948: ret = libxml2mod.xmlValidateNotationUse(ctxt__o, self._o, notationName)
3949: return ret
3950:
3951: def validateOneAttribute(self, ctxt, elem, attr, value):
3952: """Try to validate a single attribute for an element basically
3953: it does the following checks as described by the XML-1.0
3954: recommendation: - [ VC: Attribute Value Type ] - [ VC:
3955: Fixed Attribute Default ] - [ VC: Entity Name ] - [ VC:
3956: Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC: Entity
3957: Name ] - [ VC: Notation Attributes ] The ID/IDREF
3958: uniqueness and matching are done separately """
3959: if ctxt is None: ctxt__o = None
3960: else: ctxt__o = ctxt._o
3961: if elem is None: elem__o = None
3962: else: elem__o = elem._o
3963: if attr is None: attr__o = None
3964: else: attr__o = attr._o
3965: ret = libxml2mod.xmlValidateOneAttribute(ctxt__o, self._o, elem__o, attr__o, value)
3966: return ret
3967:
3968: def validateOneElement(self, ctxt, elem):
3969: """Try to validate a single element and it's attributes,
3970: basically it does the following checks as described by the
3971: XML-1.0 recommendation: - [ VC: Element Valid ] - [ VC:
3972: Required Attribute ] Then call xmlValidateOneAttribute()
3973: for each attribute present. The ID/IDREF checkings are
3974: done separately """
3975: if ctxt is None: ctxt__o = None
3976: else: ctxt__o = ctxt._o
3977: if elem is None: elem__o = None
3978: else: elem__o = elem._o
3979: ret = libxml2mod.xmlValidateOneElement(ctxt__o, self._o, elem__o)
3980: return ret
3981:
3982: def validateOneNamespace(self, ctxt, elem, prefix, ns, value):
3983: """Try to validate a single namespace declaration for an
3984: element basically it does the following checks as described
3985: by the XML-1.0 recommendation: - [ VC: Attribute Value Type
3986: ] - [ VC: Fixed Attribute Default ] - [ VC: Entity Name ] -
3987: [ VC: Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC:
3988: Entity Name ] - [ VC: Notation Attributes ] The ID/IDREF
3989: uniqueness and matching are done separately """
3990: if ctxt is None: ctxt__o = None
3991: else: ctxt__o = ctxt._o
3992: if elem is None: elem__o = None
3993: else: elem__o = elem._o
3994: if ns is None: ns__o = None
3995: else: ns__o = ns._o
3996: ret = libxml2mod.xmlValidateOneNamespace(ctxt__o, self._o, elem__o, prefix, ns__o, value)
3997: return ret
3998:
3999: def validatePopElement(self, ctxt, elem, qname):
4000: """Pop the element end from the validation stack. """
4001: if ctxt is None: ctxt__o = None
4002: else: ctxt__o = ctxt._o
4003: if elem is None: elem__o = None
4004: else: elem__o = elem._o
4005: ret = libxml2mod.xmlValidatePopElement(ctxt__o, self._o, elem__o, qname)
4006: return ret
4007:
4008: def validatePushElement(self, ctxt, elem, qname):
4009: """Push a new element start on the validation stack. """
4010: if ctxt is None: ctxt__o = None
4011: else: ctxt__o = ctxt._o
4012: if elem is None: elem__o = None
4013: else: elem__o = elem._o
4014: ret = libxml2mod.xmlValidatePushElement(ctxt__o, self._o, elem__o, qname)
4015: return ret
4016:
4017: def validateRoot(self, ctxt):
4018: """Try to validate a the root element basically it does the
4019: following check as described by the XML-1.0 recommendation:
4020: - [ VC: Root Element Type ] it doesn't try to recurse or
4021: apply other check to the element """
4022: if ctxt is None: ctxt__o = None
4023: else: ctxt__o = ctxt._o
4024: ret = libxml2mod.xmlValidateRoot(ctxt__o, self._o)
4025: return ret
4026:
4027: #
4028: # xmlDoc functions from module xinclude
4029: #
4030:
4031: def xincludeProcess(self):
4032: """Implement the XInclude substitution on the XML document @doc """
4033: ret = libxml2mod.xmlXIncludeProcess(self._o)
4034: return ret
4035:
4036: def xincludeProcessFlags(self, flags):
4037: """Implement the XInclude substitution on the XML document @doc """
4038: ret = libxml2mod.xmlXIncludeProcessFlags(self._o, flags)
4039: return ret
4040:
4041: #
4042: # xmlDoc functions from module xmlreader
4043: #
4044:
4045: def NewWalker(self, reader):
4046: """Setup an xmltextReader to parse a preparsed XML document.
4047: This reuses the existing @reader xmlTextReader. """
4048: if reader is None: reader__o = None
4049: else: reader__o = reader._o
4050: ret = libxml2mod.xmlReaderNewWalker(reader__o, self._o)
4051: return ret
4052:
4053: def readerWalker(self):
4054: """Create an xmltextReader for a preparsed document. """
4055: ret = libxml2mod.xmlReaderWalker(self._o)
4056: if ret is None:raise treeError('xmlReaderWalker() failed')
4057: __tmp = xmlTextReader(_obj=ret)
4058: return __tmp
4059:
4060: #
4061: # xmlDoc functions from module xmlschemas
4062: #
4063:
4064: def schemaNewDocParserCtxt(self):
4065: """Create an XML Schemas parse context for that document. NB.
4066: The document may be modified during the parsing process. """
4067: ret = libxml2mod.xmlSchemaNewDocParserCtxt(self._o)
4068: if ret is None:raise parserError('xmlSchemaNewDocParserCtxt() failed')
4069: __tmp = SchemaParserCtxt(_obj=ret)
4070: return __tmp
4071:
4072: def schemaValidateDoc(self, ctxt):
4073: """Validate a document tree in memory. """
4074: if ctxt is None: ctxt__o = None
4075: else: ctxt__o = ctxt._o
4076: ret = libxml2mod.xmlSchemaValidateDoc(ctxt__o, self._o)
4077: return ret
4078:
4079: #
4080: # xmlDoc functions from module xpath
4081: #
4082:
4083: def xpathNewContext(self):
4084: """Create a new xmlXPathContext """
4085: ret = libxml2mod.xmlXPathNewContext(self._o)
4086: if ret is None:raise xpathError('xmlXPathNewContext() failed')
4087: __tmp = xpathContext(_obj=ret)
4088: return __tmp
4089:
4090: def xpathOrderDocElems(self):
4091: """Call this routine to speed up XPath computation on static
4092: documents. This stamps all the element nodes with the
4093: document order Like for line information, the order is kept
4094: in the element->content field, the value stored is actually
4095: - the node number (starting at -1) to be able to
4096: differentiate from line numbers. """
4097: ret = libxml2mod.xmlXPathOrderDocElems(self._o)
4098: return ret
4099:
4100: #
4101: # xmlDoc functions from module xpointer
4102: #
4103:
4104: def xpointerNewContext(self, here, origin):
4105: """Create a new XPointer context """
4106: if here is None: here__o = None
4107: else: here__o = here._o
4108: if origin is None: origin__o = None
4109: else: origin__o = origin._o
4110: ret = libxml2mod.xmlXPtrNewContext(self._o, here__o, origin__o)
4111: if ret is None:raise treeError('xmlXPtrNewContext() failed')
4112: __tmp = xpathContext(_obj=ret)
4113: return __tmp
4114:
4115: class parserCtxt(parserCtxtCore):
4116: def __init__(self, _obj=None):
4117: self._o = _obj
4118: parserCtxtCore.__init__(self, _obj=_obj)
4119:
4120: def __del__(self):
4121: if self._o != None:
4122: libxml2mod.xmlFreeParserCtxt(self._o)
4123: self._o = None
4124:
4125: # accessors for parserCtxt
4126: def doc(self):
4127: """Get the document tree from a parser context. """
4128: ret = libxml2mod.xmlParserGetDoc(self._o)
4129: if ret is None:raise parserError('xmlParserGetDoc() failed')
4130: __tmp = xmlDoc(_obj=ret)
4131: return __tmp
4132:
4133: def isValid(self):
4134: """Get the validity information from a parser context. """
4135: ret = libxml2mod.xmlParserGetIsValid(self._o)
4136: return ret
4137:
4138: def lineNumbers(self, linenumbers):
4139: """Switch on the generation of line number for elements nodes. """
4140: libxml2mod.xmlParserSetLineNumbers(self._o, linenumbers)
4141:
4142: def loadSubset(self, loadsubset):
4143: """Switch the parser to load the DTD without validating. """
4144: libxml2mod.xmlParserSetLoadSubset(self._o, loadsubset)
4145:
4146: def pedantic(self, pedantic):
4147: """Switch the parser to be pedantic. """
4148: libxml2mod.xmlParserSetPedantic(self._o, pedantic)
4149:
4150: def replaceEntities(self, replaceEntities):
4151: """Switch the parser to replace entities. """
4152: libxml2mod.xmlParserSetReplaceEntities(self._o, replaceEntities)
4153:
4154: def validate(self, validate):
4155: """Switch the parser to validation mode. """
4156: libxml2mod.xmlParserSetValidate(self._o, validate)
4157:
4158: def wellFormed(self):
4159: """Get the well formed information from a parser context. """
4160: ret = libxml2mod.xmlParserGetWellFormed(self._o)
4161: return ret
4162:
4163: #
4164: # parserCtxt functions from module HTMLparser
4165: #
4166:
4167: def htmlCtxtReadDoc(self, cur, URL, encoding, options):
4168: """parse an XML in-memory document and build a tree. This
4169: reuses the existing @ctxt parser context """
4170: ret = libxml2mod.htmlCtxtReadDoc(self._o, cur, URL, encoding, options)
4171: if ret is None:raise treeError('htmlCtxtReadDoc() failed')
4172: __tmp = xmlDoc(_obj=ret)
4173: return __tmp
4174:
4175: def htmlCtxtReadFd(self, fd, URL, encoding, options):
4176: """parse an XML from a file descriptor and build a tree. This
4177: reuses the existing @ctxt parser context """
4178: ret = libxml2mod.htmlCtxtReadFd(self._o, fd, URL, encoding, options)
4179: if ret is None:raise treeError('htmlCtxtReadFd() failed')
4180: __tmp = xmlDoc(_obj=ret)
4181: return __tmp
4182:
4183: def htmlCtxtReadFile(self, filename, encoding, options):
4184: """parse an XML file from the filesystem or the network. This
4185: reuses the existing @ctxt parser context """
4186: ret = libxml2mod.htmlCtxtReadFile(self._o, filename, encoding, options)
4187: if ret is None:raise treeError('htmlCtxtReadFile() failed')
4188: __tmp = xmlDoc(_obj=ret)
4189: return __tmp
4190:
4191: def htmlCtxtReadMemory(self, buffer, size, URL, encoding, options):
4192: """parse an XML in-memory document and build a tree. This
4193: reuses the existing @ctxt parser context """
4194: ret = libxml2mod.htmlCtxtReadMemory(self._o, buffer, size, URL, encoding, options)
4195: if ret is None:raise treeError('htmlCtxtReadMemory() failed')
4196: __tmp = xmlDoc(_obj=ret)
4197: return __tmp
4198:
4199: def htmlCtxtReset(self):
4200: """Reset a parser context """
4201: libxml2mod.htmlCtxtReset(self._o)
4202:
4203: def htmlCtxtUseOptions(self, options):
4204: """Applies the options to the parser context """
4205: ret = libxml2mod.htmlCtxtUseOptions(self._o, options)
4206: return ret
4207:
4208: def htmlFreeParserCtxt(self):
4209: """Free all the memory used by a parser context. However the
4210: parsed document in ctxt->myDoc is not freed. """
4211: libxml2mod.htmlFreeParserCtxt(self._o)
4212:
4213: def htmlParseCharRef(self):
4214: """parse Reference declarations [66] CharRef ::= '&#' [0-9]+
4215: ';' | '&#x' [0-9a-fA-F]+ ';' """
4216: ret = libxml2mod.htmlParseCharRef(self._o)
4217: return ret
4218:
4219: def htmlParseChunk(self, chunk, size, terminate):
4220: """Parse a Chunk of memory """
4221: ret = libxml2mod.htmlParseChunk(self._o, chunk, size, terminate)
4222: return ret
4223:
4224: def htmlParseDocument(self):
4225: """parse an HTML document (and build a tree if using the
4226: standard SAX interface). """
4227: ret = libxml2mod.htmlParseDocument(self._o)
4228: return ret
4229:
4230: def htmlParseElement(self):
4231: """parse an HTML element, this is highly recursive this is
4232: kept for compatibility with previous code versions [39]
4233: element ::= EmptyElemTag | STag content ETag [41]
4234: Attribute ::= Name Eq AttValue """
4235: libxml2mod.htmlParseElement(self._o)
4236:
4237: #
4238: # parserCtxt functions from module parser
4239: #
4240:
4241: def byteConsumed(self):
4242: """This function provides the current index of the parser
4243: relative to the start of the current entity. This function
4244: is computed in bytes from the beginning starting at zero
4245: and finishing at the size in byte of the file if parsing a
4246: file. The function is of constant cost if the input is
4247: UTF-8 but can be costly if run on non-UTF-8 input. """
4248: ret = libxml2mod.xmlByteConsumed(self._o)
4249: return ret
4250:
4251: def clearParserCtxt(self):
4252: """Clear (release owned resources) and reinitialize a parser
4253: context """
4254: libxml2mod.xmlClearParserCtxt(self._o)
4255:
4256: def ctxtReadDoc(self, cur, URL, encoding, options):
4257: """parse an XML in-memory document and build a tree. This
4258: reuses the existing @ctxt parser context """
4259: ret = libxml2mod.xmlCtxtReadDoc(self._o, cur, URL, encoding, options)
4260: if ret is None:raise treeError('xmlCtxtReadDoc() failed')
4261: __tmp = xmlDoc(_obj=ret)
4262: return __tmp
4263:
4264: def ctxtReadFd(self, fd, URL, encoding, options):
4265: """parse an XML from a file descriptor and build a tree. This
4266: reuses the existing @ctxt parser context NOTE that the file
4267: descriptor will not be closed when the reader is closed or
4268: reset. """
4269: ret = libxml2mod.xmlCtxtReadFd(self._o, fd, URL, encoding, options)
4270: if ret is None:raise treeError('xmlCtxtReadFd() failed')
4271: __tmp = xmlDoc(_obj=ret)
4272: return __tmp
4273:
4274: def ctxtReadFile(self, filename, encoding, options):
4275: """parse an XML file from the filesystem or the network. This
4276: reuses the existing @ctxt parser context """
4277: ret = libxml2mod.xmlCtxtReadFile(self._o, filename, encoding, options)
4278: if ret is None:raise treeError('xmlCtxtReadFile() failed')
4279: __tmp = xmlDoc(_obj=ret)
4280: return __tmp
4281:
4282: def ctxtReadMemory(self, buffer, size, URL, encoding, options):
4283: """parse an XML in-memory document and build a tree. This
4284: reuses the existing @ctxt parser context """
4285: ret = libxml2mod.xmlCtxtReadMemory(self._o, buffer, size, URL, encoding, options)
4286: if ret is None:raise treeError('xmlCtxtReadMemory() failed')
4287: __tmp = xmlDoc(_obj=ret)
4288: return __tmp
4289:
4290: def ctxtReset(self):
4291: """Reset a parser context """
4292: libxml2mod.xmlCtxtReset(self._o)
4293:
4294: def ctxtResetPush(self, chunk, size, filename, encoding):
4295: """Reset a push parser context """
4296: ret = libxml2mod.xmlCtxtResetPush(self._o, chunk, size, filename, encoding)
4297: return ret
4298:
4299: def ctxtUseOptions(self, options):
4300: """Applies the options to the parser context """
4301: ret = libxml2mod.xmlCtxtUseOptions(self._o, options)
4302: return ret
4303:
4304: def initParserCtxt(self):
4305: """Initialize a parser context """
4306: ret = libxml2mod.xmlInitParserCtxt(self._o)
4307: return ret
4308:
4309: def parseChunk(self, chunk, size, terminate):
4310: """Parse a Chunk of memory """
4311: ret = libxml2mod.xmlParseChunk(self._o, chunk, size, terminate)
4312: return ret
4313:
4314: def parseDocument(self):
4315: """parse an XML document (and build a tree if using the
4316: standard SAX interface). [1] document ::= prolog element
4317: Misc* [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? """
4318: ret = libxml2mod.xmlParseDocument(self._o)
4319: return ret
4320:
4321: def parseExtParsedEnt(self):
4322: """parse a general parsed entity An external general parsed
4323: entity is well-formed if it matches the production labeled
4324: extParsedEnt. [78] extParsedEnt ::= TextDecl? content """
4325: ret = libxml2mod.xmlParseExtParsedEnt(self._o)
4326: return ret
4327:
4328: def setupParserForBuffer(self, buffer, filename):
4329: """Setup the parser context to parse a new buffer; Clears any
4330: prior contents from the parser context. The buffer
4331: parameter must not be None, but the filename parameter can
4332: be """
4333: libxml2mod.xmlSetupParserForBuffer(self._o, buffer, filename)
4334:
4335: def stopParser(self):
4336: """Blocks further parser processing """
4337: libxml2mod.xmlStopParser(self._o)
4338:
4339: #
4340: # parserCtxt functions from module parserInternals
4341: #
4342:
4343: def decodeEntities(self, len, what, end, end2, end3):
4344: """This function is deprecated, we now always process entities
4345: content through xmlStringDecodeEntities TODO: remove it in
4346: next major release. [67] Reference ::= EntityRef | CharRef
4347: [69] PEReference ::= '%' Name ';' """
4348: ret = libxml2mod.xmlDecodeEntities(self._o, len, what, end, end2, end3)
4349: return ret
4350:
4351: def handleEntity(self, entity):
4352: """Default handling of defined entities, when should we define
4353: a new input stream ? When do we just handle that as a set
4354: of chars ? OBSOLETE: to be removed at some point. """
4355: if entity is None: entity__o = None
4356: else: entity__o = entity._o
4357: libxml2mod.xmlHandleEntity(self._o, entity__o)
4358:
4359: def namespaceParseNCName(self):
4360: """parse an XML namespace name. TODO: this seems not in use
4361: anymore, the namespace handling is done on top of the SAX
4362: interfaces, i.e. not on raw input. [NS 3] NCName ::=
4363: (Letter | '_') (NCNameChar)* [NS 4] NCNameChar ::= Letter
4364: | Digit | '.' | '-' | '_' | CombiningChar | Extender """
4365: ret = libxml2mod.xmlNamespaceParseNCName(self._o)
4366: return ret
4367:
4368: def namespaceParseNSDef(self):
4369: """parse a namespace prefix declaration TODO: this seems not
4370: in use anymore, the namespace handling is done on top of
4371: the SAX interfaces, i.e. not on raw input. [NS 1] NSDef
4372: ::= PrefixDef Eq SystemLiteral [NS 2] PrefixDef ::=
4373: 'xmlns' (':' NCName)? """
4374: ret = libxml2mod.xmlNamespaceParseNSDef(self._o)
4375: return ret
4376:
4377: def nextChar(self):
4378: """Skip to the next char input char. """
4379: libxml2mod.xmlNextChar(self._o)
4380:
4381: def parseAttValue(self):
4382: """parse a value for an attribute Note: the parser won't do
4383: substitution of entities here, this will be handled later
4384: in xmlStringGetNodeList [10] AttValue ::= '"' ([^<&"] |
4385: Reference)* '"' | "'" ([^<&'] | Reference)* "'" 3.3.3
4386: Attribute-Value Normalization: Before the value of an
4387: attribute is passed to the application or checked for
4388: validity, the XML processor must normalize it as follows: -
4389: a character reference is processed by appending the
4390: referenced character to the attribute value - an entity
4391: reference is processed by recursively processing the
4392: replacement text of the entity - a whitespace character
4393: (#x20, #xD, #xA, #x9) is processed by appending #x20 to the
4394: normalized value, except that only a single #x20 is
4395: appended for a "#xD#xA" sequence that is part of an
4396: external parsed entity or the literal entity value of an
4397: internal parsed entity - other characters are processed by
4398: appending them to the normalized value If the declared
4399: value is not CDATA, then the XML processor must further
4400: process the normalized attribute value by discarding any
4401: leading and trailing space (#x20) characters, and by
4402: replacing sequences of space (#x20) characters by a single
4403: space (#x20) character. All attributes for which no
4404: declaration has been read should be treated by a
4405: non-validating parser as if declared CDATA. """
4406: ret = libxml2mod.xmlParseAttValue(self._o)
4407: return ret
4408:
4409: def parseAttributeListDecl(self):
4410: """: parse the Attribute list def for an element [52]
4411: AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>' [53]
4412: AttDef ::= S Name S AttType S DefaultDecl """
4413: libxml2mod.xmlParseAttributeListDecl(self._o)
4414:
4415: def parseCDSect(self):
4416: """Parse escaped pure raw content. [18] CDSect ::= CDStart
4417: CData CDEnd [19] CDStart ::= '<![CDATA[' [20] Data ::=
4418: (Char* - (Char* ']]>' Char*)) [21] CDEnd ::= ']]>' """
4419: libxml2mod.xmlParseCDSect(self._o)
4420:
4421: def parseCharData(self, cdata):
4422: """parse a CharData section. if we are within a CDATA section
4423: ']]>' marks an end of section. The right angle bracket (>)
4424: may be represented using the string ">", and must, for
4425: compatibility, be escaped using ">" or a character
4426: reference when it appears in the string "]]>" in content,
4427: when that string is not marking the end of a CDATA section.
4428: [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) """
4429: libxml2mod.xmlParseCharData(self._o, cdata)
4430:
4431: def parseCharRef(self):
4432: """parse Reference declarations [66] CharRef ::= '&#' [0-9]+
4433: ';' | '&#x' [0-9a-fA-F]+ ';' [ WFC: Legal Character ]
4434: Characters referred to using character references must
4435: match the production for Char. """
4436: ret = libxml2mod.xmlParseCharRef(self._o)
4437: return ret
4438:
4439: def parseComment(self):
4440: """Skip an XML (SGML) comment <!-- .... --> The spec says that
4441: "For compatibility, the string "--" (double-hyphen) must
4442: not occur within comments. " [15] Comment ::= '<!--'
4443: ((Char - '-') | ('-' (Char - '-')))* '-->' """
4444: libxml2mod.xmlParseComment(self._o)
4445:
4446: def parseContent(self):
4447: """Parse a content: [43] content ::= (element | CharData |
4448: Reference | CDSect | PI | Comment)* """
4449: libxml2mod.xmlParseContent(self._o)
4450:
4451: def parseDocTypeDecl(self):
4452: """parse a DOCTYPE declaration [28] doctypedecl ::=
4453: '<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl |
4454: PEReference | S)* ']' S?)? '>' [ VC: Root Element Type ]
4455: The Name in the document type declaration must match the
4456: element type of the root element. """
4457: libxml2mod.xmlParseDocTypeDecl(self._o)
4458:
4459: def parseElement(self):
4460: """parse an XML element, this is highly recursive [39]
4461: element ::= EmptyElemTag | STag content ETag [ WFC:
4462: Element Type Match ] The Name in an element's end-tag must
4463: match the element type in the start-tag. """
4464: libxml2mod.xmlParseElement(self._o)
4465:
4466: def parseElementDecl(self):
4467: """parse an Element declaration. [45] elementdecl ::=
4468: '<!ELEMENT' S Name S contentspec S? '>' [ VC: Unique
4469: Element Type Declaration ] No element type may be declared
4470: more than once """
4471: ret = libxml2mod.xmlParseElementDecl(self._o)
4472: return ret
4473:
4474: def parseEncName(self):
4475: """parse the XML encoding name [81] EncName ::= [A-Za-z]
4476: ([A-Za-z0-9._] | '-')* """
4477: ret = libxml2mod.xmlParseEncName(self._o)
4478: return ret
4479:
4480: def parseEncodingDecl(self):
4481: """parse the XML encoding declaration [80] EncodingDecl ::= S
4482: 'encoding' Eq ('"' EncName '"' | "'" EncName "'") this
4483: setups the conversion filters. """
4484: ret = libxml2mod.xmlParseEncodingDecl(self._o)
4485: return ret
4486:
4487: def parseEndTag(self):
4488: """parse an end of tag [42] ETag ::= '</' Name S? '>' With
4489: namespace [NS 9] ETag ::= '</' QName S? '>' """
4490: libxml2mod.xmlParseEndTag(self._o)
4491:
4492: def parseEntityDecl(self):
4493: """parse <!ENTITY declarations [70] EntityDecl ::= GEDecl |
4494: PEDecl [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S?
4495: '>' [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>'
4496: [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)
4497: [74] PEDef ::= EntityValue | ExternalID [76] NDataDecl ::=
4498: S 'NDATA' S Name [ VC: Notation Declared ] The Name must
4499: match the declared name of a notation. """
4500: libxml2mod.xmlParseEntityDecl(self._o)
4501:
4502: def parseEntityRef(self):
4503: """parse ENTITY references declarations [68] EntityRef ::=
4504: '&' Name ';' [ WFC: Entity Declared ] In a document
4505: without any DTD, a document with only an internal DTD
4506: subset which contains no parameter entity references, or a
4507: document with "standalone='yes'", the Name given in the
4508: entity reference must match that in an entity declaration,
4509: except that well-formed documents need not declare any of
4510: the following entities: amp, lt, gt, apos, quot. The
4511: declaration of a parameter entity must precede any
4512: reference to it. Similarly, the declaration of a general
4513: entity must precede any reference to it which appears in a
4514: default value in an attribute-list declaration. Note that
4515: if entities are declared in the external subset or in
4516: external parameter entities, a non-validating processor is
4517: not obligated to read and process their declarations; for
4518: such documents, the rule that an entity must be declared is
4519: a well-formedness constraint only if standalone='yes'. [
4520: WFC: Parsed Entity ] An entity reference must not contain
4521: the name of an unparsed entity """
4522: ret = libxml2mod.xmlParseEntityRef(self._o)
4523: if ret is None:raise parserError('xmlParseEntityRef() failed')
4524: __tmp = xmlEntity(_obj=ret)
4525: return __tmp
4526:
4527: def parseExternalSubset(self, ExternalID, SystemID):
4528: """parse Markup declarations from an external subset [30]
4529: extSubset ::= textDecl? extSubsetDecl [31] extSubsetDecl
4530: ::= (markupdecl | conditionalSect | PEReference | S) * """
4531: libxml2mod.xmlParseExternalSubset(self._o, ExternalID, SystemID)
4532:
4533: def parseMarkupDecl(self):
4534: """parse Markup declarations [29] markupdecl ::= elementdecl
4535: | AttlistDecl | EntityDecl | NotationDecl | PI | Comment [
4536: VC: Proper Declaration/PE Nesting ] Parameter-entity
4537: replacement text must be properly nested with markup
4538: declarations. That is to say, if either the first character
4539: or the last character of a markup declaration (markupdecl
4540: above) is contained in the replacement text for a
4541: parameter-entity reference, both must be contained in the
4542: same replacement text. [ WFC: PEs in Internal Subset ] In
4543: the internal DTD subset, parameter-entity references can
4544: occur only where markup declarations can occur, not within
4545: markup declarations. (This does not apply to references
4546: that occur in external parameter entities or to the
4547: external subset.) """
4548: libxml2mod.xmlParseMarkupDecl(self._o)
4549:
4550: def parseMisc(self):
4551: """parse an XML Misc* optional field. [27] Misc ::= Comment |
4552: PI | S """
4553: libxml2mod.xmlParseMisc(self._o)
4554:
4555: def parseName(self):
4556: """parse an XML name. [4] NameChar ::= Letter | Digit | '.' |
4557: '-' | '_' | ':' | CombiningChar | Extender [5] Name ::=
4558: (Letter | '_' | ':') (NameChar)* [6] Names ::= Name (#x20
4559: Name)* """
4560: ret = libxml2mod.xmlParseName(self._o)
4561: return ret
4562:
4563: def parseNamespace(self):
4564: """xmlParseNamespace: parse specific PI '<?namespace ...'
4565: constructs. This is what the older xml-name Working Draft
4566: specified, a bunch of other stuff may still rely on it, so
4567: support is still here as if it was declared on the root of
4568: the Tree:-( TODO: remove from library To be removed at
4569: next drop of binary compatibility """
4570: libxml2mod.xmlParseNamespace(self._o)
4571:
4572: def parseNmtoken(self):
4573: """parse an XML Nmtoken. [7] Nmtoken ::= (NameChar)+ [8]
4574: Nmtokens ::= Nmtoken (#x20 Nmtoken)* """
4575: ret = libxml2mod.xmlParseNmtoken(self._o)
4576: return ret
4577:
4578: def parseNotationDecl(self):
4579: """parse a notation declaration [82] NotationDecl ::=
4580: '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'
4581: Hence there is actually 3 choices: 'PUBLIC' S PubidLiteral
4582: 'PUBLIC' S PubidLiteral S SystemLiteral and 'SYSTEM' S
4583: SystemLiteral See the NOTE on xmlParseExternalID(). """
4584: libxml2mod.xmlParseNotationDecl(self._o)
4585:
4586: def parsePEReference(self):
4587: """parse PEReference declarations The entity content is
4588: handled directly by pushing it's content as a new input
4589: stream. [69] PEReference ::= '%' Name ';' [ WFC: No
4590: Recursion ] A parsed entity must not contain a recursive
4591: reference to itself, either directly or indirectly. [ WFC:
4592: Entity Declared ] In a document without any DTD, a document
4593: with only an internal DTD subset which contains no
4594: parameter entity references, or a document with
4595: "standalone='yes'", ... ... The declaration of a parameter
4596: entity must precede any reference to it... [ VC: Entity
4597: Declared ] In a document with an external subset or
4598: external parameter entities with "standalone='no'", ...
4599: ... The declaration of a parameter entity must precede any
4600: reference to it... [ WFC: In DTD ] Parameter-entity
4601: references may only appear in the DTD. NOTE: misleading but
4602: this is handled. """
4603: libxml2mod.xmlParsePEReference(self._o)
4604:
4605: def parsePI(self):
4606: """parse an XML Processing Instruction. [16] PI ::= '<?'
4607: PITarget (S (Char* - (Char* '?>' Char*)))? '?>' The
4608: processing is transfered to SAX once parsed. """
4609: libxml2mod.xmlParsePI(self._o)
4610:
4611: def parsePITarget(self):
4612: """parse the name of a PI [17] PITarget ::= Name - (('X' |
4613: 'x') ('M' | 'm') ('L' | 'l')) """
4614: ret = libxml2mod.xmlParsePITarget(self._o)
4615: return ret
4616:
4617: def parsePubidLiteral(self):
4618: """parse an XML public literal [12] PubidLiteral ::= '"'
4619: PubidChar* '"' | "'" (PubidChar - "'")* "'" """
4620: ret = libxml2mod.xmlParsePubidLiteral(self._o)
4621: return ret
4622:
4623: def parseQuotedString(self):
4624: """Parse and return a string between quotes or doublequotes
4625: TODO: Deprecated, to be removed at next drop of binary
4626: compatibility """
4627: ret = libxml2mod.xmlParseQuotedString(self._o)
4628: return ret
4629:
4630: def parseReference(self):
4631: """parse and handle entity references in content, depending on
4632: the SAX interface, this may end-up in a call to character()
4633: if this is a CharRef, a predefined entity, if there is no
4634: reference() callback. or if the parser was asked to switch
4635: to that mode. [67] Reference ::= EntityRef | CharRef """
4636: libxml2mod.xmlParseReference(self._o)
4637:
4638: def parseSDDecl(self):
4639: """parse the XML standalone declaration [32] SDDecl ::= S
4640: 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' |
4641: 'no')'"')) [ VC: Standalone Document Declaration ] TODO
4642: The standalone document declaration must have the value
4643: "no" if any external markup declarations contain
4644: declarations of: - attributes with default values, if
4645: elements to which these attributes apply appear in the
4646: document without specifications of values for these
4647: attributes, or - entities (other than amp, lt, gt, apos,
4648: quot), if references to those entities appear in the
4649: document, or - attributes with values subject to
4650: normalization, where the attribute appears in the document
4651: with a value which will change as a result of
4652: normalization, or - element types with element content, if
4653: white space occurs directly within any instance of those
4654: types. """
4655: ret = libxml2mod.xmlParseSDDecl(self._o)
4656: return ret
4657:
4658: def parseStartTag(self):
4659: """parse a start of tag either for rule element or
4660: EmptyElement. In both case we don't parse the tag closing
4661: chars. [40] STag ::= '<' Name (S Attribute)* S? '>' [
4662: WFC: Unique Att Spec ] No attribute name may appear more
4663: than once in the same start-tag or empty-element tag. [44]
4664: EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' [ WFC:
4665: Unique Att Spec ] No attribute name may appear more than
4666: once in the same start-tag or empty-element tag. With
4667: namespace: [NS 8] STag ::= '<' QName (S Attribute)* S? '>'
4668: [NS 10] EmptyElement ::= '<' QName (S Attribute)* S? '/>' """
4669: ret = libxml2mod.xmlParseStartTag(self._o)
4670: return ret
4671:
4672: def parseSystemLiteral(self):
4673: """parse an XML Literal [11] SystemLiteral ::= ('"' [^"]*
4674: '"') | ("'" [^']* "'") """
4675: ret = libxml2mod.xmlParseSystemLiteral(self._o)
4676: return ret
4677:
4678: def parseTextDecl(self):
4679: """parse an XML declaration header for external entities [77]
4680: TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' """
4681: libxml2mod.xmlParseTextDecl(self._o)
4682:
4683: def parseVersionInfo(self):
4684: """parse the XML version. [24] VersionInfo ::= S 'version' Eq
4685: (' VersionNum ' | " VersionNum ") [25] Eq ::= S? '=' S? """
4686: ret = libxml2mod.xmlParseVersionInfo(self._o)
4687: return ret
4688:
4689: def parseVersionNum(self):
4690: """parse the XML version value. [26] VersionNum ::= '1.'
4691: [0-9]+ In practice allow [0-9].[0-9]+ at that level """
4692: ret = libxml2mod.xmlParseVersionNum(self._o)
4693: return ret
4694:
4695: def parseXMLDecl(self):
4696: """parse an XML declaration header [23] XMLDecl ::= '<?xml'
4697: VersionInfo EncodingDecl? SDDecl? S? '?>' """
4698: libxml2mod.xmlParseXMLDecl(self._o)
4699:
4700: def parserHandlePEReference(self):
4701: """[69] PEReference ::= '%' Name ';' [ WFC: No Recursion ] A
4702: parsed entity must not contain a recursive reference to
4703: itself, either directly or indirectly. [ WFC: Entity
4704: Declared ] In a document without any DTD, a document with
4705: only an internal DTD subset which contains no parameter
4706: entity references, or a document with "standalone='yes'",
4707: ... ... The declaration of a parameter entity must precede
4708: any reference to it... [ VC: Entity Declared ] In a
4709: document with an external subset or external parameter
4710: entities with "standalone='no'", ... ... The declaration
4711: of a parameter entity must precede any reference to it...
4712: [ WFC: In DTD ] Parameter-entity references may only appear
4713: in the DTD. NOTE: misleading but this is handled. A
4714: PEReference may have been detected in the current input
4715: stream the handling is done accordingly to
4716: http://www.w3.org/TR/REC-xml#entproc i.e. - Included in
4717: literal in entity values - Included as Parameter Entity
4718: reference within DTDs """
4719: libxml2mod.xmlParserHandlePEReference(self._o)
4720:
4721: def parserHandleReference(self):
4722: """TODO: Remove, now deprecated ... the test is done directly
4723: in the content parsing routines. [67] Reference ::=
4724: EntityRef | CharRef [68] EntityRef ::= '&' Name ';' [
4725: WFC: Entity Declared ] the Name given in the entity
4726: reference must match that in an entity declaration, except
4727: that well-formed documents need not declare any of the
4728: following entities: amp, lt, gt, apos, quot. [ WFC: Parsed
4729: Entity ] An entity reference must not contain the name of
4730: an unparsed entity [66] CharRef ::= '&#' [0-9]+ ';' |
4731: '&#x' [0-9a-fA-F]+ ';' A PEReference may have been
4732: detected in the current input stream the handling is done
4733: accordingly to http://www.w3.org/TR/REC-xml#entproc """
4734: libxml2mod.xmlParserHandleReference(self._o)
4735:
4736: def popInput(self):
4737: """xmlPopInput: the current input pointed by ctxt->input came
4738: to an end pop it and return the next char. """
4739: ret = libxml2mod.xmlPopInput(self._o)
4740: return ret
4741:
4742: def scanName(self):
4743: """Trickery: parse an XML name but without consuming the input
4744: flow Needed for rollback cases. Used only when parsing
4745: entities references. TODO: seems deprecated now, only used
4746: in the default part of xmlParserHandleReference [4]
4747: NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
4748: CombiningChar | Extender [5] Name ::= (Letter | '_' | ':')
4749: (NameChar)* [6] Names ::= Name (S Name)* """
4750: ret = libxml2mod.xmlScanName(self._o)
4751: return ret
4752:
4753: def skipBlankChars(self):
4754: """skip all blanks character found at that point in the input
4755: streams. It pops up finished entities in the process if
4756: allowable at that point. """
4757: ret = libxml2mod.xmlSkipBlankChars(self._o)
4758: return ret
4759:
4760: def stringDecodeEntities(self, str, what, end, end2, end3):
4761: """Takes a entity string content and process to do the
4762: adequate substitutions. [67] Reference ::= EntityRef |
4763: CharRef [69] PEReference ::= '%' Name ';' """
4764: ret = libxml2mod.xmlStringDecodeEntities(self._o, str, what, end, end2, end3)
4765: return ret
4766:
4767: def stringLenDecodeEntities(self, str, len, what, end, end2, end3):
4768: """Takes a entity string content and process to do the
4769: adequate substitutions. [67] Reference ::= EntityRef |
4770: CharRef [69] PEReference ::= '%' Name ';' """
4771: ret = libxml2mod.xmlStringLenDecodeEntities(self._o, str, len, what, end, end2, end3)
4772: return ret
4773:
4774: class xmlAttr(xmlNode):
4775: def __init__(self, _obj=None):
4776: if checkWrapper(_obj) != 0: raise TypeError('xmlAttr got a wrong wrapper object type')
4777: self._o = _obj
4778: xmlNode.__init__(self, _obj=_obj)
4779:
4780: def __repr__(self):
4781: return "<xmlAttr (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
4782:
4783: #
4784: # xmlAttr functions from module debugXML
4785: #
4786:
4787: def debugDumpAttr(self, output, depth):
4788: """Dumps debug information for the attribute """
4789: libxml2mod.xmlDebugDumpAttr(output, self._o, depth)
4790:
4791: def debugDumpAttrList(self, output, depth):
4792: """Dumps debug information for the attribute list """
4793: libxml2mod.xmlDebugDumpAttrList(output, self._o, depth)
4794:
4795: #
4796: # xmlAttr functions from module tree
4797: #
4798:
4799: def copyProp(self, target):
4800: """Do a copy of the attribute. """
4801: if target is None: target__o = None
4802: else: target__o = target._o
4803: ret = libxml2mod.xmlCopyProp(target__o, self._o)
4804: if ret is None:raise treeError('xmlCopyProp() failed')
4805: __tmp = xmlAttr(_obj=ret)
4806: return __tmp
4807:
4808: def copyPropList(self, target):
4809: """Do a copy of an attribute list. """
4810: if target is None: target__o = None
4811: else: target__o = target._o
4812: ret = libxml2mod.xmlCopyPropList(target__o, self._o)
4813: if ret is None:raise treeError('xmlCopyPropList() failed')
4814: __tmp = xmlAttr(_obj=ret)
4815: return __tmp
4816:
4817: def freeProp(self):
4818: """Free one attribute, all the content is freed too """
4819: libxml2mod.xmlFreeProp(self._o)
4820:
4821: def freePropList(self):
4822: """Free a property and all its siblings, all the children are
4823: freed too. """
4824: libxml2mod.xmlFreePropList(self._o)
4825:
4826: def removeProp(self):
4827: """Unlink and free one attribute, all the content is freed too
4828: Note this doesn't work for namespace definition attributes """
4829: ret = libxml2mod.xmlRemoveProp(self._o)
4830: return ret
4831:
4832: #
4833: # xmlAttr functions from module valid
4834: #
4835:
4836: def removeID(self, doc):
4837: """Remove the given attribute from the ID table maintained
4838: internally. """
4839: if doc is None: doc__o = None
4840: else: doc__o = doc._o
4841: ret = libxml2mod.xmlRemoveID(doc__o, self._o)
4842: return ret
4843:
4844: def removeRef(self, doc):
4845: """Remove the given attribute from the Ref table maintained
4846: internally. """
4847: if doc is None: doc__o = None
4848: else: doc__o = doc._o
4849: ret = libxml2mod.xmlRemoveRef(doc__o, self._o)
4850: return ret
4851:
4852: class xmlAttribute(xmlNode):
4853: def __init__(self, _obj=None):
4854: if checkWrapper(_obj) != 0: raise TypeError('xmlAttribute got a wrong wrapper object type')
4855: self._o = _obj
4856: xmlNode.__init__(self, _obj=_obj)
4857:
4858: def __repr__(self):
4859: return "<xmlAttribute (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
4860:
4861: class catalog:
4862: def __init__(self, _obj=None):
4863: if _obj != None:self._o = _obj;return
4864: self._o = None
4865:
4866: def __del__(self):
4867: if self._o != None:
4868: libxml2mod.xmlFreeCatalog(self._o)
4869: self._o = None
4870:
4871: #
4872: # catalog functions from module catalog
4873: #
4874:
4875: def add(self, type, orig, replace):
4876: """Add an entry in the catalog, it may overwrite existing but
4877: different entries. """
4878: ret = libxml2mod.xmlACatalogAdd(self._o, type, orig, replace)
4879: return ret
4880:
4881: def catalogIsEmpty(self):
4882: """Check is a catalog is empty """
4883: ret = libxml2mod.xmlCatalogIsEmpty(self._o)
4884: return ret
4885:
4886: def convertSGMLCatalog(self):
4887: """Convert all the SGML catalog entries as XML ones """
4888: ret = libxml2mod.xmlConvertSGMLCatalog(self._o)
4889: return ret
4890:
4891: def dump(self, out):
4892: """Dump the given catalog to the given file. """
4893: libxml2mod.xmlACatalogDump(self._o, out)
4894:
4895: def remove(self, value):
4896: """Remove an entry from the catalog """
4897: ret = libxml2mod.xmlACatalogRemove(self._o, value)
4898: return ret
4899:
4900: def resolve(self, pubID, sysID):
4901: """Do a complete resolution lookup of an External Identifier """
4902: ret = libxml2mod.xmlACatalogResolve(self._o, pubID, sysID)
4903: return ret
4904:
4905: def resolvePublic(self, pubID):
4906: """Try to lookup the catalog local reference associated to a
4907: public ID in that catalog """
4908: ret = libxml2mod.xmlACatalogResolvePublic(self._o, pubID)
4909: return ret
4910:
4911: def resolveSystem(self, sysID):
4912: """Try to lookup the catalog resource for a system ID """
4913: ret = libxml2mod.xmlACatalogResolveSystem(self._o, sysID)
4914: return ret
4915:
4916: def resolveURI(self, URI):
4917: """Do a complete resolution lookup of an URI """
4918: ret = libxml2mod.xmlACatalogResolveURI(self._o, URI)
4919: return ret
4920:
4921: class xmlDtd(xmlNode):
4922: def __init__(self, _obj=None):
4923: if checkWrapper(_obj) != 0: raise TypeError('xmlDtd got a wrong wrapper object type')
4924: self._o = _obj
4925: xmlNode.__init__(self, _obj=_obj)
4926:
4927: def __repr__(self):
4928: return "<xmlDtd (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
4929:
4930: #
4931: # xmlDtd functions from module debugXML
4932: #
4933:
4934: def debugDumpDTD(self, output):
4935: """Dumps debug information for the DTD """
4936: libxml2mod.xmlDebugDumpDTD(output, self._o)
4937:
4938: #
4939: # xmlDtd functions from module tree
4940: #
4941:
4942: def copyDtd(self):
4943: """Do a copy of the dtd. """
4944: ret = libxml2mod.xmlCopyDtd(self._o)
4945: if ret is None:raise treeError('xmlCopyDtd() failed')
4946: __tmp = xmlDtd(_obj=ret)
4947: return __tmp
4948:
4949: def freeDtd(self):
4950: """Free a DTD structure. """
4951: libxml2mod.xmlFreeDtd(self._o)
4952:
4953: #
4954: # xmlDtd functions from module valid
4955: #
4956:
4957: def dtdAttrDesc(self, elem, name):
4958: """Search the DTD for the description of this attribute on
4959: this element. """
4960: ret = libxml2mod.xmlGetDtdAttrDesc(self._o, elem, name)
4961: if ret is None:raise treeError('xmlGetDtdAttrDesc() failed')
4962: __tmp = xmlAttribute(_obj=ret)
4963: return __tmp
4964:
4965: def dtdElementDesc(self, name):
4966: """Search the DTD for the description of this element """
4967: ret = libxml2mod.xmlGetDtdElementDesc(self._o, name)
4968: if ret is None:raise treeError('xmlGetDtdElementDesc() failed')
4969: __tmp = xmlElement(_obj=ret)
4970: return __tmp
4971:
4972: def dtdQAttrDesc(self, elem, name, prefix):
4973: """Search the DTD for the description of this qualified
4974: attribute on this element. """
4975: ret = libxml2mod.xmlGetDtdQAttrDesc(self._o, elem, name, prefix)
4976: if ret is None:raise treeError('xmlGetDtdQAttrDesc() failed')
4977: __tmp = xmlAttribute(_obj=ret)
4978: return __tmp
4979:
4980: def dtdQElementDesc(self, name, prefix):
4981: """Search the DTD for the description of this element """
4982: ret = libxml2mod.xmlGetDtdQElementDesc(self._o, name, prefix)
4983: if ret is None:raise treeError('xmlGetDtdQElementDesc() failed')
4984: __tmp = xmlElement(_obj=ret)
4985: return __tmp
4986:
4987: class xmlElement(xmlNode):
4988: def __init__(self, _obj=None):
4989: if checkWrapper(_obj) != 0: raise TypeError('xmlElement got a wrong wrapper object type')
4990: self._o = _obj
4991: xmlNode.__init__(self, _obj=_obj)
4992:
4993: def __repr__(self):
4994: return "<xmlElement (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
4995:
4996: class xmlEntity(xmlNode):
4997: def __init__(self, _obj=None):
4998: if checkWrapper(_obj) != 0: raise TypeError('xmlEntity got a wrong wrapper object type')
4999: self._o = _obj
5000: xmlNode.__init__(self, _obj=_obj)
5001:
5002: def __repr__(self):
5003: return "<xmlEntity (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
5004:
5005: #
5006: # xmlEntity functions from module parserInternals
5007: #
5008:
5009: def handleEntity(self, ctxt):
5010: """Default handling of defined entities, when should we define
5011: a new input stream ? When do we just handle that as a set
5012: of chars ? OBSOLETE: to be removed at some point. """
5013: if ctxt is None: ctxt__o = None
5014: else: ctxt__o = ctxt._o
5015: libxml2mod.xmlHandleEntity(ctxt__o, self._o)
5016:
5017: class Error:
5018: def __init__(self, _obj=None):
5019: if _obj != None:self._o = _obj;return
5020: self._o = None
5021:
5022: # accessors for Error
5023: def code(self):
5024: """The error code, e.g. an xmlParserError """
5025: ret = libxml2mod.xmlErrorGetCode(self._o)
5026: return ret
5027:
5028: def domain(self):
5029: """What part of the library raised this error """
5030: ret = libxml2mod.xmlErrorGetDomain(self._o)
5031: return ret
5032:
5033: def file(self):
5034: """the filename """
5035: ret = libxml2mod.xmlErrorGetFile(self._o)
5036: return ret
5037:
5038: def level(self):
5039: """how consequent is the error """
5040: ret = libxml2mod.xmlErrorGetLevel(self._o)
5041: return ret
5042:
5043: def line(self):
5044: """the line number if available """
5045: ret = libxml2mod.xmlErrorGetLine(self._o)
5046: return ret
5047:
5048: def message(self):
5049: """human-readable informative error message """
5050: ret = libxml2mod.xmlErrorGetMessage(self._o)
5051: return ret
5052:
5053: #
5054: # Error functions from module xmlerror
5055: #
5056:
5057: def copyError(self, to):
5058: """Save the original error to the new place. """
5059: if to is None: to__o = None
5060: else: to__o = to._o
5061: ret = libxml2mod.xmlCopyError(self._o, to__o)
5062: return ret
5063:
5064: def resetError(self):
5065: """Cleanup the error. """
5066: libxml2mod.xmlResetError(self._o)
5067:
5068: class xmlNs(xmlNode):
5069: def __init__(self, _obj=None):
5070: if checkWrapper(_obj) != 0: raise TypeError('xmlNs got a wrong wrapper object type')
5071: self._o = _obj
5072: xmlNode.__init__(self, _obj=_obj)
5073:
5074: def __repr__(self):
5075: return "<xmlNs (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
5076:
5077: #
5078: # xmlNs functions from module tree
5079: #
5080:
5081: def copyNamespace(self):
5082: """Do a copy of the namespace. """
5083: ret = libxml2mod.xmlCopyNamespace(self._o)
5084: if ret is None:raise treeError('xmlCopyNamespace() failed')
5085: __tmp = xmlNs(_obj=ret)
5086: return __tmp
5087:
5088: def copyNamespaceList(self):
5089: """Do a copy of an namespace list. """
5090: ret = libxml2mod.xmlCopyNamespaceList(self._o)
5091: if ret is None:raise treeError('xmlCopyNamespaceList() failed')
5092: __tmp = xmlNs(_obj=ret)
5093: return __tmp
5094:
5095: def freeNs(self):
5096: """Free up the structures associated to a namespace """
5097: libxml2mod.xmlFreeNs(self._o)
5098:
5099: def freeNsList(self):
5100: """Free up all the structures associated to the chained
5101: namespaces. """
5102: libxml2mod.xmlFreeNsList(self._o)
5103:
5104: def newChild(self, parent, name, content):
5105: """Creation of a new child element, added at the end of
5106: @parent children list. @ns and @content parameters are
5107: optional (None). If @ns is None, the newly created element
5108: inherits the namespace of @parent. If @content is non None,
5109: a child list containing the TEXTs and ENTITY_REFs node will
5110: be created. NOTE: @content is supposed to be a piece of XML
5111: CDATA, so it allows entity references. XML special chars
5112: must be escaped first by using
5113: xmlEncodeEntitiesReentrant(), or xmlNewTextChild() should
5114: be used. """
5115: if parent is None: parent__o = None
5116: else: parent__o = parent._o
5117: ret = libxml2mod.xmlNewChild(parent__o, self._o, name, content)
5118: if ret is None:raise treeError('xmlNewChild() failed')
5119: __tmp = xmlNode(_obj=ret)
5120: return __tmp
5121:
5122: def newDocNode(self, doc, name, content):
5123: """Creation of a new node element within a document. @ns and
5124: @content are optional (None). NOTE: @content is supposed to
5125: be a piece of XML CDATA, so it allow entities references,
5126: but XML special chars need to be escaped first by using
5127: xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
5128: don't need entities support. """
5129: if doc is None: doc__o = None
5130: else: doc__o = doc._o
5131: ret = libxml2mod.xmlNewDocNode(doc__o, self._o, name, content)
5132: if ret is None:raise treeError('xmlNewDocNode() failed')
5133: __tmp = xmlNode(_obj=ret)
5134: return __tmp
5135:
5136: def newDocNodeEatName(self, doc, name, content):
5137: """Creation of a new node element within a document. @ns and
5138: @content are optional (None). NOTE: @content is supposed to
5139: be a piece of XML CDATA, so it allow entities references,
5140: but XML special chars need to be escaped first by using
5141: xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
5142: don't need entities support. """
5143: if doc is None: doc__o = None
5144: else: doc__o = doc._o
5145: ret = libxml2mod.xmlNewDocNodeEatName(doc__o, self._o, name, content)
5146: if ret is None:raise treeError('xmlNewDocNodeEatName() failed')
5147: __tmp = xmlNode(_obj=ret)
5148: return __tmp
5149:
5150: def newDocRawNode(self, doc, name, content):
5151: """Creation of a new node element within a document. @ns and
5152: @content are optional (None). """
5153: if doc is None: doc__o = None
5154: else: doc__o = doc._o
5155: ret = libxml2mod.xmlNewDocRawNode(doc__o, self._o, name, content)
5156: if ret is None:raise treeError('xmlNewDocRawNode() failed')
5157: __tmp = xmlNode(_obj=ret)
5158: return __tmp
5159:
5160: def newNodeEatName(self, name):
5161: """Creation of a new node element. @ns is optional (None). """
5162: ret = libxml2mod.xmlNewNodeEatName(self._o, name)
5163: if ret is None:raise treeError('xmlNewNodeEatName() failed')
5164: __tmp = xmlNode(_obj=ret)
5165: return __tmp
5166:
5167: def newNsProp(self, node, name, value):
5168: """Create a new property tagged with a namespace and carried
5169: by a node. """
5170: if node is None: node__o = None
5171: else: node__o = node._o
5172: ret = libxml2mod.xmlNewNsProp(node__o, self._o, name, value)
5173: if ret is None:raise treeError('xmlNewNsProp() failed')
5174: __tmp = xmlAttr(_obj=ret)
5175: return __tmp
5176:
5177: def newNsPropEatName(self, node, name, value):
5178: """Create a new property tagged with a namespace and carried
5179: by a node. """
5180: if node is None: node__o = None
5181: else: node__o = node._o
5182: ret = libxml2mod.xmlNewNsPropEatName(node__o, self._o, name, value)
5183: if ret is None:raise treeError('xmlNewNsPropEatName() failed')
5184: __tmp = xmlAttr(_obj=ret)
5185: return __tmp
5186:
5187: def newTextChild(self, parent, name, content):
5188: """Creation of a new child element, added at the end of
5189: @parent children list. @ns and @content parameters are
5190: optional (None). If @ns is None, the newly created element
5191: inherits the namespace of @parent. If @content is non None,
5192: a child TEXT node will be created containing the string
5193: @content. NOTE: Use xmlNewChild() if @content will contain
5194: entities that need to be preserved. Use this function,
5195: xmlNewTextChild(), if you need to ensure that reserved XML
5196: chars that might appear in @content, such as the ampersand,
5197: greater-than or less-than signs, are automatically replaced
5198: by their XML escaped entity representations. """
5199: if parent is None: parent__o = None
5200: else: parent__o = parent._o
5201: ret = libxml2mod.xmlNewTextChild(parent__o, self._o, name, content)
5202: if ret is None:raise treeError('xmlNewTextChild() failed')
5203: __tmp = xmlNode(_obj=ret)
5204: return __tmp
5205:
5206: def setNs(self, node):
5207: """Associate a namespace to a node, a posteriori. """
5208: if node is None: node__o = None
5209: else: node__o = node._o
5210: libxml2mod.xmlSetNs(node__o, self._o)
5211:
5212: def setNsProp(self, node, name, value):
5213: """Set (or reset) an attribute carried by a node. The ns
5214: structure must be in scope, this is not checked """
5215: if node is None: node__o = None
5216: else: node__o = node._o
5217: ret = libxml2mod.xmlSetNsProp(node__o, self._o, name, value)
5218: if ret is None:raise treeError('xmlSetNsProp() failed')
5219: __tmp = xmlAttr(_obj=ret)
5220: return __tmp
5221:
5222: def unsetNsProp(self, node, name):
5223: """Remove an attribute carried by a node. """
5224: if node is None: node__o = None
5225: else: node__o = node._o
5226: ret = libxml2mod.xmlUnsetNsProp(node__o, self._o, name)
5227: return ret
5228:
5229: #
5230: # xmlNs functions from module xpathInternals
5231: #
5232:
5233: def xpathNodeSetFreeNs(self):
5234: """Namespace nodes in libxml don't match the XPath semantic.
5235: In a node set the namespace nodes are duplicated and the
5236: next pointer is set to the parent node in the XPath
5237: semantic. Check if such a node needs to be freed """
5238: libxml2mod.xmlXPathNodeSetFreeNs(self._o)
5239:
5240: class outputBuffer(ioWriteWrapper):
5241: def __init__(self, _obj=None):
5242: self._o = _obj
5243: ioWriteWrapper.__init__(self, _obj=_obj)
5244:
5245: #
5246: # outputBuffer functions from module HTMLtree
5247: #
5248:
5249: def htmlDocContentDumpFormatOutput(self, cur, encoding, format):
5250: """Dump an HTML document. """
5251: if cur is None: cur__o = None
5252: else: cur__o = cur._o
5253: libxml2mod.htmlDocContentDumpFormatOutput(self._o, cur__o, encoding, format)
5254:
5255: def htmlDocContentDumpOutput(self, cur, encoding):
5256: """Dump an HTML document. Formating return/spaces are added. """
5257: if cur is None: cur__o = None
5258: else: cur__o = cur._o
5259: libxml2mod.htmlDocContentDumpOutput(self._o, cur__o, encoding)
5260:
5261: def htmlNodeDumpFormatOutput(self, doc, cur, encoding, format):
5262: """Dump an HTML node, recursive behaviour,children are printed
5263: too. """
5264: if doc is None: doc__o = None
5265: else: doc__o = doc._o
5266: if cur is None: cur__o = None
5267: else: cur__o = cur._o
5268: libxml2mod.htmlNodeDumpFormatOutput(self._o, doc__o, cur__o, encoding, format)
5269:
5270: def htmlNodeDumpOutput(self, doc, cur, encoding):
5271: """Dump an HTML node, recursive behaviour,children are printed
5272: too, and formatting returns/spaces are added. """
5273: if doc is None: doc__o = None
5274: else: doc__o = doc._o
5275: if cur is None: cur__o = None
5276: else: cur__o = cur._o
5277: libxml2mod.htmlNodeDumpOutput(self._o, doc__o, cur__o, encoding)
5278:
5279: #
5280: # outputBuffer functions from module tree
5281: #
5282:
5283: def nodeDumpOutput(self, doc, cur, level, format, encoding):
5284: """Dump an XML node, recursive behaviour, children are printed
5285: too. Note that @format = 1 provide node indenting only if
5286: xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was
5287: called """
5288: if doc is None: doc__o = None
5289: else: doc__o = doc._o
5290: if cur is None: cur__o = None
5291: else: cur__o = cur._o
5292: libxml2mod.xmlNodeDumpOutput(self._o, doc__o, cur__o, level, format, encoding)
5293:
5294: def saveFileTo(self, cur, encoding):
5295: """Dump an XML document to an I/O buffer. Warning ! This call
5296: xmlOutputBufferClose() on buf which is not available after
5297: this call. """
5298: if cur is None: cur__o = None
5299: else: cur__o = cur._o
5300: ret = libxml2mod.xmlSaveFileTo(self._o, cur__o, encoding)
5301: return ret
5302:
5303: def saveFormatFileTo(self, cur, encoding, format):
5304: """Dump an XML document to an I/O buffer. Warning ! This call
5305: xmlOutputBufferClose() on buf which is not available after
5306: this call. """
5307: if cur is None: cur__o = None
5308: else: cur__o = cur._o
5309: ret = libxml2mod.xmlSaveFormatFileTo(self._o, cur__o, encoding, format)
5310: return ret
5311:
5312: #
5313: # outputBuffer functions from module xmlIO
5314: #
5315:
5316: def getContent(self):
5317: """Gives a pointer to the data currently held in the output
5318: buffer """
5319: ret = libxml2mod.xmlOutputBufferGetContent(self._o)
5320: return ret
5321:
5322: def write(self, len, buf):
5323: """Write the content of the array in the output I/O buffer
5324: This routine handle the I18N transcoding from internal
5325: UTF-8 The buffer is lossless, i.e. will store in case of
5326: partial or delayed writes. """
5327: ret = libxml2mod.xmlOutputBufferWrite(self._o, len, buf)
5328: return ret
5329:
5330: def writeString(self, str):
5331: """Write the content of the string in the output I/O buffer
5332: This routine handle the I18N transcoding from internal
5333: UTF-8 The buffer is lossless, i.e. will store in case of
5334: partial or delayed writes. """
5335: ret = libxml2mod.xmlOutputBufferWriteString(self._o, str)
5336: return ret
5337:
5338: class inputBuffer(ioReadWrapper):
5339: def __init__(self, _obj=None):
5340: self._o = _obj
5341: ioReadWrapper.__init__(self, _obj=_obj)
5342:
5343: def __del__(self):
5344: if self._o != None:
5345: libxml2mod.xmlFreeParserInputBuffer(self._o)
5346: self._o = None
5347:
5348: #
5349: # inputBuffer functions from module xmlIO
5350: #
5351:
5352: def grow(self, len):
5353: """Grow up the content of the input buffer, the old data are
5354: preserved This routine handle the I18N transcoding to
5355: internal UTF-8 This routine is used when operating the
5356: parser in normal (pull) mode TODO: one should be able to
5357: remove one extra copy by copying directly onto in->buffer
5358: or in->raw """
5359: ret = libxml2mod.xmlParserInputBufferGrow(self._o, len)
5360: return ret
5361:
5362: def push(self, len, buf):
5363: """Push the content of the arry in the input buffer This
5364: routine handle the I18N transcoding to internal UTF-8 This
5365: is used when operating the parser in progressive (push)
5366: mode. """
5367: ret = libxml2mod.xmlParserInputBufferPush(self._o, len, buf)
5368: return ret
5369:
5370: def read(self, len):
5371: """Refresh the content of the input buffer, the old data are
5372: considered consumed This routine handle the I18N
5373: transcoding to internal UTF-8 """
5374: ret = libxml2mod.xmlParserInputBufferRead(self._o, len)
5375: return ret
5376:
5377: #
5378: # inputBuffer functions from module xmlreader
5379: #
5380:
5381: def Setup(self, reader, URL, encoding, options):
5382: """Setup an XML reader with new options """
5383: if reader is None: reader__o = None
5384: else: reader__o = reader._o
5385: ret = libxml2mod.xmlTextReaderSetup(reader__o, self._o, URL, encoding, options)
5386: return ret
5387:
5388: def newTextReader(self, URI):
5389: """Create an xmlTextReader structure fed with @input """
5390: ret = libxml2mod.xmlNewTextReader(self._o, URI)
5391: if ret is None:raise treeError('xmlNewTextReader() failed')
5392: __tmp = xmlTextReader(_obj=ret)
5393: __tmp.input = self
5394: return __tmp
5395:
5396: class xmlReg:
5397: def __init__(self, _obj=None):
5398: if _obj != None:self._o = _obj;return
5399: self._o = None
5400:
5401: def __del__(self):
5402: if self._o != None:
5403: libxml2mod.xmlRegFreeRegexp(self._o)
5404: self._o = None
5405:
5406: #
5407: # xmlReg functions from module xmlregexp
5408: #
5409:
5410: def regexpExec(self, content):
5411: """Check if the regular expression generates the value """
5412: ret = libxml2mod.xmlRegexpExec(self._o, content)
5413: return ret
5414:
5415: def regexpIsDeterminist(self):
5416: """Check if the regular expression is determinist """
5417: ret = libxml2mod.xmlRegexpIsDeterminist(self._o)
5418: return ret
5419:
5420: def regexpPrint(self, output):
5421: """Print the content of the compiled regular expression """
5422: libxml2mod.xmlRegexpPrint(output, self._o)
5423:
5424: class relaxNgParserCtxt:
5425: def __init__(self, _obj=None):
5426: if _obj != None:self._o = _obj;return
5427: self._o = None
5428:
5429: def __del__(self):
5430: if self._o != None:
5431: libxml2mod.xmlRelaxNGFreeParserCtxt(self._o)
5432: self._o = None
5433:
5434: #
5435: # relaxNgParserCtxt functions from module relaxng
5436: #
5437:
5438: def relaxNGParse(self):
5439: """parse a schema definition resource and build an internal
5440: XML Shema struture which can be used to validate instances. """
5441: ret = libxml2mod.xmlRelaxNGParse(self._o)
5442: if ret is None:raise parserError('xmlRelaxNGParse() failed')
5443: __tmp = relaxNgSchema(_obj=ret)
5444: return __tmp
5445:
5446: def relaxParserSetFlag(self, flags):
5447: """Semi private function used to pass informations to a parser
5448: context which are a combination of xmlRelaxNGParserFlag . """
5449: ret = libxml2mod.xmlRelaxParserSetFlag(self._o, flags)
5450: return ret
5451:
5452: class relaxNgSchema:
5453: def __init__(self, _obj=None):
5454: if _obj != None:self._o = _obj;return
5455: self._o = None
5456:
5457: def __del__(self):
5458: if self._o != None:
5459: libxml2mod.xmlRelaxNGFree(self._o)
5460: self._o = None
5461:
5462: #
5463: # relaxNgSchema functions from module relaxng
5464: #
5465:
5466: def relaxNGDump(self, output):
5467: """Dump a RelaxNG structure back """
5468: libxml2mod.xmlRelaxNGDump(output, self._o)
5469:
5470: def relaxNGDumpTree(self, output):
5471: """Dump the transformed RelaxNG tree. """
5472: libxml2mod.xmlRelaxNGDumpTree(output, self._o)
5473:
5474: def relaxNGNewValidCtxt(self):
5475: """Create an XML RelaxNGs validation context based on the
5476: given schema """
5477: ret = libxml2mod.xmlRelaxNGNewValidCtxt(self._o)
5478: if ret is None:raise treeError('xmlRelaxNGNewValidCtxt() failed')
5479: __tmp = relaxNgValidCtxt(_obj=ret)
5480: __tmp.schema = self
5481: return __tmp
5482:
5483: #
5484: # relaxNgSchema functions from module xmlreader
5485: #
5486:
5487: def RelaxNGSetSchema(self, reader):
5488: """Use RelaxNG to validate the document as it is processed.
5489: Activation is only possible before the first Read(). if
5490: @schema is None, then RelaxNG validation is desactivated. @
5491: The @schema should not be freed until the reader is
5492: deallocated or its use has been deactivated. """
5493: if reader is None: reader__o = None
5494: else: reader__o = reader._o
5495: ret = libxml2mod.xmlTextReaderRelaxNGSetSchema(reader__o, self._o)
5496: return ret
5497:
5498: class relaxNgValidCtxt(relaxNgValidCtxtCore):
5499: def __init__(self, _obj=None):
5500: self.schema = None
5501: self._o = _obj
5502: relaxNgValidCtxtCore.__init__(self, _obj=_obj)
5503:
5504: def __del__(self):
5505: if self._o != None:
5506: libxml2mod.xmlRelaxNGFreeValidCtxt(self._o)
5507: self._o = None
5508:
5509: #
5510: # relaxNgValidCtxt functions from module relaxng
5511: #
5512:
5513: def relaxNGValidateDoc(self, doc):
5514: """Validate a document tree in memory. """
5515: if doc is None: doc__o = None
5516: else: doc__o = doc._o
5517: ret = libxml2mod.xmlRelaxNGValidateDoc(self._o, doc__o)
5518: return ret
5519:
5520: def relaxNGValidateFullElement(self, doc, elem):
5521: """Validate a full subtree when
5522: xmlRelaxNGValidatePushElement() returned 0 and the content
5523: of the node has been expanded. """
5524: if doc is None: doc__o = None
5525: else: doc__o = doc._o
5526: if elem is None: elem__o = None
5527: else: elem__o = elem._o
5528: ret = libxml2mod.xmlRelaxNGValidateFullElement(self._o, doc__o, elem__o)
5529: return ret
5530:
5531: def relaxNGValidatePopElement(self, doc, elem):
5532: """Pop the element end from the RelaxNG validation stack. """
5533: if doc is None: doc__o = None
5534: else: doc__o = doc._o
5535: if elem is None: elem__o = None
5536: else: elem__o = elem._o
5537: ret = libxml2mod.xmlRelaxNGValidatePopElement(self._o, doc__o, elem__o)
5538: return ret
5539:
5540: def relaxNGValidatePushCData(self, data, len):
5541: """check the CData parsed for validation in the current stack """
5542: ret = libxml2mod.xmlRelaxNGValidatePushCData(self._o, data, len)
5543: return ret
5544:
5545: def relaxNGValidatePushElement(self, doc, elem):
5546: """Push a new element start on the RelaxNG validation stack. """
5547: if doc is None: doc__o = None
5548: else: doc__o = doc._o
5549: if elem is None: elem__o = None
5550: else: elem__o = elem._o
5551: ret = libxml2mod.xmlRelaxNGValidatePushElement(self._o, doc__o, elem__o)
5552: return ret
5553:
5554: #
5555: # relaxNgValidCtxt functions from module xmlreader
5556: #
5557:
5558: def RelaxNGValidateCtxt(self, reader, options):
5559: """Use RelaxNG schema context to validate the document as it
5560: is processed. Activation is only possible before the first
5561: Read(). If @ctxt is None, then RelaxNG schema validation is
5562: deactivated. """
5563: if reader is None: reader__o = None
5564: else: reader__o = reader._o
5565: ret = libxml2mod.xmlTextReaderRelaxNGValidateCtxt(reader__o, self._o, options)
5566: return ret
5567:
5568: class SchemaParserCtxt:
5569: def __init__(self, _obj=None):
5570: if _obj != None:self._o = _obj;return
5571: self._o = None
5572:
5573: def __del__(self):
5574: if self._o != None:
5575: libxml2mod.xmlSchemaFreeParserCtxt(self._o)
5576: self._o = None
5577:
5578: #
5579: # SchemaParserCtxt functions from module xmlschemas
5580: #
5581:
5582: def schemaParse(self):
5583: """parse a schema definition resource and build an internal
5584: XML Shema struture which can be used to validate instances. """
5585: ret = libxml2mod.xmlSchemaParse(self._o)
5586: if ret is None:raise parserError('xmlSchemaParse() failed')
5587: __tmp = Schema(_obj=ret)
5588: return __tmp
5589:
5590: class Schema:
5591: def __init__(self, _obj=None):
5592: if _obj != None:self._o = _obj;return
5593: self._o = None
5594:
5595: def __del__(self):
5596: if self._o != None:
5597: libxml2mod.xmlSchemaFree(self._o)
5598: self._o = None
5599:
5600: #
5601: # Schema functions from module xmlreader
5602: #
5603:
5604: def SetSchema(self, reader):
5605: """Use XSD Schema to validate the document as it is processed.
5606: Activation is only possible before the first Read(). if
5607: @schema is None, then Schema validation is desactivated. @
5608: The @schema should not be freed until the reader is
5609: deallocated or its use has been deactivated. """
5610: if reader is None: reader__o = None
5611: else: reader__o = reader._o
5612: ret = libxml2mod.xmlTextReaderSetSchema(reader__o, self._o)
5613: return ret
5614:
5615: #
5616: # Schema functions from module xmlschemas
5617: #
5618:
5619: def schemaDump(self, output):
5620: """Dump a Schema structure. """
5621: libxml2mod.xmlSchemaDump(output, self._o)
5622:
5623: def schemaNewValidCtxt(self):
5624: """Create an XML Schemas validation context based on the given
5625: schema. """
5626: ret = libxml2mod.xmlSchemaNewValidCtxt(self._o)
5627: if ret is None:raise treeError('xmlSchemaNewValidCtxt() failed')
5628: __tmp = SchemaValidCtxt(_obj=ret)
5629: __tmp.schema = self
5630: return __tmp
5631:
5632: class SchemaValidCtxt(SchemaValidCtxtCore):
5633: def __init__(self, _obj=None):
5634: self.schema = None
5635: self._o = _obj
5636: SchemaValidCtxtCore.__init__(self, _obj=_obj)
5637:
5638: def __del__(self):
5639: if self._o != None:
5640: libxml2mod.xmlSchemaFreeValidCtxt(self._o)
5641: self._o = None
5642:
5643: #
5644: # SchemaValidCtxt functions from module xmlreader
5645: #
5646:
5647: def SchemaValidateCtxt(self, reader, options):
5648: """Use W3C XSD schema context to validate the document as it
5649: is processed. Activation is only possible before the first
5650: Read(). If @ctxt is None, then XML Schema validation is
5651: deactivated. """
5652: if reader is None: reader__o = None
5653: else: reader__o = reader._o
5654: ret = libxml2mod.xmlTextReaderSchemaValidateCtxt(reader__o, self._o, options)
5655: return ret
5656:
5657: #
5658: # SchemaValidCtxt functions from module xmlschemas
5659: #
5660:
5661: def schemaIsValid(self):
5662: """Check if any error was detected during validation. """
5663: ret = libxml2mod.xmlSchemaIsValid(self._o)
5664: return ret
5665:
5666: def schemaSetValidOptions(self, options):
5667: """Sets the options to be used during the validation. """
5668: ret = libxml2mod.xmlSchemaSetValidOptions(self._o, options)
5669: return ret
5670:
5671: def schemaValidCtxtGetOptions(self):
5672: """Get the validation context options. """
5673: ret = libxml2mod.xmlSchemaValidCtxtGetOptions(self._o)
5674: return ret
5675:
5676: def schemaValidCtxtGetParserCtxt(self):
5677: """allow access to the parser context of the schema validation
5678: context """
5679: ret = libxml2mod.xmlSchemaValidCtxtGetParserCtxt(self._o)
5680: if ret is None:raise parserError('xmlSchemaValidCtxtGetParserCtxt() failed')
5681: __tmp = parserCtxt(_obj=ret)
5682: return __tmp
5683:
5684: def schemaValidateDoc(self, doc):
5685: """Validate a document tree in memory. """
5686: if doc is None: doc__o = None
5687: else: doc__o = doc._o
5688: ret = libxml2mod.xmlSchemaValidateDoc(self._o, doc__o)
5689: return ret
5690:
5691: def schemaValidateFile(self, filename, options):
5692: """Do a schemas validation of the given resource, it will use
5693: the SAX streamable validation internally. """
5694: ret = libxml2mod.xmlSchemaValidateFile(self._o, filename, options)
5695: return ret
5696:
5697: def schemaValidateOneElement(self, elem):
5698: """Validate a branch of a tree, starting with the given @elem. """
5699: if elem is None: elem__o = None
5700: else: elem__o = elem._o
5701: ret = libxml2mod.xmlSchemaValidateOneElement(self._o, elem__o)
5702: return ret
5703:
5704: def schemaValidateSetFilename(self, filename):
5705: """Workaround to provide file error reporting information when
5706: this is not provided by current APIs """
5707: libxml2mod.xmlSchemaValidateSetFilename(self._o, filename)
5708:
5709: class xmlTextReaderLocator:
5710: def __init__(self, _obj=None):
5711: if _obj != None:self._o = _obj;return
5712: self._o = None
5713:
5714: #
5715: # xmlTextReaderLocator functions from module xmlreader
5716: #
5717:
5718: def BaseURI(self):
5719: """Obtain the base URI for the given locator. """
5720: ret = libxml2mod.xmlTextReaderLocatorBaseURI(self._o)
5721: return ret
5722:
5723: def LineNumber(self):
5724: """Obtain the line number for the given locator. """
5725: ret = libxml2mod.xmlTextReaderLocatorLineNumber(self._o)
5726: return ret
5727:
5728: class xmlTextReader(xmlTextReaderCore):
5729: def __init__(self, _obj=None):
5730: self.input = None
5731: self._o = _obj
5732: xmlTextReaderCore.__init__(self, _obj=_obj)
5733:
5734: def __del__(self):
5735: if self._o != None:
5736: libxml2mod.xmlFreeTextReader(self._o)
5737: self._o = None
5738:
5739: #
5740: # xmlTextReader functions from module xmlreader
5741: #
5742:
5743: def AttributeCount(self):
5744: """Provides the number of attributes of the current node """
5745: ret = libxml2mod.xmlTextReaderAttributeCount(self._o)
5746: return ret
5747:
5748: def BaseUri(self):
5749: """The base URI of the node. """
5750: ret = libxml2mod.xmlTextReaderConstBaseUri(self._o)
5751: return ret
5752:
5753: def ByteConsumed(self):
5754: """This function provides the current index of the parser used
5755: by the reader, relative to the start of the current entity.
5756: This function actually just wraps a call to
5757: xmlBytesConsumed() for the parser context associated with
5758: the reader. See xmlBytesConsumed() for more information. """
5759: ret = libxml2mod.xmlTextReaderByteConsumed(self._o)
5760: return ret
5761:
5762: def Close(self):
5763: """This method releases any resources allocated by the current
5764: instance changes the state to Closed and close any
5765: underlying input. """
5766: ret = libxml2mod.xmlTextReaderClose(self._o)
5767: return ret
5768:
5769: def CurrentDoc(self):
5770: """Hacking interface allowing to get the xmlDocPtr
5771: correponding to the current document being accessed by the
5772: xmlTextReader. NOTE: as a result of this call, the reader
5773: will not destroy the associated XML document and calling
5774: xmlFreeDoc() on the result is needed once the reader
5775: parsing has finished. """
5776: ret = libxml2mod.xmlTextReaderCurrentDoc(self._o)
5777: if ret is None:raise treeError('xmlTextReaderCurrentDoc() failed')
5778: __tmp = xmlDoc(_obj=ret)
5779: return __tmp
5780:
5781: def CurrentNode(self):
5782: """Hacking interface allowing to get the xmlNodePtr
5783: correponding to the current node being accessed by the
5784: xmlTextReader. This is dangerous because the underlying
5785: node may be destroyed on the next Reads. """
5786: ret = libxml2mod.xmlTextReaderCurrentNode(self._o)
5787: if ret is None:raise treeError('xmlTextReaderCurrentNode() failed')
5788: __tmp = xmlNode(_obj=ret)
5789: return __tmp
5790:
5791: def Depth(self):
5792: """The depth of the node in the tree. """
5793: ret = libxml2mod.xmlTextReaderDepth(self._o)
5794: return ret
5795:
5796: def Encoding(self):
5797: """Determine the encoding of the document being read. """
5798: ret = libxml2mod.xmlTextReaderConstEncoding(self._o)
5799: return ret
5800:
5801: def Expand(self):
5802: """Reads the contents of the current node and the full
5803: subtree. It then makes the subtree available until the next
5804: xmlTextReaderRead() call """
5805: ret = libxml2mod.xmlTextReaderExpand(self._o)
5806: if ret is None:raise treeError('xmlTextReaderExpand() failed')
5807: __tmp = xmlNode(_obj=ret)
5808: return __tmp
5809:
5810: def GetAttribute(self, name):
5811: """Provides the value of the attribute with the specified
5812: qualified name. """
5813: ret = libxml2mod.xmlTextReaderGetAttribute(self._o, name)
5814: return ret
5815:
5816: def GetAttributeNo(self, no):
5817: """Provides the value of the attribute with the specified
5818: index relative to the containing element. """
5819: ret = libxml2mod.xmlTextReaderGetAttributeNo(self._o, no)
5820: return ret
5821:
5822: def GetAttributeNs(self, localName, namespaceURI):
5823: """Provides the value of the specified attribute """
5824: ret = libxml2mod.xmlTextReaderGetAttributeNs(self._o, localName, namespaceURI)
5825: return ret
5826:
5827: def GetParserColumnNumber(self):
5828: """Provide the column number of the current parsing point. """
5829: ret = libxml2mod.xmlTextReaderGetParserColumnNumber(self._o)
5830: return ret
5831:
5832: def GetParserLineNumber(self):
5833: """Provide the line number of the current parsing point. """
5834: ret = libxml2mod.xmlTextReaderGetParserLineNumber(self._o)
5835: return ret
5836:
5837: def GetParserProp(self, prop):
5838: """Read the parser internal property. """
5839: ret = libxml2mod.xmlTextReaderGetParserProp(self._o, prop)
5840: return ret
5841:
5842: def GetRemainder(self):
5843: """Method to get the remainder of the buffered XML. this
5844: method stops the parser, set its state to End Of File and
5845: return the input stream with what is left that the parser
5846: did not use. The implementation is not good, the parser
5847: certainly procgressed past what's left in reader->input,
5848: and there is an allocation problem. Best would be to
5849: rewrite it differently. """
5850: ret = libxml2mod.xmlTextReaderGetRemainder(self._o)
5851: if ret is None:raise treeError('xmlTextReaderGetRemainder() failed')
5852: __tmp = inputBuffer(_obj=ret)
5853: return __tmp
5854:
5855: def HasAttributes(self):
5856: """Whether the node has attributes. """
5857: ret = libxml2mod.xmlTextReaderHasAttributes(self._o)
5858: return ret
5859:
5860: def HasValue(self):
5861: """Whether the node can have a text value. """
5862: ret = libxml2mod.xmlTextReaderHasValue(self._o)
5863: return ret
5864:
5865: def IsDefault(self):
5866: """Whether an Attribute node was generated from the default
5867: value defined in the DTD or schema. """
5868: ret = libxml2mod.xmlTextReaderIsDefault(self._o)
5869: return ret
5870:
5871: def IsEmptyElement(self):
5872: """Check if the current node is empty """
5873: ret = libxml2mod.xmlTextReaderIsEmptyElement(self._o)
5874: return ret
5875:
5876: def IsNamespaceDecl(self):
5877: """Determine whether the current node is a namespace
5878: declaration rather than a regular attribute. """
5879: ret = libxml2mod.xmlTextReaderIsNamespaceDecl(self._o)
5880: return ret
5881:
5882: def IsValid(self):
5883: """Retrieve the validity status from the parser context """
5884: ret = libxml2mod.xmlTextReaderIsValid(self._o)
5885: return ret
5886:
5887: def LocalName(self):
5888: """The local name of the node. """
5889: ret = libxml2mod.xmlTextReaderConstLocalName(self._o)
5890: return ret
5891:
5892: def LookupNamespace(self, prefix):
5893: """Resolves a namespace prefix in the scope of the current
5894: element. """
5895: ret = libxml2mod.xmlTextReaderLookupNamespace(self._o, prefix)
5896: return ret
5897:
5898: def MoveToAttribute(self, name):
5899: """Moves the position of the current instance to the attribute
5900: with the specified qualified name. """
5901: ret = libxml2mod.xmlTextReaderMoveToAttribute(self._o, name)
5902: return ret
5903:
5904: def MoveToAttributeNo(self, no):
5905: """Moves the position of the current instance to the attribute
5906: with the specified index relative to the containing element. """
5907: ret = libxml2mod.xmlTextReaderMoveToAttributeNo(self._o, no)
5908: return ret
5909:
5910: def MoveToAttributeNs(self, localName, namespaceURI):
5911: """Moves the position of the current instance to the attribute
5912: with the specified local name and namespace URI. """
5913: ret = libxml2mod.xmlTextReaderMoveToAttributeNs(self._o, localName, namespaceURI)
5914: return ret
5915:
5916: def MoveToElement(self):
5917: """Moves the position of the current instance to the node that
5918: contains the current Attribute node. """
5919: ret = libxml2mod.xmlTextReaderMoveToElement(self._o)
5920: return ret
5921:
5922: def MoveToFirstAttribute(self):
5923: """Moves the position of the current instance to the first
5924: attribute associated with the current node. """
5925: ret = libxml2mod.xmlTextReaderMoveToFirstAttribute(self._o)
5926: return ret
5927:
5928: def MoveToNextAttribute(self):
5929: """Moves the position of the current instance to the next
5930: attribute associated with the current node. """
5931: ret = libxml2mod.xmlTextReaderMoveToNextAttribute(self._o)
5932: return ret
5933:
5934: def Name(self):
5935: """The qualified name of the node, equal to Prefix :LocalName. """
5936: ret = libxml2mod.xmlTextReaderConstName(self._o)
5937: return ret
5938:
5939: def NamespaceUri(self):
5940: """The URI defining the namespace associated with the node. """
5941: ret = libxml2mod.xmlTextReaderConstNamespaceUri(self._o)
5942: return ret
5943:
5944: def NewDoc(self, cur, URL, encoding, options):
5945: """Setup an xmltextReader to parse an XML in-memory document.
5946: The parsing flags @options are a combination of
5947: xmlParserOption. This reuses the existing @reader
5948: xmlTextReader. """
5949: ret = libxml2mod.xmlReaderNewDoc(self._o, cur, URL, encoding, options)
5950: return ret
5951:
5952: def NewFd(self, fd, URL, encoding, options):
5953: """Setup an xmltextReader to parse an XML from a file
5954: descriptor. NOTE that the file descriptor will not be
5955: closed when the reader is closed or reset. The parsing
5956: flags @options are a combination of xmlParserOption. This
5957: reuses the existing @reader xmlTextReader. """
5958: ret = libxml2mod.xmlReaderNewFd(self._o, fd, URL, encoding, options)
5959: return ret
5960:
5961: def NewFile(self, filename, encoding, options):
5962: """parse an XML file from the filesystem or the network. The
5963: parsing flags @options are a combination of
5964: xmlParserOption. This reuses the existing @reader
5965: xmlTextReader. """
5966: ret = libxml2mod.xmlReaderNewFile(self._o, filename, encoding, options)
5967: return ret
5968:
5969: def NewMemory(self, buffer, size, URL, encoding, options):
5970: """Setup an xmltextReader to parse an XML in-memory document.
5971: The parsing flags @options are a combination of
5972: xmlParserOption. This reuses the existing @reader
5973: xmlTextReader. """
5974: ret = libxml2mod.xmlReaderNewMemory(self._o, buffer, size, URL, encoding, options)
5975: return ret
5976:
5977: def NewWalker(self, doc):
5978: """Setup an xmltextReader to parse a preparsed XML document.
5979: This reuses the existing @reader xmlTextReader. """
5980: if doc is None: doc__o = None
5981: else: doc__o = doc._o
5982: ret = libxml2mod.xmlReaderNewWalker(self._o, doc__o)
5983: return ret
5984:
5985: def Next(self):
5986: """Skip to the node following the current one in document
5987: order while avoiding the subtree if any. """
5988: ret = libxml2mod.xmlTextReaderNext(self._o)
5989: return ret
5990:
5991: def NextSibling(self):
5992: """Skip to the node following the current one in document
5993: order while avoiding the subtree if any. Currently
5994: implemented only for Readers built on a document """
5995: ret = libxml2mod.xmlTextReaderNextSibling(self._o)
5996: return ret
5997:
5998: def NodeType(self):
5999: """Get the node type of the current node Reference:
6000: http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/Xm
6001: lNodeType.html """
6002: ret = libxml2mod.xmlTextReaderNodeType(self._o)
6003: return ret
6004:
6005: def Normalization(self):
6006: """The value indicating whether to normalize white space and
6007: attribute values. Since attribute value and end of line
6008: normalizations are a MUST in the XML specification only the
6009: value true is accepted. The broken bahaviour of accepting
6010: out of range character entities like � is of course not
6011: supported either. """
6012: ret = libxml2mod.xmlTextReaderNormalization(self._o)
6013: return ret
6014:
6015: def Prefix(self):
6016: """A shorthand reference to the namespace associated with the
6017: node. """
6018: ret = libxml2mod.xmlTextReaderConstPrefix(self._o)
6019: return ret
6020:
6021: def Preserve(self):
6022: """This tells the XML Reader to preserve the current node. The
6023: caller must also use xmlTextReaderCurrentDoc() to keep an
6024: handle on the resulting document once parsing has finished """
6025: ret = libxml2mod.xmlTextReaderPreserve(self._o)
6026: if ret is None:raise treeError('xmlTextReaderPreserve() failed')
6027: __tmp = xmlNode(_obj=ret)
6028: return __tmp
6029:
6030: def QuoteChar(self):
6031: """The quotation mark character used to enclose the value of
6032: an attribute. """
6033: ret = libxml2mod.xmlTextReaderQuoteChar(self._o)
6034: return ret
6035:
6036: def Read(self):
6037: """Moves the position of the current instance to the next node
6038: in the stream, exposing its properties. """
6039: ret = libxml2mod.xmlTextReaderRead(self._o)
6040: return ret
6041:
6042: def ReadAttributeValue(self):
6043: """Parses an attribute value into one or more Text and
6044: EntityReference nodes. """
6045: ret = libxml2mod.xmlTextReaderReadAttributeValue(self._o)
6046: return ret
6047:
6048: def ReadInnerXml(self):
6049: """Reads the contents of the current node, including child
6050: nodes and markup. """
6051: ret = libxml2mod.xmlTextReaderReadInnerXml(self._o)
6052: return ret
6053:
6054: def ReadOuterXml(self):
6055: """Reads the contents of the current node, including child
6056: nodes and markup. """
6057: ret = libxml2mod.xmlTextReaderReadOuterXml(self._o)
6058: return ret
6059:
6060: def ReadState(self):
6061: """Gets the read state of the reader. """
6062: ret = libxml2mod.xmlTextReaderReadState(self._o)
6063: return ret
6064:
6065: def ReadString(self):
6066: """Reads the contents of an element or a text node as a string. """
6067: ret = libxml2mod.xmlTextReaderReadString(self._o)
6068: return ret
6069:
6070: def RelaxNGSetSchema(self, schema):
6071: """Use RelaxNG to validate the document as it is processed.
6072: Activation is only possible before the first Read(). if
6073: @schema is None, then RelaxNG validation is desactivated. @
6074: The @schema should not be freed until the reader is
6075: deallocated or its use has been deactivated. """
6076: if schema is None: schema__o = None
6077: else: schema__o = schema._o
6078: ret = libxml2mod.xmlTextReaderRelaxNGSetSchema(self._o, schema__o)
6079: return ret
6080:
6081: def RelaxNGValidate(self, rng):
6082: """Use RelaxNG schema to validate the document as it is
6083: processed. Activation is only possible before the first
6084: Read(). If @rng is None, then RelaxNG schema validation is
6085: deactivated. """
6086: ret = libxml2mod.xmlTextReaderRelaxNGValidate(self._o, rng)
6087: return ret
6088:
6089: def RelaxNGValidateCtxt(self, ctxt, options):
6090: """Use RelaxNG schema context to validate the document as it
6091: is processed. Activation is only possible before the first
6092: Read(). If @ctxt is None, then RelaxNG schema validation is
6093: deactivated. """
6094: if ctxt is None: ctxt__o = None
6095: else: ctxt__o = ctxt._o
6096: ret = libxml2mod.xmlTextReaderRelaxNGValidateCtxt(self._o, ctxt__o, options)
6097: return ret
6098:
6099: def SchemaValidate(self, xsd):
6100: """Use W3C XSD schema to validate the document as it is
6101: processed. Activation is only possible before the first
6102: Read(). If @xsd is None, then XML Schema validation is
6103: deactivated. """
6104: ret = libxml2mod.xmlTextReaderSchemaValidate(self._o, xsd)
6105: return ret
6106:
6107: def SchemaValidateCtxt(self, ctxt, options):
6108: """Use W3C XSD schema context to validate the document as it
6109: is processed. Activation is only possible before the first
6110: Read(). If @ctxt is None, then XML Schema validation is
6111: deactivated. """
6112: if ctxt is None: ctxt__o = None
6113: else: ctxt__o = ctxt._o
6114: ret = libxml2mod.xmlTextReaderSchemaValidateCtxt(self._o, ctxt__o, options)
6115: return ret
6116:
6117: def SetParserProp(self, prop, value):
6118: """Change the parser processing behaviour by changing some of
6119: its internal properties. Note that some properties can only
6120: be changed before any read has been done. """
6121: ret = libxml2mod.xmlTextReaderSetParserProp(self._o, prop, value)
6122: return ret
6123:
6124: def SetSchema(self, schema):
6125: """Use XSD Schema to validate the document as it is processed.
6126: Activation is only possible before the first Read(). if
6127: @schema is None, then Schema validation is desactivated. @
6128: The @schema should not be freed until the reader is
6129: deallocated or its use has been deactivated. """
6130: if schema is None: schema__o = None
6131: else: schema__o = schema._o
6132: ret = libxml2mod.xmlTextReaderSetSchema(self._o, schema__o)
6133: return ret
6134:
6135: def Setup(self, input, URL, encoding, options):
6136: """Setup an XML reader with new options """
6137: if input is None: input__o = None
6138: else: input__o = input._o
6139: ret = libxml2mod.xmlTextReaderSetup(self._o, input__o, URL, encoding, options)
6140: return ret
6141:
6142: def Standalone(self):
6143: """Determine the standalone status of the document being read. """
6144: ret = libxml2mod.xmlTextReaderStandalone(self._o)
6145: return ret
6146:
6147: def String(self, str):
6148: """Get an interned string from the reader, allows for example
6149: to speedup string name comparisons """
6150: ret = libxml2mod.xmlTextReaderConstString(self._o, str)
6151: return ret
6152:
6153: def Value(self):
6154: """Provides the text value of the node if present """
6155: ret = libxml2mod.xmlTextReaderConstValue(self._o)
6156: return ret
6157:
6158: def XmlLang(self):
6159: """The xml:lang scope within which the node resides. """
6160: ret = libxml2mod.xmlTextReaderConstXmlLang(self._o)
6161: return ret
6162:
6163: def XmlVersion(self):
6164: """Determine the XML version of the document being read. """
6165: ret = libxml2mod.xmlTextReaderConstXmlVersion(self._o)
6166: return ret
6167:
6168: class URI:
6169: def __init__(self, _obj=None):
6170: if _obj != None:self._o = _obj;return
6171: self._o = None
6172:
6173: def __del__(self):
6174: if self._o != None:
6175: libxml2mod.xmlFreeURI(self._o)
6176: self._o = None
6177:
6178: # accessors for URI
6179: def authority(self):
6180: """Get the authority part from an URI """
6181: ret = libxml2mod.xmlURIGetAuthority(self._o)
6182: return ret
6183:
6184: def fragment(self):
6185: """Get the fragment part from an URI """
6186: ret = libxml2mod.xmlURIGetFragment(self._o)
6187: return ret
6188:
6189: def opaque(self):
6190: """Get the opaque part from an URI """
6191: ret = libxml2mod.xmlURIGetOpaque(self._o)
6192: return ret
6193:
6194: def path(self):
6195: """Get the path part from an URI """
6196: ret = libxml2mod.xmlURIGetPath(self._o)
6197: return ret
6198:
6199: def port(self):
6200: """Get the port part from an URI """
6201: ret = libxml2mod.xmlURIGetPort(self._o)
6202: return ret
6203:
6204: def query(self):
6205: """Get the query part from an URI """
6206: ret = libxml2mod.xmlURIGetQuery(self._o)
6207: return ret
6208:
6209: def queryRaw(self):
6210: """Get the raw query part from an URI (i.e. the unescaped
6211: form). """
6212: ret = libxml2mod.xmlURIGetQueryRaw(self._o)
6213: return ret
6214:
6215: def scheme(self):
6216: """Get the scheme part from an URI """
6217: ret = libxml2mod.xmlURIGetScheme(self._o)
6218: return ret
6219:
6220: def server(self):
6221: """Get the server part from an URI """
6222: ret = libxml2mod.xmlURIGetServer(self._o)
6223: return ret
6224:
6225: def setAuthority(self, authority):
6226: """Set the authority part of an URI. """
6227: libxml2mod.xmlURISetAuthority(self._o, authority)
6228:
6229: def setFragment(self, fragment):
6230: """Set the fragment part of an URI. """
6231: libxml2mod.xmlURISetFragment(self._o, fragment)
6232:
6233: def setOpaque(self, opaque):
6234: """Set the opaque part of an URI. """
6235: libxml2mod.xmlURISetOpaque(self._o, opaque)
6236:
6237: def setPath(self, path):
6238: """Set the path part of an URI. """
6239: libxml2mod.xmlURISetPath(self._o, path)
6240:
6241: def setPort(self, port):
6242: """Set the port part of an URI. """
6243: libxml2mod.xmlURISetPort(self._o, port)
6244:
6245: def setQuery(self, query):
6246: """Set the query part of an URI. """
6247: libxml2mod.xmlURISetQuery(self._o, query)
6248:
6249: def setQueryRaw(self, query_raw):
6250: """Set the raw query part of an URI (i.e. the unescaped form). """
6251: libxml2mod.xmlURISetQueryRaw(self._o, query_raw)
6252:
6253: def setScheme(self, scheme):
6254: """Set the scheme part of an URI. """
6255: libxml2mod.xmlURISetScheme(self._o, scheme)
6256:
6257: def setServer(self, server):
6258: """Set the server part of an URI. """
6259: libxml2mod.xmlURISetServer(self._o, server)
6260:
6261: def setUser(self, user):
6262: """Set the user part of an URI. """
6263: libxml2mod.xmlURISetUser(self._o, user)
6264:
6265: def user(self):
6266: """Get the user part from an URI """
6267: ret = libxml2mod.xmlURIGetUser(self._o)
6268: return ret
6269:
6270: #
6271: # URI functions from module uri
6272: #
6273:
6274: def parseURIReference(self, str):
6275: """Parse an URI reference string based on RFC 3986 and fills
6276: in the appropriate fields of the @uri structure
6277: URI-reference = URI / relative-ref """
6278: ret = libxml2mod.xmlParseURIReference(self._o, str)
6279: return ret
6280:
6281: def printURI(self, stream):
6282: """Prints the URI in the stream @stream. """
6283: libxml2mod.xmlPrintURI(stream, self._o)
6284:
6285: def saveUri(self):
6286: """Save the URI as an escaped string """
6287: ret = libxml2mod.xmlSaveUri(self._o)
6288: return ret
6289:
6290: class ValidCtxt(ValidCtxtCore):
6291: def __init__(self, _obj=None):
6292: self._o = _obj
6293: ValidCtxtCore.__init__(self, _obj=_obj)
6294:
6295: def __del__(self):
6296: if self._o != None:
6297: libxml2mod.xmlFreeValidCtxt(self._o)
6298: self._o = None
6299:
6300: #
6301: # ValidCtxt functions from module valid
6302: #
6303:
6304: def validCtxtNormalizeAttributeValue(self, doc, elem, name, value):
6305: """Does the validation related extra step of the normalization
6306: of attribute values: If the declared value is not CDATA,
6307: then the XML processor must further process the normalized
6308: attribute value by discarding any leading and trailing
6309: space (#x20) characters, and by replacing sequences of
6310: space (#x20) characters by single space (#x20) character.
6311: Also check VC: Standalone Document Declaration in P32, and
6312: update ctxt->valid accordingly """
6313: if doc is None: doc__o = None
6314: else: doc__o = doc._o
6315: if elem is None: elem__o = None
6316: else: elem__o = elem._o
6317: ret = libxml2mod.xmlValidCtxtNormalizeAttributeValue(self._o, doc__o, elem__o, name, value)
6318: return ret
6319:
6320: def validateDocument(self, doc):
6321: """Try to validate the document instance basically it does
6322: the all the checks described by the XML Rec i.e. validates
6323: the internal and external subset (if present) and validate
6324: the document tree. """
6325: if doc is None: doc__o = None
6326: else: doc__o = doc._o
6327: ret = libxml2mod.xmlValidateDocument(self._o, doc__o)
6328: return ret
6329:
6330: def validateDocumentFinal(self, doc):
6331: """Does the final step for the document validation once all
6332: the incremental validation steps have been completed
6333: basically it does the following checks described by the XML
6334: Rec Check all the IDREF/IDREFS attributes definition for
6335: validity """
6336: if doc is None: doc__o = None
6337: else: doc__o = doc._o
6338: ret = libxml2mod.xmlValidateDocumentFinal(self._o, doc__o)
6339: return ret
6340:
6341: def validateDtd(self, doc, dtd):
6342: """Try to validate the document against the dtd instance
6343: Basically it does check all the definitions in the DtD.
6344: Note the the internal subset (if present) is de-coupled
6345: (i.e. not used), which could give problems if ID or IDREF
6346: is present. """
6347: if doc is None: doc__o = None
6348: else: doc__o = doc._o
6349: if dtd is None: dtd__o = None
6350: else: dtd__o = dtd._o
6351: ret = libxml2mod.xmlValidateDtd(self._o, doc__o, dtd__o)
6352: return ret
6353:
6354: def validateDtdFinal(self, doc):
6355: """Does the final step for the dtds validation once all the
6356: subsets have been parsed basically it does the following
6357: checks described by the XML Rec - check that ENTITY and
6358: ENTITIES type attributes default or possible values matches
6359: one of the defined entities. - check that NOTATION type
6360: attributes default or possible values matches one of the
6361: defined notations. """
6362: if doc is None: doc__o = None
6363: else: doc__o = doc._o
6364: ret = libxml2mod.xmlValidateDtdFinal(self._o, doc__o)
6365: return ret
6366:
6367: def validateElement(self, doc, elem):
6368: """Try to validate the subtree under an element """
6369: if doc is None: doc__o = None
6370: else: doc__o = doc._o
6371: if elem is None: elem__o = None
6372: else: elem__o = elem._o
6373: ret = libxml2mod.xmlValidateElement(self._o, doc__o, elem__o)
6374: return ret
6375:
6376: def validateNotationUse(self, doc, notationName):
6377: """Validate that the given name match a notation declaration.
6378: - [ VC: Notation Declared ] """
6379: if doc is None: doc__o = None
6380: else: doc__o = doc._o
6381: ret = libxml2mod.xmlValidateNotationUse(self._o, doc__o, notationName)
6382: return ret
6383:
6384: def validateOneAttribute(self, doc, elem, attr, value):
6385: """Try to validate a single attribute for an element basically
6386: it does the following checks as described by the XML-1.0
6387: recommendation: - [ VC: Attribute Value Type ] - [ VC:
6388: Fixed Attribute Default ] - [ VC: Entity Name ] - [ VC:
6389: Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC: Entity
6390: Name ] - [ VC: Notation Attributes ] The ID/IDREF
6391: uniqueness and matching are done separately """
6392: if doc is None: doc__o = None
6393: else: doc__o = doc._o
6394: if elem is None: elem__o = None
6395: else: elem__o = elem._o
6396: if attr is None: attr__o = None
6397: else: attr__o = attr._o
6398: ret = libxml2mod.xmlValidateOneAttribute(self._o, doc__o, elem__o, attr__o, value)
6399: return ret
6400:
6401: def validateOneElement(self, doc, elem):
6402: """Try to validate a single element and it's attributes,
6403: basically it does the following checks as described by the
6404: XML-1.0 recommendation: - [ VC: Element Valid ] - [ VC:
6405: Required Attribute ] Then call xmlValidateOneAttribute()
6406: for each attribute present. The ID/IDREF checkings are
6407: done separately """
6408: if doc is None: doc__o = None
6409: else: doc__o = doc._o
6410: if elem is None: elem__o = None
6411: else: elem__o = elem._o
6412: ret = libxml2mod.xmlValidateOneElement(self._o, doc__o, elem__o)
6413: return ret
6414:
6415: def validateOneNamespace(self, doc, elem, prefix, ns, value):
6416: """Try to validate a single namespace declaration for an
6417: element basically it does the following checks as described
6418: by the XML-1.0 recommendation: - [ VC: Attribute Value Type
6419: ] - [ VC: Fixed Attribute Default ] - [ VC: Entity Name ] -
6420: [ VC: Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC:
6421: Entity Name ] - [ VC: Notation Attributes ] The ID/IDREF
6422: uniqueness and matching are done separately """
6423: if doc is None: doc__o = None
6424: else: doc__o = doc._o
6425: if elem is None: elem__o = None
6426: else: elem__o = elem._o
6427: if ns is None: ns__o = None
6428: else: ns__o = ns._o
6429: ret = libxml2mod.xmlValidateOneNamespace(self._o, doc__o, elem__o, prefix, ns__o, value)
6430: return ret
6431:
6432: def validatePopElement(self, doc, elem, qname):
6433: """Pop the element end from the validation stack. """
6434: if doc is None: doc__o = None
6435: else: doc__o = doc._o
6436: if elem is None: elem__o = None
6437: else: elem__o = elem._o
6438: ret = libxml2mod.xmlValidatePopElement(self._o, doc__o, elem__o, qname)
6439: return ret
6440:
6441: def validatePushCData(self, data, len):
6442: """check the CData parsed for validation in the current stack """
6443: ret = libxml2mod.xmlValidatePushCData(self._o, data, len)
6444: return ret
6445:
6446: def validatePushElement(self, doc, elem, qname):
6447: """Push a new element start on the validation stack. """
6448: if doc is None: doc__o = None
6449: else: doc__o = doc._o
6450: if elem is None: elem__o = None
6451: else: elem__o = elem._o
6452: ret = libxml2mod.xmlValidatePushElement(self._o, doc__o, elem__o, qname)
6453: return ret
6454:
6455: def validateRoot(self, doc):
6456: """Try to validate a the root element basically it does the
6457: following check as described by the XML-1.0 recommendation:
6458: - [ VC: Root Element Type ] it doesn't try to recurse or
6459: apply other check to the element """
6460: if doc is None: doc__o = None
6461: else: doc__o = doc._o
6462: ret = libxml2mod.xmlValidateRoot(self._o, doc__o)
6463: return ret
6464:
6465: class xpathContext:
6466: def __init__(self, _obj=None):
6467: if _obj != None:self._o = _obj;return
6468: self._o = None
6469:
6470: # accessors for xpathContext
6471: def contextDoc(self):
6472: """Get the doc from an xpathContext """
6473: ret = libxml2mod.xmlXPathGetContextDoc(self._o)
6474: if ret is None:raise xpathError('xmlXPathGetContextDoc() failed')
6475: __tmp = xmlDoc(_obj=ret)
6476: return __tmp
6477:
6478: def contextNode(self):
6479: """Get the current node from an xpathContext """
6480: ret = libxml2mod.xmlXPathGetContextNode(self._o)
6481: if ret is None:raise xpathError('xmlXPathGetContextNode() failed')
6482: __tmp = xmlNode(_obj=ret)
6483: return __tmp
6484:
6485: def contextPosition(self):
6486: """Get the current node from an xpathContext """
6487: ret = libxml2mod.xmlXPathGetContextPosition(self._o)
6488: return ret
6489:
6490: def contextSize(self):
6491: """Get the current node from an xpathContext """
6492: ret = libxml2mod.xmlXPathGetContextSize(self._o)
6493: return ret
6494:
6495: def function(self):
6496: """Get the current function name xpathContext """
6497: ret = libxml2mod.xmlXPathGetFunction(self._o)
6498: return ret
6499:
6500: def functionURI(self):
6501: """Get the current function name URI xpathContext """
6502: ret = libxml2mod.xmlXPathGetFunctionURI(self._o)
6503: return ret
6504:
6505: def setContextDoc(self, doc):
6506: """Set the doc of an xpathContext """
6507: if doc is None: doc__o = None
6508: else: doc__o = doc._o
6509: libxml2mod.xmlXPathSetContextDoc(self._o, doc__o)
6510:
6511: def setContextNode(self, node):
6512: """Set the current node of an xpathContext """
6513: if node is None: node__o = None
6514: else: node__o = node._o
6515: libxml2mod.xmlXPathSetContextNode(self._o, node__o)
6516:
6517: #
6518: # xpathContext functions from module python
6519: #
6520:
6521: def registerXPathFunction(self, name, ns_uri, f):
6522: """Register a Python written function to the XPath interpreter """
6523: ret = libxml2mod.xmlRegisterXPathFunction(self._o, name, ns_uri, f)
6524: return ret
6525:
6526: def xpathRegisterVariable(self, name, ns_uri, value):
6527: """Register a variable with the XPath context """
6528: ret = libxml2mod.xmlXPathRegisterVariable(self._o, name, ns_uri, value)
6529: return ret
6530:
6531: #
6532: # xpathContext functions from module xpath
6533: #
6534:
6535: def xpathContextSetCache(self, active, value, options):
6536: """Creates/frees an object cache on the XPath context. If
6537: activates XPath objects (xmlXPathObject) will be cached
6538: internally to be reused. @options: 0: This will set the
6539: XPath object caching: @value: This will set the maximum
6540: number of XPath objects to be cached per slot There are 5
6541: slots for: node-set, string, number, boolean, and misc
6542: objects. Use <0 for the default number (100). Other values
6543: for @options have currently no effect. """
6544: ret = libxml2mod.xmlXPathContextSetCache(self._o, active, value, options)
6545: return ret
6546:
6547: def xpathEval(self, str):
6548: """Evaluate the XPath Location Path in the given context. """
6549: ret = libxml2mod.xmlXPathEval(str, self._o)
6550: if ret is None:raise xpathError('xmlXPathEval() failed')
6551: return xpathObjectRet(ret)
6552:
6553: def xpathEvalExpression(self, str):
6554: """Evaluate the XPath expression in the given context. """
6555: ret = libxml2mod.xmlXPathEvalExpression(str, self._o)
6556: if ret is None:raise xpathError('xmlXPathEvalExpression() failed')
6557: return xpathObjectRet(ret)
6558:
6559: def xpathFreeContext(self):
6560: """Free up an xmlXPathContext """
6561: libxml2mod.xmlXPathFreeContext(self._o)
6562:
6563: #
6564: # xpathContext functions from module xpathInternals
6565: #
6566:
6567: def xpathNewParserContext(self, str):
6568: """Create a new xmlXPathParserContext """
6569: ret = libxml2mod.xmlXPathNewParserContext(str, self._o)
6570: if ret is None:raise xpathError('xmlXPathNewParserContext() failed')
6571: __tmp = xpathParserContext(_obj=ret)
6572: return __tmp
6573:
6574: def xpathNsLookup(self, prefix):
6575: """Search in the namespace declaration array of the context
6576: for the given namespace name associated to the given prefix """
6577: ret = libxml2mod.xmlXPathNsLookup(self._o, prefix)
6578: return ret
6579:
6580: def xpathRegisterAllFunctions(self):
6581: """Registers all default XPath functions in this context """
6582: libxml2mod.xmlXPathRegisterAllFunctions(self._o)
6583:
6584: def xpathRegisterNs(self, prefix, ns_uri):
6585: """Register a new namespace. If @ns_uri is None it unregisters
6586: the namespace """
6587: ret = libxml2mod.xmlXPathRegisterNs(self._o, prefix, ns_uri)
6588: return ret
6589:
6590: def xpathRegisteredFuncsCleanup(self):
6591: """Cleanup the XPath context data associated to registered
6592: functions """
6593: libxml2mod.xmlXPathRegisteredFuncsCleanup(self._o)
6594:
6595: def xpathRegisteredNsCleanup(self):
6596: """Cleanup the XPath context data associated to registered
6597: variables """
6598: libxml2mod.xmlXPathRegisteredNsCleanup(self._o)
6599:
6600: def xpathRegisteredVariablesCleanup(self):
6601: """Cleanup the XPath context data associated to registered
6602: variables """
6603: libxml2mod.xmlXPathRegisteredVariablesCleanup(self._o)
6604:
6605: def xpathVariableLookup(self, name):
6606: """Search in the Variable array of the context for the given
6607: variable value. """
6608: ret = libxml2mod.xmlXPathVariableLookup(self._o, name)
6609: if ret is None:raise xpathError('xmlXPathVariableLookup() failed')
6610: return xpathObjectRet(ret)
6611:
6612: def xpathVariableLookupNS(self, name, ns_uri):
6613: """Search in the Variable array of the context for the given
6614: variable value. """
6615: ret = libxml2mod.xmlXPathVariableLookupNS(self._o, name, ns_uri)
6616: if ret is None:raise xpathError('xmlXPathVariableLookupNS() failed')
6617: return xpathObjectRet(ret)
6618:
6619: #
6620: # xpathContext functions from module xpointer
6621: #
6622:
6623: def xpointerEval(self, str):
6624: """Evaluate the XPath Location Path in the given context. """
6625: ret = libxml2mod.xmlXPtrEval(str, self._o)
6626: if ret is None:raise treeError('xmlXPtrEval() failed')
6627: return xpathObjectRet(ret)
6628:
6629: class xpathParserContext:
6630: def __init__(self, _obj=None):
6631: if _obj != None:self._o = _obj;return
6632: self._o = None
6633:
6634: # accessors for xpathParserContext
6635: def context(self):
6636: """Get the xpathContext from an xpathParserContext """
6637: ret = libxml2mod.xmlXPathParserGetContext(self._o)
6638: if ret is None:raise xpathError('xmlXPathParserGetContext() failed')
6639: __tmp = xpathContext(_obj=ret)
6640: return __tmp
6641:
6642: #
6643: # xpathParserContext functions from module xpathInternals
6644: #
6645:
6646: def xpathAddValues(self):
6647: """Implement the add operation on XPath objects: The numeric
6648: operators convert their operands to numbers as if by
6649: calling the number function. """
6650: libxml2mod.xmlXPathAddValues(self._o)
6651:
6652: def xpathBooleanFunction(self, nargs):
6653: """Implement the boolean() XPath function boolean
6654: boolean(object) The boolean function converts its argument
6655: to a boolean as follows: - a number is true if and only if
6656: it is neither positive or negative zero nor NaN - a
6657: node-set is true if and only if it is non-empty - a string
6658: is true if and only if its length is non-zero """
6659: libxml2mod.xmlXPathBooleanFunction(self._o, nargs)
6660:
6661: def xpathCeilingFunction(self, nargs):
6662: """Implement the ceiling() XPath function number
6663: ceiling(number) The ceiling function returns the smallest
6664: (closest to negative infinity) number that is not less than
6665: the argument and that is an integer. """
6666: libxml2mod.xmlXPathCeilingFunction(self._o, nargs)
6667:
6668: def xpathCompareValues(self, inf, strict):
6669: """Implement the compare operation on XPath objects: @arg1 <
6670: @arg2 (1, 1, ... @arg1 <= @arg2 (1, 0, ... @arg1 >
6671: @arg2 (0, 1, ... @arg1 >= @arg2 (0, 0, ... When
6672: neither object to be compared is a node-set and the
6673: operator is <=, <, >=, >, then the objects are compared by
6674: converted both objects to numbers and comparing the numbers
6675: according to IEEE 754. The < comparison will be true if and
6676: only if the first number is less than the second number.
6677: The <= comparison will be true if and only if the first
6678: number is less than or equal to the second number. The >
6679: comparison will be true if and only if the first number is
6680: greater than the second number. The >= comparison will be
6681: true if and only if the first number is greater than or
6682: equal to the second number. """
6683: ret = libxml2mod.xmlXPathCompareValues(self._o, inf, strict)
6684: return ret
6685:
6686: def xpathConcatFunction(self, nargs):
6687: """Implement the concat() XPath function string concat(string,
6688: string, string*) The concat function returns the
6689: concatenation of its arguments. """
6690: libxml2mod.xmlXPathConcatFunction(self._o, nargs)
6691:
6692: def xpathContainsFunction(self, nargs):
6693: """Implement the contains() XPath function boolean
6694: contains(string, string) The contains function returns true
6695: if the first argument string contains the second argument
6696: string, and otherwise returns false. """
6697: libxml2mod.xmlXPathContainsFunction(self._o, nargs)
6698:
6699: def xpathCountFunction(self, nargs):
6700: """Implement the count() XPath function number count(node-set) """
6701: libxml2mod.xmlXPathCountFunction(self._o, nargs)
6702:
6703: def xpathDivValues(self):
6704: """Implement the div operation on XPath objects @arg1 / @arg2:
6705: The numeric operators convert their operands to numbers as
6706: if by calling the number function. """
6707: libxml2mod.xmlXPathDivValues(self._o)
6708:
6709: def xpathEqualValues(self):
6710: """Implement the equal operation on XPath objects content:
6711: @arg1 == @arg2 """
6712: ret = libxml2mod.xmlXPathEqualValues(self._o)
6713: return ret
6714:
6715: def xpathErr(self, error):
6716: """Handle an XPath error """
6717: libxml2mod.xmlXPathErr(self._o, error)
6718:
6719: def xpathEvalExpr(self):
6720: """Parse and evaluate an XPath expression in the given
6721: context, then push the result on the context stack """
6722: libxml2mod.xmlXPathEvalExpr(self._o)
6723:
6724: def xpathFalseFunction(self, nargs):
6725: """Implement the false() XPath function boolean false() """
6726: libxml2mod.xmlXPathFalseFunction(self._o, nargs)
6727:
6728: def xpathFloorFunction(self, nargs):
6729: """Implement the floor() XPath function number floor(number)
6730: The floor function returns the largest (closest to positive
6731: infinity) number that is not greater than the argument and
6732: that is an integer. """
6733: libxml2mod.xmlXPathFloorFunction(self._o, nargs)
6734:
6735: def xpathFreeParserContext(self):
6736: """Free up an xmlXPathParserContext """
6737: libxml2mod.xmlXPathFreeParserContext(self._o)
6738:
6739: def xpathIdFunction(self, nargs):
6740: """Implement the id() XPath function node-set id(object) The
6741: id function selects elements by their unique ID (see [5.2.1
6742: Unique IDs]). When the argument to id is of type node-set,
6743: then the result is the union of the result of applying id
6744: to the string value of each of the nodes in the argument
6745: node-set. When the argument to id is of any other type, the
6746: argument is converted to a string as if by a call to the
6747: string function; the string is split into a
6748: whitespace-separated list of tokens (whitespace is any
6749: sequence of characters matching the production S); the
6750: result is a node-set containing the elements in the same
6751: document as the context node that have a unique ID equal to
6752: any of the tokens in the list. """
6753: libxml2mod.xmlXPathIdFunction(self._o, nargs)
6754:
6755: def xpathLangFunction(self, nargs):
6756: """Implement the lang() XPath function boolean lang(string)
6757: The lang function returns true or false depending on
6758: whether the language of the context node as specified by
6759: xml:lang attributes is the same as or is a sublanguage of
6760: the language specified by the argument string. The language
6761: of the context node is determined by the value of the
6762: xml:lang attribute on the context node, or, if the context
6763: node has no xml:lang attribute, by the value of the
6764: xml:lang attribute on the nearest ancestor of the context
6765: node that has an xml:lang attribute. If there is no such
6766: attribute, then lang """
6767: libxml2mod.xmlXPathLangFunction(self._o, nargs)
6768:
6769: def xpathLastFunction(self, nargs):
6770: """Implement the last() XPath function number last() The last
6771: function returns the number of nodes in the context node
6772: list. """
6773: libxml2mod.xmlXPathLastFunction(self._o, nargs)
6774:
6775: def xpathLocalNameFunction(self, nargs):
6776: """Implement the local-name() XPath function string
6777: local-name(node-set?) The local-name function returns a
6778: string containing the local part of the name of the node in
6779: the argument node-set that is first in document order. If
6780: the node-set is empty or the first node has no name, an
6781: empty string is returned. If the argument is omitted it
6782: defaults to the context node. """
6783: libxml2mod.xmlXPathLocalNameFunction(self._o, nargs)
6784:
6785: def xpathModValues(self):
6786: """Implement the mod operation on XPath objects: @arg1 / @arg2
6787: The numeric operators convert their operands to numbers as
6788: if by calling the number function. """
6789: libxml2mod.xmlXPathModValues(self._o)
6790:
6791: def xpathMultValues(self):
6792: """Implement the multiply operation on XPath objects: The
6793: numeric operators convert their operands to numbers as if
6794: by calling the number function. """
6795: libxml2mod.xmlXPathMultValues(self._o)
6796:
6797: def xpathNamespaceURIFunction(self, nargs):
6798: """Implement the namespace-uri() XPath function string
6799: namespace-uri(node-set?) The namespace-uri function returns
6800: a string containing the namespace URI of the expanded name
6801: of the node in the argument node-set that is first in
6802: document order. If the node-set is empty, the first node
6803: has no name, or the expanded name has no namespace URI, an
6804: empty string is returned. If the argument is omitted it
6805: defaults to the context node. """
6806: libxml2mod.xmlXPathNamespaceURIFunction(self._o, nargs)
6807:
6808: def xpathNextAncestor(self, cur):
6809: """Traversal function for the "ancestor" direction the
6810: ancestor axis contains the ancestors of the context node;
6811: the ancestors of the context node consist of the parent of
6812: context node and the parent's parent and so on; the nodes
6813: are ordered in reverse document order; thus the parent is
6814: the first node on the axis, and the parent's parent is the
6815: second node on the axis """
6816: if cur is None: cur__o = None
6817: else: cur__o = cur._o
6818: ret = libxml2mod.xmlXPathNextAncestor(self._o, cur__o)
6819: if ret is None:raise xpathError('xmlXPathNextAncestor() failed')
6820: __tmp = xmlNode(_obj=ret)
6821: return __tmp
6822:
6823: def xpathNextAncestorOrSelf(self, cur):
6824: """Traversal function for the "ancestor-or-self" direction he
6825: ancestor-or-self axis contains the context node and
6826: ancestors of the context node in reverse document order;
6827: thus the context node is the first node on the axis, and
6828: the context node's parent the second; parent here is
6829: defined the same as with the parent axis. """
6830: if cur is None: cur__o = None
6831: else: cur__o = cur._o
6832: ret = libxml2mod.xmlXPathNextAncestorOrSelf(self._o, cur__o)
6833: if ret is None:raise xpathError('xmlXPathNextAncestorOrSelf() failed')
6834: __tmp = xmlNode(_obj=ret)
6835: return __tmp
6836:
6837: def xpathNextAttribute(self, cur):
6838: """Traversal function for the "attribute" direction TODO:
6839: support DTD inherited default attributes """
6840: if cur is None: cur__o = None
6841: else: cur__o = cur._o
6842: ret = libxml2mod.xmlXPathNextAttribute(self._o, cur__o)
6843: if ret is None:raise xpathError('xmlXPathNextAttribute() failed')
6844: __tmp = xmlNode(_obj=ret)
6845: return __tmp
6846:
6847: def xpathNextChild(self, cur):
6848: """Traversal function for the "child" direction The child axis
6849: contains the children of the context node in document order. """
6850: if cur is None: cur__o = None
6851: else: cur__o = cur._o
6852: ret = libxml2mod.xmlXPathNextChild(self._o, cur__o)
6853: if ret is None:raise xpathError('xmlXPathNextChild() failed')
6854: __tmp = xmlNode(_obj=ret)
6855: return __tmp
6856:
6857: def xpathNextDescendant(self, cur):
6858: """Traversal function for the "descendant" direction the
6859: descendant axis contains the descendants of the context
6860: node in document order; a descendant is a child or a child
6861: of a child and so on. """
6862: if cur is None: cur__o = None
6863: else: cur__o = cur._o
6864: ret = libxml2mod.xmlXPathNextDescendant(self._o, cur__o)
6865: if ret is None:raise xpathError('xmlXPathNextDescendant() failed')
6866: __tmp = xmlNode(_obj=ret)
6867: return __tmp
6868:
6869: def xpathNextDescendantOrSelf(self, cur):
6870: """Traversal function for the "descendant-or-self" direction
6871: the descendant-or-self axis contains the context node and
6872: the descendants of the context node in document order; thus
6873: the context node is the first node on the axis, and the
6874: first child of the context node is the second node on the
6875: axis """
6876: if cur is None: cur__o = None
6877: else: cur__o = cur._o
6878: ret = libxml2mod.xmlXPathNextDescendantOrSelf(self._o, cur__o)
6879: if ret is None:raise xpathError('xmlXPathNextDescendantOrSelf() failed')
6880: __tmp = xmlNode(_obj=ret)
6881: return __tmp
6882:
6883: def xpathNextFollowing(self, cur):
6884: """Traversal function for the "following" direction The
6885: following axis contains all nodes in the same document as
6886: the context node that are after the context node in
6887: document order, excluding any descendants and excluding
6888: attribute nodes and namespace nodes; the nodes are ordered
6889: in document order """
6890: if cur is None: cur__o = None
6891: else: cur__o = cur._o
6892: ret = libxml2mod.xmlXPathNextFollowing(self._o, cur__o)
6893: if ret is None:raise xpathError('xmlXPathNextFollowing() failed')
6894: __tmp = xmlNode(_obj=ret)
6895: return __tmp
6896:
6897: def xpathNextFollowingSibling(self, cur):
6898: """Traversal function for the "following-sibling" direction
6899: The following-sibling axis contains the following siblings
6900: of the context node in document order. """
6901: if cur is None: cur__o = None
6902: else: cur__o = cur._o
6903: ret = libxml2mod.xmlXPathNextFollowingSibling(self._o, cur__o)
6904: if ret is None:raise xpathError('xmlXPathNextFollowingSibling() failed')
6905: __tmp = xmlNode(_obj=ret)
6906: return __tmp
6907:
6908: def xpathNextNamespace(self, cur):
6909: """Traversal function for the "namespace" direction the
6910: namespace axis contains the namespace nodes of the context
6911: node; the order of nodes on this axis is
6912: implementation-defined; the axis will be empty unless the
6913: context node is an element We keep the XML namespace node
6914: at the end of the list. """
6915: if cur is None: cur__o = None
6916: else: cur__o = cur._o
6917: ret = libxml2mod.xmlXPathNextNamespace(self._o, cur__o)
6918: if ret is None:raise xpathError('xmlXPathNextNamespace() failed')
6919: __tmp = xmlNode(_obj=ret)
6920: return __tmp
6921:
6922: def xpathNextParent(self, cur):
6923: """Traversal function for the "parent" direction The parent
6924: axis contains the parent of the context node, if there is
6925: one. """
6926: if cur is None: cur__o = None
6927: else: cur__o = cur._o
6928: ret = libxml2mod.xmlXPathNextParent(self._o, cur__o)
6929: if ret is None:raise xpathError('xmlXPathNextParent() failed')
6930: __tmp = xmlNode(_obj=ret)
6931: return __tmp
6932:
6933: def xpathNextPreceding(self, cur):
6934: """Traversal function for the "preceding" direction the
6935: preceding axis contains all nodes in the same document as
6936: the context node that are before the context node in
6937: document order, excluding any ancestors and excluding
6938: attribute nodes and namespace nodes; the nodes are ordered
6939: in reverse document order """
6940: if cur is None: cur__o = None
6941: else: cur__o = cur._o
6942: ret = libxml2mod.xmlXPathNextPreceding(self._o, cur__o)
6943: if ret is None:raise xpathError('xmlXPathNextPreceding() failed')
6944: __tmp = xmlNode(_obj=ret)
6945: return __tmp
6946:
6947: def xpathNextPrecedingSibling(self, cur):
6948: """Traversal function for the "preceding-sibling" direction
6949: The preceding-sibling axis contains the preceding siblings
6950: of the context node in reverse document order; the first
6951: preceding sibling is first on the axis; the sibling
6952: preceding that node is the second on the axis and so on. """
6953: if cur is None: cur__o = None
6954: else: cur__o = cur._o
6955: ret = libxml2mod.xmlXPathNextPrecedingSibling(self._o, cur__o)
6956: if ret is None:raise xpathError('xmlXPathNextPrecedingSibling() failed')
6957: __tmp = xmlNode(_obj=ret)
6958: return __tmp
6959:
6960: def xpathNextSelf(self, cur):
6961: """Traversal function for the "self" direction The self axis
6962: contains just the context node itself """
6963: if cur is None: cur__o = None
6964: else: cur__o = cur._o
6965: ret = libxml2mod.xmlXPathNextSelf(self._o, cur__o)
6966: if ret is None:raise xpathError('xmlXPathNextSelf() failed')
6967: __tmp = xmlNode(_obj=ret)
6968: return __tmp
6969:
6970: def xpathNormalizeFunction(self, nargs):
6971: """Implement the normalize-space() XPath function string
6972: normalize-space(string?) The normalize-space function
6973: returns the argument string with white space normalized by
6974: stripping leading and trailing whitespace and replacing
6975: sequences of whitespace characters by a single space.
6976: Whitespace characters are the same allowed by the S
6977: production in XML. If the argument is omitted, it defaults
6978: to the context node converted to a string, in other words
6979: the value of the context node. """
6980: libxml2mod.xmlXPathNormalizeFunction(self._o, nargs)
6981:
6982: def xpathNotEqualValues(self):
6983: """Implement the equal operation on XPath objects content:
6984: @arg1 == @arg2 """
6985: ret = libxml2mod.xmlXPathNotEqualValues(self._o)
6986: return ret
6987:
6988: def xpathNotFunction(self, nargs):
6989: """Implement the not() XPath function boolean not(boolean) The
6990: not function returns true if its argument is false, and
6991: false otherwise. """
6992: libxml2mod.xmlXPathNotFunction(self._o, nargs)
6993:
6994: def xpathNumberFunction(self, nargs):
6995: """Implement the number() XPath function number number(object?) """
6996: libxml2mod.xmlXPathNumberFunction(self._o, nargs)
6997:
6998: def xpathParseNCName(self):
6999: """parse an XML namespace non qualified name. [NS 3] NCName
7000: ::= (Letter | '_') (NCNameChar)* [NS 4] NCNameChar ::=
7001: Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender """
7002: ret = libxml2mod.xmlXPathParseNCName(self._o)
7003: return ret
7004:
7005: def xpathParseName(self):
7006: """parse an XML name [4] NameChar ::= Letter | Digit | '.' |
7007: '-' | '_' | ':' | CombiningChar | Extender [5] Name ::=
7008: (Letter | '_' | ':') (NameChar)* """
7009: ret = libxml2mod.xmlXPathParseName(self._o)
7010: return ret
7011:
7012: def xpathPopBoolean(self):
7013: """Pops a boolean from the stack, handling conversion if
7014: needed. Check error with #xmlXPathCheckError. """
7015: ret = libxml2mod.xmlXPathPopBoolean(self._o)
7016: return ret
7017:
7018: def xpathPopNumber(self):
7019: """Pops a number from the stack, handling conversion if
7020: needed. Check error with #xmlXPathCheckError. """
7021: ret = libxml2mod.xmlXPathPopNumber(self._o)
7022: return ret
7023:
7024: def xpathPopString(self):
7025: """Pops a string from the stack, handling conversion if
7026: needed. Check error with #xmlXPathCheckError. """
7027: ret = libxml2mod.xmlXPathPopString(self._o)
7028: return ret
7029:
7030: def xpathPositionFunction(self, nargs):
7031: """Implement the position() XPath function number position()
7032: The position function returns the position of the context
7033: node in the context node list. The first position is 1, and
7034: so the last position will be equal to last(). """
7035: libxml2mod.xmlXPathPositionFunction(self._o, nargs)
7036:
7037: def xpathRoot(self):
7038: """Initialize the context to the root of the document """
7039: libxml2mod.xmlXPathRoot(self._o)
7040:
7041: def xpathRoundFunction(self, nargs):
7042: """Implement the round() XPath function number round(number)
7043: The round function returns the number that is closest to
7044: the argument and that is an integer. If there are two such
7045: numbers, then the one that is even is returned. """
7046: libxml2mod.xmlXPathRoundFunction(self._o, nargs)
7047:
7048: def xpathStartsWithFunction(self, nargs):
7049: """Implement the starts-with() XPath function boolean
7050: starts-with(string, string) The starts-with function
7051: returns true if the first argument string starts with the
7052: second argument string, and otherwise returns false. """
7053: libxml2mod.xmlXPathStartsWithFunction(self._o, nargs)
7054:
7055: def xpathStringFunction(self, nargs):
7056: """Implement the string() XPath function string
7057: string(object?) The string function converts an object to a
7058: string as follows: - A node-set is converted to a string by
7059: returning the value of the node in the node-set that is
7060: first in document order. If the node-set is empty, an empty
7061: string is returned. - A number is converted to a string as
7062: follows + NaN is converted to the string NaN + positive
7063: zero is converted to the string 0 + negative zero is
7064: converted to the string 0 + positive infinity is converted
7065: to the string Infinity + negative infinity is converted to
7066: the string -Infinity + if the number is an integer, the
7067: number is represented in decimal form as a Number with no
7068: decimal point and no leading zeros, preceded by a minus
7069: sign (-) if the number is negative + otherwise, the number
7070: is represented in decimal form as a Number including a
7071: decimal point with at least one digit before the decimal
7072: point and at least one digit after the decimal point,
7073: preceded by a minus sign (-) if the number is negative;
7074: there must be no leading zeros before the decimal point
7075: apart possibly from the one required digit immediately
7076: before the decimal point; beyond the one required digit
7077: after the decimal point there must be as many, but only as
7078: many, more digits as are needed to uniquely distinguish the
7079: number from all other IEEE 754 numeric values. - The
7080: boolean false value is converted to the string false. The
7081: boolean true value is converted to the string true. If the
7082: argument is omitted, it defaults to a node-set with the
7083: context node as its only member. """
7084: libxml2mod.xmlXPathStringFunction(self._o, nargs)
7085:
7086: def xpathStringLengthFunction(self, nargs):
7087: """Implement the string-length() XPath function number
7088: string-length(string?) The string-length returns the number
7089: of characters in the string (see [3.6 Strings]). If the
7090: argument is omitted, it defaults to the context node
7091: converted to a string, in other words the value of the
7092: context node. """
7093: libxml2mod.xmlXPathStringLengthFunction(self._o, nargs)
7094:
7095: def xpathSubValues(self):
7096: """Implement the subtraction operation on XPath objects: The
7097: numeric operators convert their operands to numbers as if
7098: by calling the number function. """
7099: libxml2mod.xmlXPathSubValues(self._o)
7100:
7101: def xpathSubstringAfterFunction(self, nargs):
7102: """Implement the substring-after() XPath function string
7103: substring-after(string, string) The substring-after
7104: function returns the substring of the first argument string
7105: that follows the first occurrence of the second argument
7106: string in the first argument string, or the empty stringi
7107: if the first argument string does not contain the second
7108: argument string. For example,
7109: substring-after("1999/04/01","/") returns 04/01, and
7110: substring-after("1999/04/01","19") returns 99/04/01. """
7111: libxml2mod.xmlXPathSubstringAfterFunction(self._o, nargs)
7112:
7113: def xpathSubstringBeforeFunction(self, nargs):
7114: """Implement the substring-before() XPath function string
7115: substring-before(string, string) The substring-before
7116: function returns the substring of the first argument string
7117: that precedes the first occurrence of the second argument
7118: string in the first argument string, or the empty string if
7119: the first argument string does not contain the second
7120: argument string. For example,
7121: substring-before("1999/04/01","/") returns 1999. """
7122: libxml2mod.xmlXPathSubstringBeforeFunction(self._o, nargs)
7123:
7124: def xpathSubstringFunction(self, nargs):
7125: """Implement the substring() XPath function string
7126: substring(string, number, number?) The substring function
7127: returns the substring of the first argument starting at the
7128: position specified in the second argument with length
7129: specified in the third argument. For example,
7130: substring("12345",2,3) returns "234". If the third argument
7131: is not specified, it returns the substring starting at the
7132: position specified in the second argument and continuing to
7133: the end of the string. For example, substring("12345",2)
7134: returns "2345". More precisely, each character in the
7135: string (see [3.6 Strings]) is considered to have a numeric
7136: position: the position of the first character is 1, the
7137: position of the second character is 2 and so on. The
7138: returned substring contains those characters for which the
7139: position of the character is greater than or equal to the
7140: second argument and, if the third argument is specified,
7141: less than the sum of the second and third arguments; the
7142: comparisons and addition used for the above follow the
7143: standard IEEE 754 rules. Thus: - substring("12345", 1.5,
7144: 2.6) returns "234" - substring("12345", 0, 3) returns "12"
7145: - substring("12345", 0 div 0, 3) returns "" -
7146: substring("12345", 1, 0 div 0) returns "" -
7147: substring("12345", -42, 1 div 0) returns "12345" -
7148: substring("12345", -1 div 0, 1 div 0) returns "" """
7149: libxml2mod.xmlXPathSubstringFunction(self._o, nargs)
7150:
7151: def xpathSumFunction(self, nargs):
7152: """Implement the sum() XPath function number sum(node-set) The
7153: sum function returns the sum of the values of the nodes in
7154: the argument node-set. """
7155: libxml2mod.xmlXPathSumFunction(self._o, nargs)
7156:
7157: def xpathTranslateFunction(self, nargs):
7158: """Implement the translate() XPath function string
7159: translate(string, string, string) The translate function
7160: returns the first argument string with occurrences of
7161: characters in the second argument string replaced by the
7162: character at the corresponding position in the third
7163: argument string. For example, translate("bar","abc","ABC")
7164: returns the string BAr. If there is a character in the
7165: second argument string with no character at a corresponding
7166: position in the third argument string (because the second
7167: argument string is longer than the third argument string),
7168: then occurrences of that character in the first argument
7169: string are removed. For example,
7170: translate("--aaa--","abc-","ABC") """
7171: libxml2mod.xmlXPathTranslateFunction(self._o, nargs)
7172:
7173: def xpathTrueFunction(self, nargs):
7174: """Implement the true() XPath function boolean true() """
7175: libxml2mod.xmlXPathTrueFunction(self._o, nargs)
7176:
7177: def xpathValueFlipSign(self):
7178: """Implement the unary - operation on an XPath object The
7179: numeric operators convert their operands to numbers as if
7180: by calling the number function. """
7181: libxml2mod.xmlXPathValueFlipSign(self._o)
7182:
7183: def xpatherror(self, file, line, no):
7184: """Formats an error message. """
7185: libxml2mod.xmlXPatherror(self._o, file, line, no)
7186:
7187: #
7188: # xpathParserContext functions from module xpointer
7189: #
7190:
7191: def xpointerEvalRangePredicate(self):
7192: """[8] Predicate ::= '[' PredicateExpr ']' [9]
7193: PredicateExpr ::= Expr Evaluate a predicate as in
7194: xmlXPathEvalPredicate() but for a Location Set instead of a
7195: node set """
7196: libxml2mod.xmlXPtrEvalRangePredicate(self._o)
7197:
7198: def xpointerRangeToFunction(self, nargs):
7199: """Implement the range-to() XPointer function """
7200: libxml2mod.xmlXPtrRangeToFunction(self._o, nargs)
7201:
7202: # xlinkShow
7203: XLINK_SHOW_NONE = 0
7204: XLINK_SHOW_NEW = 1
7205: XLINK_SHOW_EMBED = 2
7206: XLINK_SHOW_REPLACE = 3
7207:
7208: # xmlRelaxNGParserFlag
7209: XML_RELAXNGP_NONE = 0
7210: XML_RELAXNGP_FREE_DOC = 1
7211: XML_RELAXNGP_CRNG = 2
7212:
7213: # xmlBufferAllocationScheme
7214: XML_BUFFER_ALLOC_DOUBLEIT = 1
7215: XML_BUFFER_ALLOC_EXACT = 2
7216: XML_BUFFER_ALLOC_IMMUTABLE = 3
7217: XML_BUFFER_ALLOC_IO = 4
7218: XML_BUFFER_ALLOC_HYBRID = 5
7219:
7220: # xmlParserSeverities
7221: XML_PARSER_SEVERITY_VALIDITY_WARNING = 1
7222: XML_PARSER_SEVERITY_VALIDITY_ERROR = 2
7223: XML_PARSER_SEVERITY_WARNING = 3
7224: XML_PARSER_SEVERITY_ERROR = 4
7225:
7226: # xmlAttributeDefault
7227: XML_ATTRIBUTE_NONE = 1
7228: XML_ATTRIBUTE_REQUIRED = 2
7229: XML_ATTRIBUTE_IMPLIED = 3
7230: XML_ATTRIBUTE_FIXED = 4
7231:
7232: # xmlSchemaValType
7233: XML_SCHEMAS_UNKNOWN = 0
7234: XML_SCHEMAS_STRING = 1
7235: XML_SCHEMAS_NORMSTRING = 2
7236: XML_SCHEMAS_DECIMAL = 3
7237: XML_SCHEMAS_TIME = 4
7238: XML_SCHEMAS_GDAY = 5
7239: XML_SCHEMAS_GMONTH = 6
7240: XML_SCHEMAS_GMONTHDAY = 7
7241: XML_SCHEMAS_GYEAR = 8
7242: XML_SCHEMAS_GYEARMONTH = 9
7243: XML_SCHEMAS_DATE = 10
7244: XML_SCHEMAS_DATETIME = 11
7245: XML_SCHEMAS_DURATION = 12
7246: XML_SCHEMAS_FLOAT = 13
7247: XML_SCHEMAS_DOUBLE = 14
7248: XML_SCHEMAS_BOOLEAN = 15
7249: XML_SCHEMAS_TOKEN = 16
7250: XML_SCHEMAS_LANGUAGE = 17
7251: XML_SCHEMAS_NMTOKEN = 18
7252: XML_SCHEMAS_NMTOKENS = 19
7253: XML_SCHEMAS_NAME = 20
7254: XML_SCHEMAS_QNAME = 21
7255: XML_SCHEMAS_NCNAME = 22
7256: XML_SCHEMAS_ID = 23
7257: XML_SCHEMAS_IDREF = 24
7258: XML_SCHEMAS_IDREFS = 25
7259: XML_SCHEMAS_ENTITY = 26
7260: XML_SCHEMAS_ENTITIES = 27
7261: XML_SCHEMAS_NOTATION = 28
7262: XML_SCHEMAS_ANYURI = 29
7263: XML_SCHEMAS_INTEGER = 30
7264: XML_SCHEMAS_NPINTEGER = 31
7265: XML_SCHEMAS_NINTEGER = 32
7266: XML_SCHEMAS_NNINTEGER = 33
7267: XML_SCHEMAS_PINTEGER = 34
7268: XML_SCHEMAS_INT = 35
7269: XML_SCHEMAS_UINT = 36
7270: XML_SCHEMAS_LONG = 37
7271: XML_SCHEMAS_ULONG = 38
7272: XML_SCHEMAS_SHORT = 39
7273: XML_SCHEMAS_USHORT = 40
7274: XML_SCHEMAS_BYTE = 41
7275: XML_SCHEMAS_UBYTE = 42
7276: XML_SCHEMAS_HEXBINARY = 43
7277: XML_SCHEMAS_BASE64BINARY = 44
7278: XML_SCHEMAS_ANYTYPE = 45
7279: XML_SCHEMAS_ANYSIMPLETYPE = 46
7280:
7281: # xmlParserInputState
7282: XML_PARSER_EOF = -1
7283: XML_PARSER_START = 0
7284: XML_PARSER_MISC = 1
7285: XML_PARSER_PI = 2
7286: XML_PARSER_DTD = 3
7287: XML_PARSER_PROLOG = 4
7288: XML_PARSER_COMMENT = 5
7289: XML_PARSER_START_TAG = 6
7290: XML_PARSER_CONTENT = 7
7291: XML_PARSER_CDATA_SECTION = 8
7292: XML_PARSER_END_TAG = 9
7293: XML_PARSER_ENTITY_DECL = 10
7294: XML_PARSER_ENTITY_VALUE = 11
7295: XML_PARSER_ATTRIBUTE_VALUE = 12
7296: XML_PARSER_SYSTEM_LITERAL = 13
7297: XML_PARSER_EPILOG = 14
7298: XML_PARSER_IGNORE = 15
7299: XML_PARSER_PUBLIC_LITERAL = 16
7300:
7301: # xmlEntityType
7302: XML_INTERNAL_GENERAL_ENTITY = 1
7303: XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2
7304: XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3
7305: XML_INTERNAL_PARAMETER_ENTITY = 4
7306: XML_EXTERNAL_PARAMETER_ENTITY = 5
7307: XML_INTERNAL_PREDEFINED_ENTITY = 6
7308:
7309: # xmlSaveOption
7310: XML_SAVE_FORMAT = 1
7311: XML_SAVE_NO_DECL = 2
7312: XML_SAVE_NO_EMPTY = 4
7313: XML_SAVE_NO_XHTML = 8
7314: XML_SAVE_XHTML = 16
7315: XML_SAVE_AS_XML = 32
7316: XML_SAVE_AS_HTML = 64
7317: XML_SAVE_WSNONSIG = 128
7318:
7319: # xmlPatternFlags
7320: XML_PATTERN_DEFAULT = 0
7321: XML_PATTERN_XPATH = 1
7322: XML_PATTERN_XSSEL = 2
7323: XML_PATTERN_XSFIELD = 4
7324:
7325: # xmlParserErrors
7326: XML_ERR_OK = 0
7327: XML_ERR_INTERNAL_ERROR = 1
7328: XML_ERR_NO_MEMORY = 2
7329: XML_ERR_DOCUMENT_START = 3
7330: XML_ERR_DOCUMENT_EMPTY = 4
7331: XML_ERR_DOCUMENT_END = 5
7332: XML_ERR_INVALID_HEX_CHARREF = 6
7333: XML_ERR_INVALID_DEC_CHARREF = 7
7334: XML_ERR_INVALID_CHARREF = 8
7335: XML_ERR_INVALID_CHAR = 9
7336: XML_ERR_CHARREF_AT_EOF = 10
7337: XML_ERR_CHARREF_IN_PROLOG = 11
7338: XML_ERR_CHARREF_IN_EPILOG = 12
7339: XML_ERR_CHARREF_IN_DTD = 13
7340: XML_ERR_ENTITYREF_AT_EOF = 14
7341: XML_ERR_ENTITYREF_IN_PROLOG = 15
7342: XML_ERR_ENTITYREF_IN_EPILOG = 16
7343: XML_ERR_ENTITYREF_IN_DTD = 17
7344: XML_ERR_PEREF_AT_EOF = 18
7345: XML_ERR_PEREF_IN_PROLOG = 19
7346: XML_ERR_PEREF_IN_EPILOG = 20
7347: XML_ERR_PEREF_IN_INT_SUBSET = 21
7348: XML_ERR_ENTITYREF_NO_NAME = 22
7349: XML_ERR_ENTITYREF_SEMICOL_MISSING = 23
7350: XML_ERR_PEREF_NO_NAME = 24
7351: XML_ERR_PEREF_SEMICOL_MISSING = 25
7352: XML_ERR_UNDECLARED_ENTITY = 26
7353: XML_WAR_UNDECLARED_ENTITY = 27
7354: XML_ERR_UNPARSED_ENTITY = 28
7355: XML_ERR_ENTITY_IS_EXTERNAL = 29
7356: XML_ERR_ENTITY_IS_PARAMETER = 30
7357: XML_ERR_UNKNOWN_ENCODING = 31
7358: XML_ERR_UNSUPPORTED_ENCODING = 32
7359: XML_ERR_STRING_NOT_STARTED = 33
7360: XML_ERR_STRING_NOT_CLOSED = 34
7361: XML_ERR_NS_DECL_ERROR = 35
7362: XML_ERR_ENTITY_NOT_STARTED = 36
7363: XML_ERR_ENTITY_NOT_FINISHED = 37
7364: XML_ERR_LT_IN_ATTRIBUTE = 38
7365: XML_ERR_ATTRIBUTE_NOT_STARTED = 39
7366: XML_ERR_ATTRIBUTE_NOT_FINISHED = 40
7367: XML_ERR_ATTRIBUTE_WITHOUT_VALUE = 41
7368: XML_ERR_ATTRIBUTE_REDEFINED = 42
7369: XML_ERR_LITERAL_NOT_STARTED = 43
7370: XML_ERR_LITERAL_NOT_FINISHED = 44
7371: XML_ERR_COMMENT_NOT_FINISHED = 45
7372: XML_ERR_PI_NOT_STARTED = 46
7373: XML_ERR_PI_NOT_FINISHED = 47
7374: XML_ERR_NOTATION_NOT_STARTED = 48
7375: XML_ERR_NOTATION_NOT_FINISHED = 49
7376: XML_ERR_ATTLIST_NOT_STARTED = 50
7377: XML_ERR_ATTLIST_NOT_FINISHED = 51
7378: XML_ERR_MIXED_NOT_STARTED = 52
7379: XML_ERR_MIXED_NOT_FINISHED = 53
7380: XML_ERR_ELEMCONTENT_NOT_STARTED = 54
7381: XML_ERR_ELEMCONTENT_NOT_FINISHED = 55
7382: XML_ERR_XMLDECL_NOT_STARTED = 56
7383: XML_ERR_XMLDECL_NOT_FINISHED = 57
7384: XML_ERR_CONDSEC_NOT_STARTED = 58
7385: XML_ERR_CONDSEC_NOT_FINISHED = 59
7386: XML_ERR_EXT_SUBSET_NOT_FINISHED = 60
7387: XML_ERR_DOCTYPE_NOT_FINISHED = 61
7388: XML_ERR_MISPLACED_CDATA_END = 62
7389: XML_ERR_CDATA_NOT_FINISHED = 63
7390: XML_ERR_RESERVED_XML_NAME = 64
7391: XML_ERR_SPACE_REQUIRED = 65
7392: XML_ERR_SEPARATOR_REQUIRED = 66
7393: XML_ERR_NMTOKEN_REQUIRED = 67
7394: XML_ERR_NAME_REQUIRED = 68
7395: XML_ERR_PCDATA_REQUIRED = 69
7396: XML_ERR_URI_REQUIRED = 70
7397: XML_ERR_PUBID_REQUIRED = 71
7398: XML_ERR_LT_REQUIRED = 72
7399: XML_ERR_GT_REQUIRED = 73
7400: XML_ERR_LTSLASH_REQUIRED = 74
7401: XML_ERR_EQUAL_REQUIRED = 75
7402: XML_ERR_TAG_NAME_MISMATCH = 76
7403: XML_ERR_TAG_NOT_FINISHED = 77
7404: XML_ERR_STANDALONE_VALUE = 78
7405: XML_ERR_ENCODING_NAME = 79
7406: XML_ERR_HYPHEN_IN_COMMENT = 80
7407: XML_ERR_INVALID_ENCODING = 81
7408: XML_ERR_EXT_ENTITY_STANDALONE = 82
7409: XML_ERR_CONDSEC_INVALID = 83
7410: XML_ERR_VALUE_REQUIRED = 84
7411: XML_ERR_NOT_WELL_BALANCED = 85
7412: XML_ERR_EXTRA_CONTENT = 86
7413: XML_ERR_ENTITY_CHAR_ERROR = 87
7414: XML_ERR_ENTITY_PE_INTERNAL = 88
7415: XML_ERR_ENTITY_LOOP = 89
7416: XML_ERR_ENTITY_BOUNDARY = 90
7417: XML_ERR_INVALID_URI = 91
7418: XML_ERR_URI_FRAGMENT = 92
7419: XML_WAR_CATALOG_PI = 93
7420: XML_ERR_NO_DTD = 94
7421: XML_ERR_CONDSEC_INVALID_KEYWORD = 95
7422: XML_ERR_VERSION_MISSING = 96
7423: XML_WAR_UNKNOWN_VERSION = 97
7424: XML_WAR_LANG_VALUE = 98
7425: XML_WAR_NS_URI = 99
7426: XML_WAR_NS_URI_RELATIVE = 100
7427: XML_ERR_MISSING_ENCODING = 101
7428: XML_WAR_SPACE_VALUE = 102
7429: XML_ERR_NOT_STANDALONE = 103
7430: XML_ERR_ENTITY_PROCESSING = 104
7431: XML_ERR_NOTATION_PROCESSING = 105
7432: XML_WAR_NS_COLUMN = 106
7433: XML_WAR_ENTITY_REDEFINED = 107
7434: XML_ERR_UNKNOWN_VERSION = 108
7435: XML_ERR_VERSION_MISMATCH = 109
7436: XML_ERR_NAME_TOO_LONG = 110
7437: XML_ERR_USER_STOP = 111
7438: XML_NS_ERR_XML_NAMESPACE = 200
7439: XML_NS_ERR_UNDEFINED_NAMESPACE = 201
7440: XML_NS_ERR_QNAME = 202
7441: XML_NS_ERR_ATTRIBUTE_REDEFINED = 203
7442: XML_NS_ERR_EMPTY = 204
7443: XML_NS_ERR_COLON = 205
7444: XML_DTD_ATTRIBUTE_DEFAULT = 500
7445: XML_DTD_ATTRIBUTE_REDEFINED = 501
7446: XML_DTD_ATTRIBUTE_VALUE = 502
7447: XML_DTD_CONTENT_ERROR = 503
7448: XML_DTD_CONTENT_MODEL = 504
7449: XML_DTD_CONTENT_NOT_DETERMINIST = 505
7450: XML_DTD_DIFFERENT_PREFIX = 506
7451: XML_DTD_ELEM_DEFAULT_NAMESPACE = 507
7452: XML_DTD_ELEM_NAMESPACE = 508
7453: XML_DTD_ELEM_REDEFINED = 509
7454: XML_DTD_EMPTY_NOTATION = 510
7455: XML_DTD_ENTITY_TYPE = 511
7456: XML_DTD_ID_FIXED = 512
7457: XML_DTD_ID_REDEFINED = 513
7458: XML_DTD_ID_SUBSET = 514
7459: XML_DTD_INVALID_CHILD = 515
7460: XML_DTD_INVALID_DEFAULT = 516
7461: XML_DTD_LOAD_ERROR = 517
7462: XML_DTD_MISSING_ATTRIBUTE = 518
7463: XML_DTD_MIXED_CORRUPT = 519
7464: XML_DTD_MULTIPLE_ID = 520
7465: XML_DTD_NO_DOC = 521
7466: XML_DTD_NO_DTD = 522
7467: XML_DTD_NO_ELEM_NAME = 523
7468: XML_DTD_NO_PREFIX = 524
7469: XML_DTD_NO_ROOT = 525
7470: XML_DTD_NOTATION_REDEFINED = 526
7471: XML_DTD_NOTATION_VALUE = 527
7472: XML_DTD_NOT_EMPTY = 528
7473: XML_DTD_NOT_PCDATA = 529
7474: XML_DTD_NOT_STANDALONE = 530
7475: XML_DTD_ROOT_NAME = 531
7476: XML_DTD_STANDALONE_WHITE_SPACE = 532
7477: XML_DTD_UNKNOWN_ATTRIBUTE = 533
7478: XML_DTD_UNKNOWN_ELEM = 534
7479: XML_DTD_UNKNOWN_ENTITY = 535
7480: XML_DTD_UNKNOWN_ID = 536
7481: XML_DTD_UNKNOWN_NOTATION = 537
7482: XML_DTD_STANDALONE_DEFAULTED = 538
7483: XML_DTD_XMLID_VALUE = 539
7484: XML_DTD_XMLID_TYPE = 540
7485: XML_DTD_DUP_TOKEN = 541
7486: XML_HTML_STRUCURE_ERROR = 800
7487: XML_HTML_UNKNOWN_TAG = 801
7488: XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000
7489: XML_RNGP_ATTR_CONFLICT = 1001
7490: XML_RNGP_ATTRIBUTE_CHILDREN = 1002
7491: XML_RNGP_ATTRIBUTE_CONTENT = 1003
7492: XML_RNGP_ATTRIBUTE_EMPTY = 1004
7493: XML_RNGP_ATTRIBUTE_NOOP = 1005
7494: XML_RNGP_CHOICE_CONTENT = 1006
7495: XML_RNGP_CHOICE_EMPTY = 1007
7496: XML_RNGP_CREATE_FAILURE = 1008
7497: XML_RNGP_DATA_CONTENT = 1009
7498: XML_RNGP_DEF_CHOICE_AND_INTERLEAVE = 1010
7499: XML_RNGP_DEFINE_CREATE_FAILED = 1011
7500: XML_RNGP_DEFINE_EMPTY = 1012
7501: XML_RNGP_DEFINE_MISSING = 1013
7502: XML_RNGP_DEFINE_NAME_MISSING = 1014
7503: XML_RNGP_ELEM_CONTENT_EMPTY = 1015
7504: XML_RNGP_ELEM_CONTENT_ERROR = 1016
7505: XML_RNGP_ELEMENT_EMPTY = 1017
7506: XML_RNGP_ELEMENT_CONTENT = 1018
7507: XML_RNGP_ELEMENT_NAME = 1019
7508: XML_RNGP_ELEMENT_NO_CONTENT = 1020
7509: XML_RNGP_ELEM_TEXT_CONFLICT = 1021
7510: XML_RNGP_EMPTY = 1022
7511: XML_RNGP_EMPTY_CONSTRUCT = 1023
7512: XML_RNGP_EMPTY_CONTENT = 1024
7513: XML_RNGP_EMPTY_NOT_EMPTY = 1025
7514: XML_RNGP_ERROR_TYPE_LIB = 1026
7515: XML_RNGP_EXCEPT_EMPTY = 1027
7516: XML_RNGP_EXCEPT_MISSING = 1028
7517: XML_RNGP_EXCEPT_MULTIPLE = 1029
7518: XML_RNGP_EXCEPT_NO_CONTENT = 1030
7519: XML_RNGP_EXTERNALREF_EMTPY = 1031
7520: XML_RNGP_EXTERNAL_REF_FAILURE = 1032
7521: XML_RNGP_EXTERNALREF_RECURSE = 1033
7522: XML_RNGP_FORBIDDEN_ATTRIBUTE = 1034
7523: XML_RNGP_FOREIGN_ELEMENT = 1035
7524: XML_RNGP_GRAMMAR_CONTENT = 1036
7525: XML_RNGP_GRAMMAR_EMPTY = 1037
7526: XML_RNGP_GRAMMAR_MISSING = 1038
7527: XML_RNGP_GRAMMAR_NO_START = 1039
7528: XML_RNGP_GROUP_ATTR_CONFLICT = 1040
7529: XML_RNGP_HREF_ERROR = 1041
7530: XML_RNGP_INCLUDE_EMPTY = 1042
7531: XML_RNGP_INCLUDE_FAILURE = 1043
7532: XML_RNGP_INCLUDE_RECURSE = 1044
7533: XML_RNGP_INTERLEAVE_ADD = 1045
7534: XML_RNGP_INTERLEAVE_CREATE_FAILED = 1046
7535: XML_RNGP_INTERLEAVE_EMPTY = 1047
7536: XML_RNGP_INTERLEAVE_NO_CONTENT = 1048
7537: XML_RNGP_INVALID_DEFINE_NAME = 1049
7538: XML_RNGP_INVALID_URI = 1050
7539: XML_RNGP_INVALID_VALUE = 1051
7540: XML_RNGP_MISSING_HREF = 1052
7541: XML_RNGP_NAME_MISSING = 1053
7542: XML_RNGP_NEED_COMBINE = 1054
7543: XML_RNGP_NOTALLOWED_NOT_EMPTY = 1055
7544: XML_RNGP_NSNAME_ATTR_ANCESTOR = 1056
7545: XML_RNGP_NSNAME_NO_NS = 1057
7546: XML_RNGP_PARAM_FORBIDDEN = 1058
7547: XML_RNGP_PARAM_NAME_MISSING = 1059
7548: XML_RNGP_PARENTREF_CREATE_FAILED = 1060
7549: XML_RNGP_PARENTREF_NAME_INVALID = 1061
7550: XML_RNGP_PARENTREF_NO_NAME = 1062
7551: XML_RNGP_PARENTREF_NO_PARENT = 1063
7552: XML_RNGP_PARENTREF_NOT_EMPTY = 1064
7553: XML_RNGP_PARSE_ERROR = 1065
7554: XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME = 1066
7555: XML_RNGP_PAT_ATTR_ATTR = 1067
7556: XML_RNGP_PAT_ATTR_ELEM = 1068
7557: XML_RNGP_PAT_DATA_EXCEPT_ATTR = 1069
7558: XML_RNGP_PAT_DATA_EXCEPT_ELEM = 1070
7559: XML_RNGP_PAT_DATA_EXCEPT_EMPTY = 1071
7560: XML_RNGP_PAT_DATA_EXCEPT_GROUP = 1072
7561: XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE = 1073
7562: XML_RNGP_PAT_DATA_EXCEPT_LIST = 1074
7563: XML_RNGP_PAT_DATA_EXCEPT_ONEMORE = 1075
7564: XML_RNGP_PAT_DATA_EXCEPT_REF = 1076
7565: XML_RNGP_PAT_DATA_EXCEPT_TEXT = 1077
7566: XML_RNGP_PAT_LIST_ATTR = 1078
7567: XML_RNGP_PAT_LIST_ELEM = 1079
7568: XML_RNGP_PAT_LIST_INTERLEAVE = 1080
7569: XML_RNGP_PAT_LIST_LIST = 1081
7570: XML_RNGP_PAT_LIST_REF = 1082
7571: XML_RNGP_PAT_LIST_TEXT = 1083
7572: XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME = 1084
7573: XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME = 1085
7574: XML_RNGP_PAT_ONEMORE_GROUP_ATTR = 1086
7575: XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR = 1087
7576: XML_RNGP_PAT_START_ATTR = 1088
7577: XML_RNGP_PAT_START_DATA = 1089
7578: XML_RNGP_PAT_START_EMPTY = 1090
7579: XML_RNGP_PAT_START_GROUP = 1091
7580: XML_RNGP_PAT_START_INTERLEAVE = 1092
7581: XML_RNGP_PAT_START_LIST = 1093
7582: XML_RNGP_PAT_START_ONEMORE = 1094
7583: XML_RNGP_PAT_START_TEXT = 1095
7584: XML_RNGP_PAT_START_VALUE = 1096
7585: XML_RNGP_PREFIX_UNDEFINED = 1097
7586: XML_RNGP_REF_CREATE_FAILED = 1098
7587: XML_RNGP_REF_CYCLE = 1099
7588: XML_RNGP_REF_NAME_INVALID = 1100
7589: XML_RNGP_REF_NO_DEF = 1101
7590: XML_RNGP_REF_NO_NAME = 1102
7591: XML_RNGP_REF_NOT_EMPTY = 1103
7592: XML_RNGP_START_CHOICE_AND_INTERLEAVE = 1104
7593: XML_RNGP_START_CONTENT = 1105
7594: XML_RNGP_START_EMPTY = 1106
7595: XML_RNGP_START_MISSING = 1107
7596: XML_RNGP_TEXT_EXPECTED = 1108
7597: XML_RNGP_TEXT_HAS_CHILD = 1109
7598: XML_RNGP_TYPE_MISSING = 1110
7599: XML_RNGP_TYPE_NOT_FOUND = 1111
7600: XML_RNGP_TYPE_VALUE = 1112
7601: XML_RNGP_UNKNOWN_ATTRIBUTE = 1113
7602: XML_RNGP_UNKNOWN_COMBINE = 1114
7603: XML_RNGP_UNKNOWN_CONSTRUCT = 1115
7604: XML_RNGP_UNKNOWN_TYPE_LIB = 1116
7605: XML_RNGP_URI_FRAGMENT = 1117
7606: XML_RNGP_URI_NOT_ABSOLUTE = 1118
7607: XML_RNGP_VALUE_EMPTY = 1119
7608: XML_RNGP_VALUE_NO_CONTENT = 1120
7609: XML_RNGP_XMLNS_NAME = 1121
7610: XML_RNGP_XML_NS = 1122
7611: XML_XPATH_EXPRESSION_OK = 1200
7612: XML_XPATH_NUMBER_ERROR = 1201
7613: XML_XPATH_UNFINISHED_LITERAL_ERROR = 1202
7614: XML_XPATH_START_LITERAL_ERROR = 1203
7615: XML_XPATH_VARIABLE_REF_ERROR = 1204
7616: XML_XPATH_UNDEF_VARIABLE_ERROR = 1205
7617: XML_XPATH_INVALID_PREDICATE_ERROR = 1206
7618: XML_XPATH_EXPR_ERROR = 1207
7619: XML_XPATH_UNCLOSED_ERROR = 1208
7620: XML_XPATH_UNKNOWN_FUNC_ERROR = 1209
7621: XML_XPATH_INVALID_OPERAND = 1210
7622: XML_XPATH_INVALID_TYPE = 1211
7623: XML_XPATH_INVALID_ARITY = 1212
7624: XML_XPATH_INVALID_CTXT_SIZE = 1213
7625: XML_XPATH_INVALID_CTXT_POSITION = 1214
7626: XML_XPATH_MEMORY_ERROR = 1215
7627: XML_XPTR_SYNTAX_ERROR = 1216
7628: XML_XPTR_RESOURCE_ERROR = 1217
7629: XML_XPTR_SUB_RESOURCE_ERROR = 1218
7630: XML_XPATH_UNDEF_PREFIX_ERROR = 1219
7631: XML_XPATH_ENCODING_ERROR = 1220
7632: XML_XPATH_INVALID_CHAR_ERROR = 1221
7633: XML_TREE_INVALID_HEX = 1300
7634: XML_TREE_INVALID_DEC = 1301
7635: XML_TREE_UNTERMINATED_ENTITY = 1302
7636: XML_TREE_NOT_UTF8 = 1303
7637: XML_SAVE_NOT_UTF8 = 1400
7638: XML_SAVE_CHAR_INVALID = 1401
7639: XML_SAVE_NO_DOCTYPE = 1402
7640: XML_SAVE_UNKNOWN_ENCODING = 1403
7641: XML_REGEXP_COMPILE_ERROR = 1450
7642: XML_IO_UNKNOWN = 1500
7643: XML_IO_EACCES = 1501
7644: XML_IO_EAGAIN = 1502
7645: XML_IO_EBADF = 1503
7646: XML_IO_EBADMSG = 1504
7647: XML_IO_EBUSY = 1505
7648: XML_IO_ECANCELED = 1506
7649: XML_IO_ECHILD = 1507
7650: XML_IO_EDEADLK = 1508
7651: XML_IO_EDOM = 1509
7652: XML_IO_EEXIST = 1510
7653: XML_IO_EFAULT = 1511
7654: XML_IO_EFBIG = 1512
7655: XML_IO_EINPROGRESS = 1513
7656: XML_IO_EINTR = 1514
7657: XML_IO_EINVAL = 1515
7658: XML_IO_EIO = 1516
7659: XML_IO_EISDIR = 1517
7660: XML_IO_EMFILE = 1518
7661: XML_IO_EMLINK = 1519
7662: XML_IO_EMSGSIZE = 1520
7663: XML_IO_ENAMETOOLONG = 1521
7664: XML_IO_ENFILE = 1522
7665: XML_IO_ENODEV = 1523
7666: XML_IO_ENOENT = 1524
7667: XML_IO_ENOEXEC = 1525
7668: XML_IO_ENOLCK = 1526
7669: XML_IO_ENOMEM = 1527
7670: XML_IO_ENOSPC = 1528
7671: XML_IO_ENOSYS = 1529
7672: XML_IO_ENOTDIR = 1530
7673: XML_IO_ENOTEMPTY = 1531
7674: XML_IO_ENOTSUP = 1532
7675: XML_IO_ENOTTY = 1533
7676: XML_IO_ENXIO = 1534
7677: XML_IO_EPERM = 1535
7678: XML_IO_EPIPE = 1536
7679: XML_IO_ERANGE = 1537
7680: XML_IO_EROFS = 1538
7681: XML_IO_ESPIPE = 1539
7682: XML_IO_ESRCH = 1540
7683: XML_IO_ETIMEDOUT = 1541
7684: XML_IO_EXDEV = 1542
7685: XML_IO_NETWORK_ATTEMPT = 1543
7686: XML_IO_ENCODER = 1544
7687: XML_IO_FLUSH = 1545
7688: XML_IO_WRITE = 1546
7689: XML_IO_NO_INPUT = 1547
7690: XML_IO_BUFFER_FULL = 1548
7691: XML_IO_LOAD_ERROR = 1549
7692: XML_IO_ENOTSOCK = 1550
7693: XML_IO_EISCONN = 1551
7694: XML_IO_ECONNREFUSED = 1552
7695: XML_IO_ENETUNREACH = 1553
7696: XML_IO_EADDRINUSE = 1554
7697: XML_IO_EALREADY = 1555
7698: XML_IO_EAFNOSUPPORT = 1556
7699: XML_XINCLUDE_RECURSION = 1600
7700: XML_XINCLUDE_PARSE_VALUE = 1601
7701: XML_XINCLUDE_ENTITY_DEF_MISMATCH = 1602
7702: XML_XINCLUDE_NO_HREF = 1603
7703: XML_XINCLUDE_NO_FALLBACK = 1604
7704: XML_XINCLUDE_HREF_URI = 1605
7705: XML_XINCLUDE_TEXT_FRAGMENT = 1606
7706: XML_XINCLUDE_TEXT_DOCUMENT = 1607
7707: XML_XINCLUDE_INVALID_CHAR = 1608
7708: XML_XINCLUDE_BUILD_FAILED = 1609
7709: XML_XINCLUDE_UNKNOWN_ENCODING = 1610
7710: XML_XINCLUDE_MULTIPLE_ROOT = 1611
7711: XML_XINCLUDE_XPTR_FAILED = 1612
7712: XML_XINCLUDE_XPTR_RESULT = 1613
7713: XML_XINCLUDE_INCLUDE_IN_INCLUDE = 1614
7714: XML_XINCLUDE_FALLBACKS_IN_INCLUDE = 1615
7715: XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE = 1616
7716: XML_XINCLUDE_DEPRECATED_NS = 1617
7717: XML_XINCLUDE_FRAGMENT_ID = 1618
7718: XML_CATALOG_MISSING_ATTR = 1650
7719: XML_CATALOG_ENTRY_BROKEN = 1651
7720: XML_CATALOG_PREFER_VALUE = 1652
7721: XML_CATALOG_NOT_CATALOG = 1653
7722: XML_CATALOG_RECURSION = 1654
7723: XML_SCHEMAP_PREFIX_UNDEFINED = 1700
7724: XML_SCHEMAP_ATTRFORMDEFAULT_VALUE = 1701
7725: XML_SCHEMAP_ATTRGRP_NONAME_NOREF = 1702
7726: XML_SCHEMAP_ATTR_NONAME_NOREF = 1703
7727: XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF = 1704
7728: XML_SCHEMAP_ELEMFORMDEFAULT_VALUE = 1705
7729: XML_SCHEMAP_ELEM_NONAME_NOREF = 1706
7730: XML_SCHEMAP_EXTENSION_NO_BASE = 1707
7731: XML_SCHEMAP_FACET_NO_VALUE = 1708
7732: XML_SCHEMAP_FAILED_BUILD_IMPORT = 1709
7733: XML_SCHEMAP_GROUP_NONAME_NOREF = 1710
7734: XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI = 1711
7735: XML_SCHEMAP_IMPORT_REDEFINE_NSNAME = 1712
7736: XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI = 1713
7737: XML_SCHEMAP_INVALID_BOOLEAN = 1714
7738: XML_SCHEMAP_INVALID_ENUM = 1715
7739: XML_SCHEMAP_INVALID_FACET = 1716
7740: XML_SCHEMAP_INVALID_FACET_VALUE = 1717
7741: XML_SCHEMAP_INVALID_MAXOCCURS = 1718
7742: XML_SCHEMAP_INVALID_MINOCCURS = 1719
7743: XML_SCHEMAP_INVALID_REF_AND_SUBTYPE = 1720
7744: XML_SCHEMAP_INVALID_WHITE_SPACE = 1721
7745: XML_SCHEMAP_NOATTR_NOREF = 1722
7746: XML_SCHEMAP_NOTATION_NO_NAME = 1723
7747: XML_SCHEMAP_NOTYPE_NOREF = 1724
7748: XML_SCHEMAP_REF_AND_SUBTYPE = 1725
7749: XML_SCHEMAP_RESTRICTION_NONAME_NOREF = 1726
7750: XML_SCHEMAP_SIMPLETYPE_NONAME = 1727
7751: XML_SCHEMAP_TYPE_AND_SUBTYPE = 1728
7752: XML_SCHEMAP_UNKNOWN_ALL_CHILD = 1729
7753: XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD = 1730
7754: XML_SCHEMAP_UNKNOWN_ATTR_CHILD = 1731
7755: XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD = 1732
7756: XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP = 1733
7757: XML_SCHEMAP_UNKNOWN_BASE_TYPE = 1734
7758: XML_SCHEMAP_UNKNOWN_CHOICE_CHILD = 1735
7759: XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD = 1736
7760: XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD = 1737
7761: XML_SCHEMAP_UNKNOWN_ELEM_CHILD = 1738
7762: XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD = 1739
7763: XML_SCHEMAP_UNKNOWN_FACET_CHILD = 1740
7764: XML_SCHEMAP_UNKNOWN_FACET_TYPE = 1741
7765: XML_SCHEMAP_UNKNOWN_GROUP_CHILD = 1742
7766: XML_SCHEMAP_UNKNOWN_IMPORT_CHILD = 1743
7767: XML_SCHEMAP_UNKNOWN_LIST_CHILD = 1744
7768: XML_SCHEMAP_UNKNOWN_NOTATION_CHILD = 1745
7769: XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD = 1746
7770: XML_SCHEMAP_UNKNOWN_REF = 1747
7771: XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD = 1748
7772: XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD = 1749
7773: XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD = 1750
7774: XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD = 1751
7775: XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD = 1752
7776: XML_SCHEMAP_UNKNOWN_TYPE = 1753
7777: XML_SCHEMAP_UNKNOWN_UNION_CHILD = 1754
7778: XML_SCHEMAP_ELEM_DEFAULT_FIXED = 1755
7779: XML_SCHEMAP_REGEXP_INVALID = 1756
7780: XML_SCHEMAP_FAILED_LOAD = 1757
7781: XML_SCHEMAP_NOTHING_TO_PARSE = 1758
7782: XML_SCHEMAP_NOROOT = 1759
7783: XML_SCHEMAP_REDEFINED_GROUP = 1760
7784: XML_SCHEMAP_REDEFINED_TYPE = 1761
7785: XML_SCHEMAP_REDEFINED_ELEMENT = 1762
7786: XML_SCHEMAP_REDEFINED_ATTRGROUP = 1763
7787: XML_SCHEMAP_REDEFINED_ATTR = 1764
7788: XML_SCHEMAP_REDEFINED_NOTATION = 1765
7789: XML_SCHEMAP_FAILED_PARSE = 1766
7790: XML_SCHEMAP_UNKNOWN_PREFIX = 1767
7791: XML_SCHEMAP_DEF_AND_PREFIX = 1768
7792: XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD = 1769
7793: XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI = 1770
7794: XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI = 1771
7795: XML_SCHEMAP_NOT_SCHEMA = 1772
7796: XML_SCHEMAP_UNKNOWN_MEMBER_TYPE = 1773
7797: XML_SCHEMAP_INVALID_ATTR_USE = 1774
7798: XML_SCHEMAP_RECURSIVE = 1775
7799: XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE = 1776
7800: XML_SCHEMAP_INVALID_ATTR_COMBINATION = 1777
7801: XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION = 1778
7802: XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD = 1779
7803: XML_SCHEMAP_INVALID_ATTR_NAME = 1780
7804: XML_SCHEMAP_REF_AND_CONTENT = 1781
7805: XML_SCHEMAP_CT_PROPS_CORRECT_1 = 1782
7806: XML_SCHEMAP_CT_PROPS_CORRECT_2 = 1783
7807: XML_SCHEMAP_CT_PROPS_CORRECT_3 = 1784
7808: XML_SCHEMAP_CT_PROPS_CORRECT_4 = 1785
7809: XML_SCHEMAP_CT_PROPS_CORRECT_5 = 1786
7810: XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1 = 1787
7811: XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1 = 1788
7812: XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2 = 1789
7813: XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2 = 1790
7814: XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3 = 1791
7815: XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER = 1792
7816: XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE = 1793
7817: XML_SCHEMAP_UNION_NOT_EXPRESSIBLE = 1794
7818: XML_SCHEMAP_SRC_IMPORT_3_1 = 1795
7819: XML_SCHEMAP_SRC_IMPORT_3_2 = 1796
7820: XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1 = 1797
7821: XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2 = 1798
7822: XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3 = 1799
7823: XML_SCHEMAP_COS_CT_EXTENDS_1_3 = 1800
7824: XML_SCHEMAV_NOROOT = 1801
7825: XML_SCHEMAV_UNDECLAREDELEM = 1802
7826: XML_SCHEMAV_NOTTOPLEVEL = 1803
7827: XML_SCHEMAV_MISSING = 1804
7828: XML_SCHEMAV_WRONGELEM = 1805
7829: XML_SCHEMAV_NOTYPE = 1806
7830: XML_SCHEMAV_NOROLLBACK = 1807
7831: XML_SCHEMAV_ISABSTRACT = 1808
7832: XML_SCHEMAV_NOTEMPTY = 1809
7833: XML_SCHEMAV_ELEMCONT = 1810
7834: XML_SCHEMAV_HAVEDEFAULT = 1811
7835: XML_SCHEMAV_NOTNILLABLE = 1812
7836: XML_SCHEMAV_EXTRACONTENT = 1813
7837: XML_SCHEMAV_INVALIDATTR = 1814
7838: XML_SCHEMAV_INVALIDELEM = 1815
7839: XML_SCHEMAV_NOTDETERMINIST = 1816
7840: XML_SCHEMAV_CONSTRUCT = 1817
7841: XML_SCHEMAV_INTERNAL = 1818
7842: XML_SCHEMAV_NOTSIMPLE = 1819
7843: XML_SCHEMAV_ATTRUNKNOWN = 1820
7844: XML_SCHEMAV_ATTRINVALID = 1821
7845: XML_SCHEMAV_VALUE = 1822
7846: XML_SCHEMAV_FACET = 1823
7847: XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1 = 1824
7848: XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2 = 1825
7849: XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3 = 1826
7850: XML_SCHEMAV_CVC_TYPE_3_1_1 = 1827
7851: XML_SCHEMAV_CVC_TYPE_3_1_2 = 1828
7852: XML_SCHEMAV_CVC_FACET_VALID = 1829
7853: XML_SCHEMAV_CVC_LENGTH_VALID = 1830
7854: XML_SCHEMAV_CVC_MINLENGTH_VALID = 1831
7855: XML_SCHEMAV_CVC_MAXLENGTH_VALID = 1832
7856: XML_SCHEMAV_CVC_MININCLUSIVE_VALID = 1833
7857: XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID = 1834
7858: XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID = 1835
7859: XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID = 1836
7860: XML_SCHEMAV_CVC_TOTALDIGITS_VALID = 1837
7861: XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID = 1838
7862: XML_SCHEMAV_CVC_PATTERN_VALID = 1839
7863: XML_SCHEMAV_CVC_ENUMERATION_VALID = 1840
7864: XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1 = 1841
7865: XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2 = 1842
7866: XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3 = 1843
7867: XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4 = 1844
7868: XML_SCHEMAV_CVC_ELT_1 = 1845
7869: XML_SCHEMAV_CVC_ELT_2 = 1846
7870: XML_SCHEMAV_CVC_ELT_3_1 = 1847
7871: XML_SCHEMAV_CVC_ELT_3_2_1 = 1848
7872: XML_SCHEMAV_CVC_ELT_3_2_2 = 1849
7873: XML_SCHEMAV_CVC_ELT_4_1 = 1850
7874: XML_SCHEMAV_CVC_ELT_4_2 = 1851
7875: XML_SCHEMAV_CVC_ELT_4_3 = 1852
7876: XML_SCHEMAV_CVC_ELT_5_1_1 = 1853
7877: XML_SCHEMAV_CVC_ELT_5_1_2 = 1854
7878: XML_SCHEMAV_CVC_ELT_5_2_1 = 1855
7879: XML_SCHEMAV_CVC_ELT_5_2_2_1 = 1856
7880: XML_SCHEMAV_CVC_ELT_5_2_2_2_1 = 1857
7881: XML_SCHEMAV_CVC_ELT_5_2_2_2_2 = 1858
7882: XML_SCHEMAV_CVC_ELT_6 = 1859
7883: XML_SCHEMAV_CVC_ELT_7 = 1860
7884: XML_SCHEMAV_CVC_ATTRIBUTE_1 = 1861
7885: XML_SCHEMAV_CVC_ATTRIBUTE_2 = 1862
7886: XML_SCHEMAV_CVC_ATTRIBUTE_3 = 1863
7887: XML_SCHEMAV_CVC_ATTRIBUTE_4 = 1864
7888: XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1 = 1865
7889: XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1 = 1866
7890: XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2 = 1867
7891: XML_SCHEMAV_CVC_COMPLEX_TYPE_4 = 1868
7892: XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1 = 1869
7893: XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2 = 1870
7894: XML_SCHEMAV_ELEMENT_CONTENT = 1871
7895: XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING = 1872
7896: XML_SCHEMAV_CVC_COMPLEX_TYPE_1 = 1873
7897: XML_SCHEMAV_CVC_AU = 1874
7898: XML_SCHEMAV_CVC_TYPE_1 = 1875
7899: XML_SCHEMAV_CVC_TYPE_2 = 1876
7900: XML_SCHEMAV_CVC_IDC = 1877
7901: XML_SCHEMAV_CVC_WILDCARD = 1878
7902: XML_SCHEMAV_MISC = 1879
7903: XML_XPTR_UNKNOWN_SCHEME = 1900
7904: XML_XPTR_CHILDSEQ_START = 1901
7905: XML_XPTR_EVAL_FAILED = 1902
7906: XML_XPTR_EXTRA_OBJECTS = 1903
7907: XML_C14N_CREATE_CTXT = 1950
7908: XML_C14N_REQUIRES_UTF8 = 1951
7909: XML_C14N_CREATE_STACK = 1952
7910: XML_C14N_INVALID_NODE = 1953
7911: XML_C14N_UNKNOW_NODE = 1954
7912: XML_C14N_RELATIVE_NAMESPACE = 1955
7913: XML_FTP_PASV_ANSWER = 2000
7914: XML_FTP_EPSV_ANSWER = 2001
7915: XML_FTP_ACCNT = 2002
7916: XML_FTP_URL_SYNTAX = 2003
7917: XML_HTTP_URL_SYNTAX = 2020
7918: XML_HTTP_USE_IP = 2021
7919: XML_HTTP_UNKNOWN_HOST = 2022
7920: XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000
7921: XML_SCHEMAP_SRC_SIMPLE_TYPE_2 = 3001
7922: XML_SCHEMAP_SRC_SIMPLE_TYPE_3 = 3002
7923: XML_SCHEMAP_SRC_SIMPLE_TYPE_4 = 3003
7924: XML_SCHEMAP_SRC_RESOLVE = 3004
7925: XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE = 3005
7926: XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE = 3006
7927: XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES = 3007
7928: XML_SCHEMAP_ST_PROPS_CORRECT_1 = 3008
7929: XML_SCHEMAP_ST_PROPS_CORRECT_2 = 3009
7930: XML_SCHEMAP_ST_PROPS_CORRECT_3 = 3010
7931: XML_SCHEMAP_COS_ST_RESTRICTS_1_1 = 3011
7932: XML_SCHEMAP_COS_ST_RESTRICTS_1_2 = 3012
7933: XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1 = 3013
7934: XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2 = 3014
7935: XML_SCHEMAP_COS_ST_RESTRICTS_2_1 = 3015
7936: XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1 = 3016
7937: XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2 = 3017
7938: XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1 = 3018
7939: XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2 = 3019
7940: XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3 = 3020
7941: XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4 = 3021
7942: XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5 = 3022
7943: XML_SCHEMAP_COS_ST_RESTRICTS_3_1 = 3023
7944: XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1 = 3024
7945: XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2 = 3025
7946: XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2 = 3026
7947: XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1 = 3027
7948: XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3 = 3028
7949: XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4 = 3029
7950: XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5 = 3030
7951: XML_SCHEMAP_COS_ST_DERIVED_OK_2_1 = 3031
7952: XML_SCHEMAP_COS_ST_DERIVED_OK_2_2 = 3032
7953: XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED = 3033
7954: XML_SCHEMAP_S4S_ELEM_MISSING = 3034
7955: XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED = 3035
7956: XML_SCHEMAP_S4S_ATTR_MISSING = 3036
7957: XML_SCHEMAP_S4S_ATTR_INVALID_VALUE = 3037
7958: XML_SCHEMAP_SRC_ELEMENT_1 = 3038
7959: XML_SCHEMAP_SRC_ELEMENT_2_1 = 3039
7960: XML_SCHEMAP_SRC_ELEMENT_2_2 = 3040
7961: XML_SCHEMAP_SRC_ELEMENT_3 = 3041
7962: XML_SCHEMAP_P_PROPS_CORRECT_1 = 3042
7963: XML_SCHEMAP_P_PROPS_CORRECT_2_1 = 3043
7964: XML_SCHEMAP_P_PROPS_CORRECT_2_2 = 3044
7965: XML_SCHEMAP_E_PROPS_CORRECT_2 = 3045
7966: XML_SCHEMAP_E_PROPS_CORRECT_3 = 3046
7967: XML_SCHEMAP_E_PROPS_CORRECT_4 = 3047
7968: XML_SCHEMAP_E_PROPS_CORRECT_5 = 3048
7969: XML_SCHEMAP_E_PROPS_CORRECT_6 = 3049
7970: XML_SCHEMAP_SRC_INCLUDE = 3050
7971: XML_SCHEMAP_SRC_ATTRIBUTE_1 = 3051
7972: XML_SCHEMAP_SRC_ATTRIBUTE_2 = 3052
7973: XML_SCHEMAP_SRC_ATTRIBUTE_3_1 = 3053
7974: XML_SCHEMAP_SRC_ATTRIBUTE_3_2 = 3054
7975: XML_SCHEMAP_SRC_ATTRIBUTE_4 = 3055
7976: XML_SCHEMAP_NO_XMLNS = 3056
7977: XML_SCHEMAP_NO_XSI = 3057
7978: XML_SCHEMAP_COS_VALID_DEFAULT_1 = 3058
7979: XML_SCHEMAP_COS_VALID_DEFAULT_2_1 = 3059
7980: XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1 = 3060
7981: XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2 = 3061
7982: XML_SCHEMAP_CVC_SIMPLE_TYPE = 3062
7983: XML_SCHEMAP_COS_CT_EXTENDS_1_1 = 3063
7984: XML_SCHEMAP_SRC_IMPORT_1_1 = 3064
7985: XML_SCHEMAP_SRC_IMPORT_1_2 = 3065
7986: XML_SCHEMAP_SRC_IMPORT_2 = 3066
7987: XML_SCHEMAP_SRC_IMPORT_2_1 = 3067
7988: XML_SCHEMAP_SRC_IMPORT_2_2 = 3068
7989: XML_SCHEMAP_INTERNAL = 3069
7990: XML_SCHEMAP_NOT_DETERMINISTIC = 3070
7991: XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1 = 3071
7992: XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2 = 3072
7993: XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3 = 3073
7994: XML_SCHEMAP_MG_PROPS_CORRECT_1 = 3074
7995: XML_SCHEMAP_MG_PROPS_CORRECT_2 = 3075
7996: XML_SCHEMAP_SRC_CT_1 = 3076
7997: XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3 = 3077
7998: XML_SCHEMAP_AU_PROPS_CORRECT_2 = 3078
7999: XML_SCHEMAP_A_PROPS_CORRECT_2 = 3079
8000: XML_SCHEMAP_C_PROPS_CORRECT = 3080
8001: XML_SCHEMAP_SRC_REDEFINE = 3081
8002: XML_SCHEMAP_SRC_IMPORT = 3082
8003: XML_SCHEMAP_WARN_SKIP_SCHEMA = 3083
8004: XML_SCHEMAP_WARN_UNLOCATED_SCHEMA = 3084
8005: XML_SCHEMAP_WARN_ATTR_REDECL_PROH = 3085
8006: XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH = 3086
8007: XML_SCHEMAP_AG_PROPS_CORRECT = 3087
8008: XML_SCHEMAP_COS_CT_EXTENDS_1_2 = 3088
8009: XML_SCHEMAP_AU_PROPS_CORRECT = 3089
8010: XML_SCHEMAP_A_PROPS_CORRECT_3 = 3090
8011: XML_SCHEMAP_COS_ALL_LIMITED = 3091
8012: XML_SCHEMATRONV_ASSERT = 4000
8013: XML_SCHEMATRONV_REPORT = 4001
8014: XML_MODULE_OPEN = 4900
8015: XML_MODULE_CLOSE = 4901
8016: XML_CHECK_FOUND_ELEMENT = 5000
8017: XML_CHECK_FOUND_ATTRIBUTE = 5001
8018: XML_CHECK_FOUND_TEXT = 5002
8019: XML_CHECK_FOUND_CDATA = 5003
8020: XML_CHECK_FOUND_ENTITYREF = 5004
8021: XML_CHECK_FOUND_ENTITY = 5005
8022: XML_CHECK_FOUND_PI = 5006
8023: XML_CHECK_FOUND_COMMENT = 5007
8024: XML_CHECK_FOUND_DOCTYPE = 5008
8025: XML_CHECK_FOUND_FRAGMENT = 5009
8026: XML_CHECK_FOUND_NOTATION = 5010
8027: XML_CHECK_UNKNOWN_NODE = 5011
8028: XML_CHECK_ENTITY_TYPE = 5012
8029: XML_CHECK_NO_PARENT = 5013
8030: XML_CHECK_NO_DOC = 5014
8031: XML_CHECK_NO_NAME = 5015
8032: XML_CHECK_NO_ELEM = 5016
8033: XML_CHECK_WRONG_DOC = 5017
8034: XML_CHECK_NO_PREV = 5018
8035: XML_CHECK_WRONG_PREV = 5019
8036: XML_CHECK_NO_NEXT = 5020
8037: XML_CHECK_WRONG_NEXT = 5021
8038: XML_CHECK_NOT_DTD = 5022
8039: XML_CHECK_NOT_ATTR = 5023
8040: XML_CHECK_NOT_ATTR_DECL = 5024
8041: XML_CHECK_NOT_ELEM_DECL = 5025
8042: XML_CHECK_NOT_ENTITY_DECL = 5026
8043: XML_CHECK_NOT_NS_DECL = 5027
8044: XML_CHECK_NO_HREF = 5028
8045: XML_CHECK_WRONG_PARENT = 5029
8046: XML_CHECK_NS_SCOPE = 5030
8047: XML_CHECK_NS_ANCESTOR = 5031
8048: XML_CHECK_NOT_UTF8 = 5032
8049: XML_CHECK_NO_DICT = 5033
8050: XML_CHECK_NOT_NCNAME = 5034
8051: XML_CHECK_OUTSIDE_DICT = 5035
8052: XML_CHECK_WRONG_NAME = 5036
8053: XML_CHECK_NAME_NOT_NULL = 5037
8054: XML_I18N_NO_NAME = 6000
8055: XML_I18N_NO_HANDLER = 6001
8056: XML_I18N_EXCESS_HANDLER = 6002
8057: XML_I18N_CONV_FAILED = 6003
8058: XML_I18N_NO_OUTPUT = 6004
8059: XML_BUF_OVERFLOW = 7000
8060:
8061: # xmlExpNodeType
8062: XML_EXP_EMPTY = 0
8063: XML_EXP_FORBID = 1
8064: XML_EXP_ATOM = 2
8065: XML_EXP_SEQ = 3
8066: XML_EXP_OR = 4
8067: XML_EXP_COUNT = 5
8068:
8069: # xmlElementContentType
8070: XML_ELEMENT_CONTENT_PCDATA = 1
8071: XML_ELEMENT_CONTENT_ELEMENT = 2
8072: XML_ELEMENT_CONTENT_SEQ = 3
8073: XML_ELEMENT_CONTENT_OR = 4
8074:
8075: # xmlParserProperties
8076: XML_PARSER_LOADDTD = 1
8077: XML_PARSER_DEFAULTATTRS = 2
8078: XML_PARSER_VALIDATE = 3
8079: XML_PARSER_SUBST_ENTITIES = 4
8080:
8081: # xmlReaderTypes
8082: XML_READER_TYPE_NONE = 0
8083: XML_READER_TYPE_ELEMENT = 1
8084: XML_READER_TYPE_ATTRIBUTE = 2
8085: XML_READER_TYPE_TEXT = 3
8086: XML_READER_TYPE_CDATA = 4
8087: XML_READER_TYPE_ENTITY_REFERENCE = 5
8088: XML_READER_TYPE_ENTITY = 6
8089: XML_READER_TYPE_PROCESSING_INSTRUCTION = 7
8090: XML_READER_TYPE_COMMENT = 8
8091: XML_READER_TYPE_DOCUMENT = 9
8092: XML_READER_TYPE_DOCUMENT_TYPE = 10
8093: XML_READER_TYPE_DOCUMENT_FRAGMENT = 11
8094: XML_READER_TYPE_NOTATION = 12
8095: XML_READER_TYPE_WHITESPACE = 13
8096: XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14
8097: XML_READER_TYPE_END_ELEMENT = 15
8098: XML_READER_TYPE_END_ENTITY = 16
8099: XML_READER_TYPE_XML_DECLARATION = 17
8100:
8101: # xmlCatalogPrefer
8102: XML_CATA_PREFER_NONE = 0
8103: XML_CATA_PREFER_PUBLIC = 1
8104: XML_CATA_PREFER_SYSTEM = 2
8105:
8106: # xmlElementType
8107: XML_ELEMENT_NODE = 1
8108: XML_ATTRIBUTE_NODE = 2
8109: XML_TEXT_NODE = 3
8110: XML_CDATA_SECTION_NODE = 4
8111: XML_ENTITY_REF_NODE = 5
8112: XML_ENTITY_NODE = 6
8113: XML_PI_NODE = 7
8114: XML_COMMENT_NODE = 8
8115: XML_DOCUMENT_NODE = 9
8116: XML_DOCUMENT_TYPE_NODE = 10
8117: XML_DOCUMENT_FRAG_NODE = 11
8118: XML_NOTATION_NODE = 12
8119: XML_HTML_DOCUMENT_NODE = 13
8120: XML_DTD_NODE = 14
8121: XML_ELEMENT_DECL = 15
8122: XML_ATTRIBUTE_DECL = 16
8123: XML_ENTITY_DECL = 17
8124: XML_NAMESPACE_DECL = 18
8125: XML_XINCLUDE_START = 19
8126: XML_XINCLUDE_END = 20
8127: XML_DOCB_DOCUMENT_NODE = 21
8128:
8129: # xlinkActuate
8130: XLINK_ACTUATE_NONE = 0
8131: XLINK_ACTUATE_AUTO = 1
8132: XLINK_ACTUATE_ONREQUEST = 2
8133:
8134: # xmlFeature
8135: XML_WITH_THREAD = 1
8136: XML_WITH_TREE = 2
8137: XML_WITH_OUTPUT = 3
8138: XML_WITH_PUSH = 4
8139: XML_WITH_READER = 5
8140: XML_WITH_PATTERN = 6
8141: XML_WITH_WRITER = 7
8142: XML_WITH_SAX1 = 8
8143: XML_WITH_FTP = 9
8144: XML_WITH_HTTP = 10
8145: XML_WITH_VALID = 11
8146: XML_WITH_HTML = 12
8147: XML_WITH_LEGACY = 13
8148: XML_WITH_C14N = 14
8149: XML_WITH_CATALOG = 15
8150: XML_WITH_XPATH = 16
8151: XML_WITH_XPTR = 17
8152: XML_WITH_XINCLUDE = 18
8153: XML_WITH_ICONV = 19
8154: XML_WITH_ISO8859X = 20
8155: XML_WITH_UNICODE = 21
8156: XML_WITH_REGEXP = 22
8157: XML_WITH_AUTOMATA = 23
8158: XML_WITH_EXPR = 24
8159: XML_WITH_SCHEMAS = 25
8160: XML_WITH_SCHEMATRON = 26
8161: XML_WITH_MODULES = 27
8162: XML_WITH_DEBUG = 28
8163: XML_WITH_DEBUG_MEM = 29
8164: XML_WITH_DEBUG_RUN = 30
8165: XML_WITH_ZLIB = 31
8166: XML_WITH_ICU = 32
8167: XML_WITH_LZMA = 33
8168: XML_WITH_NONE = 99999
8169:
8170: # xmlElementContentOccur
8171: XML_ELEMENT_CONTENT_ONCE = 1
8172: XML_ELEMENT_CONTENT_OPT = 2
8173: XML_ELEMENT_CONTENT_MULT = 3
8174: XML_ELEMENT_CONTENT_PLUS = 4
8175:
8176: # xmlXPathError
8177: XPATH_EXPRESSION_OK = 0
8178: XPATH_NUMBER_ERROR = 1
8179: XPATH_UNFINISHED_LITERAL_ERROR = 2
8180: XPATH_START_LITERAL_ERROR = 3
8181: XPATH_VARIABLE_REF_ERROR = 4
8182: XPATH_UNDEF_VARIABLE_ERROR = 5
8183: XPATH_INVALID_PREDICATE_ERROR = 6
8184: XPATH_EXPR_ERROR = 7
8185: XPATH_UNCLOSED_ERROR = 8
8186: XPATH_UNKNOWN_FUNC_ERROR = 9
8187: XPATH_INVALID_OPERAND = 10
8188: XPATH_INVALID_TYPE = 11
8189: XPATH_INVALID_ARITY = 12
8190: XPATH_INVALID_CTXT_SIZE = 13
8191: XPATH_INVALID_CTXT_POSITION = 14
8192: XPATH_MEMORY_ERROR = 15
8193: XPTR_SYNTAX_ERROR = 16
8194: XPTR_RESOURCE_ERROR = 17
8195: XPTR_SUB_RESOURCE_ERROR = 18
8196: XPATH_UNDEF_PREFIX_ERROR = 19
8197: XPATH_ENCODING_ERROR = 20
8198: XPATH_INVALID_CHAR_ERROR = 21
8199: XPATH_INVALID_CTXT = 22
8200: XPATH_STACK_ERROR = 23
8201: XPATH_FORBID_VARIABLE_ERROR = 24
8202:
8203: # xmlTextReaderMode
8204: XML_TEXTREADER_MODE_INITIAL = 0
8205: XML_TEXTREADER_MODE_INTERACTIVE = 1
8206: XML_TEXTREADER_MODE_ERROR = 2
8207: XML_TEXTREADER_MODE_EOF = 3
8208: XML_TEXTREADER_MODE_CLOSED = 4
8209: XML_TEXTREADER_MODE_READING = 5
8210:
8211: # xmlErrorLevel
8212: XML_ERR_NONE = 0
8213: XML_ERR_WARNING = 1
8214: XML_ERR_ERROR = 2
8215: XML_ERR_FATAL = 3
8216:
8217: # xmlCharEncoding
8218: XML_CHAR_ENCODING_ERROR = -1
8219: XML_CHAR_ENCODING_NONE = 0
8220: XML_CHAR_ENCODING_UTF8 = 1
8221: XML_CHAR_ENCODING_UTF16LE = 2
8222: XML_CHAR_ENCODING_UTF16BE = 3
8223: XML_CHAR_ENCODING_UCS4LE = 4
8224: XML_CHAR_ENCODING_UCS4BE = 5
8225: XML_CHAR_ENCODING_EBCDIC = 6
8226: XML_CHAR_ENCODING_UCS4_2143 = 7
8227: XML_CHAR_ENCODING_UCS4_3412 = 8
8228: XML_CHAR_ENCODING_UCS2 = 9
8229: XML_CHAR_ENCODING_8859_1 = 10
8230: XML_CHAR_ENCODING_8859_2 = 11
8231: XML_CHAR_ENCODING_8859_3 = 12
8232: XML_CHAR_ENCODING_8859_4 = 13
8233: XML_CHAR_ENCODING_8859_5 = 14
8234: XML_CHAR_ENCODING_8859_6 = 15
8235: XML_CHAR_ENCODING_8859_7 = 16
8236: XML_CHAR_ENCODING_8859_8 = 17
8237: XML_CHAR_ENCODING_8859_9 = 18
8238: XML_CHAR_ENCODING_2022_JP = 19
8239: XML_CHAR_ENCODING_SHIFT_JIS = 20
8240: XML_CHAR_ENCODING_EUC_JP = 21
8241: XML_CHAR_ENCODING_ASCII = 22
8242:
8243: # xmlErrorDomain
8244: XML_FROM_NONE = 0
8245: XML_FROM_PARSER = 1
8246: XML_FROM_TREE = 2
8247: XML_FROM_NAMESPACE = 3
8248: XML_FROM_DTD = 4
8249: XML_FROM_HTML = 5
8250: XML_FROM_MEMORY = 6
8251: XML_FROM_OUTPUT = 7
8252: XML_FROM_IO = 8
8253: XML_FROM_FTP = 9
8254: XML_FROM_HTTP = 10
8255: XML_FROM_XINCLUDE = 11
8256: XML_FROM_XPATH = 12
8257: XML_FROM_XPOINTER = 13
8258: XML_FROM_REGEXP = 14
8259: XML_FROM_DATATYPE = 15
8260: XML_FROM_SCHEMASP = 16
8261: XML_FROM_SCHEMASV = 17
8262: XML_FROM_RELAXNGP = 18
8263: XML_FROM_RELAXNGV = 19
8264: XML_FROM_CATALOG = 20
8265: XML_FROM_C14N = 21
8266: XML_FROM_XSLT = 22
8267: XML_FROM_VALID = 23
8268: XML_FROM_CHECK = 24
8269: XML_FROM_WRITER = 25
8270: XML_FROM_MODULE = 26
8271: XML_FROM_I18N = 27
8272: XML_FROM_SCHEMATRONV = 28
8273: XML_FROM_BUFFER = 29
8274: XML_FROM_URI = 30
8275:
8276: # htmlStatus
8277: HTML_NA = 0
8278: HTML_INVALID = 1
8279: HTML_DEPRECATED = 2
8280: HTML_VALID = 4
8281: HTML_REQUIRED = 12
8282:
8283: # xmlSchemaValidOption
8284: XML_SCHEMA_VAL_VC_I_CREATE = 1
8285:
8286: # xmlSchemaWhitespaceValueType
8287: XML_SCHEMA_WHITESPACE_UNKNOWN = 0
8288: XML_SCHEMA_WHITESPACE_PRESERVE = 1
8289: XML_SCHEMA_WHITESPACE_REPLACE = 2
8290: XML_SCHEMA_WHITESPACE_COLLAPSE = 3
8291:
8292: # htmlParserOption
8293: HTML_PARSE_RECOVER = 1
8294: HTML_PARSE_NODEFDTD = 4
8295: HTML_PARSE_NOERROR = 32
8296: HTML_PARSE_NOWARNING = 64
8297: HTML_PARSE_PEDANTIC = 128
8298: HTML_PARSE_NOBLANKS = 256
8299: HTML_PARSE_NONET = 2048
8300: HTML_PARSE_NOIMPLIED = 8192
8301: HTML_PARSE_COMPACT = 65536
8302: HTML_PARSE_IGNORE_ENC = 2097152
8303:
8304: # xmlRelaxNGValidErr
8305: XML_RELAXNG_OK = 0
8306: XML_RELAXNG_ERR_MEMORY = 1
8307: XML_RELAXNG_ERR_TYPE = 2
8308: XML_RELAXNG_ERR_TYPEVAL = 3
8309: XML_RELAXNG_ERR_DUPID = 4
8310: XML_RELAXNG_ERR_TYPECMP = 5
8311: XML_RELAXNG_ERR_NOSTATE = 6
8312: XML_RELAXNG_ERR_NODEFINE = 7
8313: XML_RELAXNG_ERR_LISTEXTRA = 8
8314: XML_RELAXNG_ERR_LISTEMPTY = 9
8315: XML_RELAXNG_ERR_INTERNODATA = 10
8316: XML_RELAXNG_ERR_INTERSEQ = 11
8317: XML_RELAXNG_ERR_INTEREXTRA = 12
8318: XML_RELAXNG_ERR_ELEMNAME = 13
8319: XML_RELAXNG_ERR_ATTRNAME = 14
8320: XML_RELAXNG_ERR_ELEMNONS = 15
8321: XML_RELAXNG_ERR_ATTRNONS = 16
8322: XML_RELAXNG_ERR_ELEMWRONGNS = 17
8323: XML_RELAXNG_ERR_ATTRWRONGNS = 18
8324: XML_RELAXNG_ERR_ELEMEXTRANS = 19
8325: XML_RELAXNG_ERR_ATTREXTRANS = 20
8326: XML_RELAXNG_ERR_ELEMNOTEMPTY = 21
8327: XML_RELAXNG_ERR_NOELEM = 22
8328: XML_RELAXNG_ERR_NOTELEM = 23
8329: XML_RELAXNG_ERR_ATTRVALID = 24
8330: XML_RELAXNG_ERR_CONTENTVALID = 25
8331: XML_RELAXNG_ERR_EXTRACONTENT = 26
8332: XML_RELAXNG_ERR_INVALIDATTR = 27
8333: XML_RELAXNG_ERR_DATAELEM = 28
8334: XML_RELAXNG_ERR_VALELEM = 29
8335: XML_RELAXNG_ERR_LISTELEM = 30
8336: XML_RELAXNG_ERR_DATATYPE = 31
8337: XML_RELAXNG_ERR_VALUE = 32
8338: XML_RELAXNG_ERR_LIST = 33
8339: XML_RELAXNG_ERR_NOGRAMMAR = 34
8340: XML_RELAXNG_ERR_EXTRADATA = 35
8341: XML_RELAXNG_ERR_LACKDATA = 36
8342: XML_RELAXNG_ERR_INTERNAL = 37
8343: XML_RELAXNG_ERR_ELEMWRONG = 38
8344: XML_RELAXNG_ERR_TEXTWRONG = 39
8345:
8346: # xmlCatalogAllow
8347: XML_CATA_ALLOW_NONE = 0
8348: XML_CATA_ALLOW_GLOBAL = 1
8349: XML_CATA_ALLOW_DOCUMENT = 2
8350: XML_CATA_ALLOW_ALL = 3
8351:
8352: # xmlAttributeType
8353: XML_ATTRIBUTE_CDATA = 1
8354: XML_ATTRIBUTE_ID = 2
8355: XML_ATTRIBUTE_IDREF = 3
8356: XML_ATTRIBUTE_IDREFS = 4
8357: XML_ATTRIBUTE_ENTITY = 5
8358: XML_ATTRIBUTE_ENTITIES = 6
8359: XML_ATTRIBUTE_NMTOKEN = 7
8360: XML_ATTRIBUTE_NMTOKENS = 8
8361: XML_ATTRIBUTE_ENUMERATION = 9
8362: XML_ATTRIBUTE_NOTATION = 10
8363:
8364: # xmlSchematronValidOptions
8365: XML_SCHEMATRON_OUT_QUIET = 1
8366: XML_SCHEMATRON_OUT_TEXT = 2
8367: XML_SCHEMATRON_OUT_XML = 4
8368: XML_SCHEMATRON_OUT_ERROR = 8
8369: XML_SCHEMATRON_OUT_FILE = 256
8370: XML_SCHEMATRON_OUT_BUFFER = 512
8371: XML_SCHEMATRON_OUT_IO = 1024
8372:
8373: # xmlSchemaContentType
8374: XML_SCHEMA_CONTENT_UNKNOWN = 0
8375: XML_SCHEMA_CONTENT_EMPTY = 1
8376: XML_SCHEMA_CONTENT_ELEMENTS = 2
8377: XML_SCHEMA_CONTENT_MIXED = 3
8378: XML_SCHEMA_CONTENT_SIMPLE = 4
8379: XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS = 5
8380: XML_SCHEMA_CONTENT_BASIC = 6
8381: XML_SCHEMA_CONTENT_ANY = 7
8382:
8383: # xmlSchemaTypeType
8384: XML_SCHEMA_TYPE_BASIC = 1
8385: XML_SCHEMA_TYPE_ANY = 2
8386: XML_SCHEMA_TYPE_FACET = 3
8387: XML_SCHEMA_TYPE_SIMPLE = 4
8388: XML_SCHEMA_TYPE_COMPLEX = 5
8389: XML_SCHEMA_TYPE_SEQUENCE = 6
8390: XML_SCHEMA_TYPE_CHOICE = 7
8391: XML_SCHEMA_TYPE_ALL = 8
8392: XML_SCHEMA_TYPE_SIMPLE_CONTENT = 9
8393: XML_SCHEMA_TYPE_COMPLEX_CONTENT = 10
8394: XML_SCHEMA_TYPE_UR = 11
8395: XML_SCHEMA_TYPE_RESTRICTION = 12
8396: XML_SCHEMA_TYPE_EXTENSION = 13
8397: XML_SCHEMA_TYPE_ELEMENT = 14
8398: XML_SCHEMA_TYPE_ATTRIBUTE = 15
8399: XML_SCHEMA_TYPE_ATTRIBUTEGROUP = 16
8400: XML_SCHEMA_TYPE_GROUP = 17
8401: XML_SCHEMA_TYPE_NOTATION = 18
8402: XML_SCHEMA_TYPE_LIST = 19
8403: XML_SCHEMA_TYPE_UNION = 20
8404: XML_SCHEMA_TYPE_ANY_ATTRIBUTE = 21
8405: XML_SCHEMA_TYPE_IDC_UNIQUE = 22
8406: XML_SCHEMA_TYPE_IDC_KEY = 23
8407: XML_SCHEMA_TYPE_IDC_KEYREF = 24
8408: XML_SCHEMA_TYPE_PARTICLE = 25
8409: XML_SCHEMA_TYPE_ATTRIBUTE_USE = 26
8410: XML_SCHEMA_FACET_MININCLUSIVE = 1000
8411: XML_SCHEMA_FACET_MINEXCLUSIVE = 1001
8412: XML_SCHEMA_FACET_MAXINCLUSIVE = 1002
8413: XML_SCHEMA_FACET_MAXEXCLUSIVE = 1003
8414: XML_SCHEMA_FACET_TOTALDIGITS = 1004
8415: XML_SCHEMA_FACET_FRACTIONDIGITS = 1005
8416: XML_SCHEMA_FACET_PATTERN = 1006
8417: XML_SCHEMA_FACET_ENUMERATION = 1007
8418: XML_SCHEMA_FACET_WHITESPACE = 1008
8419: XML_SCHEMA_FACET_LENGTH = 1009
8420: XML_SCHEMA_FACET_MAXLENGTH = 1010
8421: XML_SCHEMA_FACET_MINLENGTH = 1011
8422: XML_SCHEMA_EXTRA_QNAMEREF = 2000
8423: XML_SCHEMA_EXTRA_ATTR_USE_PROHIB = 2001
8424:
8425: # xmlModuleOption
8426: XML_MODULE_LAZY = 1
8427: XML_MODULE_LOCAL = 2
8428:
8429: # xmlParserMode
8430: XML_PARSE_UNKNOWN = 0
8431: XML_PARSE_DOM = 1
8432: XML_PARSE_SAX = 2
8433: XML_PARSE_PUSH_DOM = 3
8434: XML_PARSE_PUSH_SAX = 4
8435: XML_PARSE_READER = 5
8436:
8437: # xmlC14NMode
8438: XML_C14N_1_0 = 0
8439: XML_C14N_EXCLUSIVE_1_0 = 1
8440: XML_C14N_1_1 = 2
8441:
8442: # xmlParserOption
8443: XML_PARSE_RECOVER = 1
8444: XML_PARSE_NOENT = 2
8445: XML_PARSE_DTDLOAD = 4
8446: XML_PARSE_DTDATTR = 8
8447: XML_PARSE_DTDVALID = 16
8448: XML_PARSE_NOERROR = 32
8449: XML_PARSE_NOWARNING = 64
8450: XML_PARSE_PEDANTIC = 128
8451: XML_PARSE_NOBLANKS = 256
8452: XML_PARSE_SAX1 = 512
8453: XML_PARSE_XINCLUDE = 1024
8454: XML_PARSE_NONET = 2048
8455: XML_PARSE_NODICT = 4096
8456: XML_PARSE_NSCLEAN = 8192
8457: XML_PARSE_NOCDATA = 16384
8458: XML_PARSE_NOXINCNODE = 32768
8459: XML_PARSE_COMPACT = 65536
8460: XML_PARSE_OLD10 = 131072
8461: XML_PARSE_NOBASEFIX = 262144
8462: XML_PARSE_HUGE = 524288
8463: XML_PARSE_OLDSAX = 1048576
8464: XML_PARSE_IGNORE_ENC = 2097152
8465: XML_PARSE_BIG_LINES = 4194304
8466:
8467: # xmlElementTypeVal
8468: XML_ELEMENT_TYPE_UNDEFINED = 0
8469: XML_ELEMENT_TYPE_EMPTY = 1
8470: XML_ELEMENT_TYPE_ANY = 2
8471: XML_ELEMENT_TYPE_MIXED = 3
8472: XML_ELEMENT_TYPE_ELEMENT = 4
8473:
8474: # xmlDocProperties
8475: XML_DOC_WELLFORMED = 1
8476: XML_DOC_NSVALID = 2
8477: XML_DOC_OLD10 = 4
8478: XML_DOC_DTDVALID = 8
8479: XML_DOC_XINCLUDE = 16
8480: XML_DOC_USERBUILT = 32
8481: XML_DOC_INTERNAL = 64
8482: XML_DOC_HTML = 128
8483:
8484: # xlinkType
8485: XLINK_TYPE_NONE = 0
8486: XLINK_TYPE_SIMPLE = 1
8487: XLINK_TYPE_EXTENDED = 2
8488: XLINK_TYPE_EXTENDED_SET = 3
8489:
8490: # xmlXPathObjectType
8491: XPATH_UNDEFINED = 0
8492: XPATH_NODESET = 1
8493: XPATH_BOOLEAN = 2
8494: XPATH_NUMBER = 3
8495: XPATH_STRING = 4
8496: XPATH_POINT = 5
8497: XPATH_RANGE = 6
8498: XPATH_LOCATIONSET = 7
8499: XPATH_USERS = 8
8500: XPATH_XSLT_TREE = 9
8501:
8502: # xmlSchemaValidError
8503: XML_SCHEMAS_ERR_OK = 0
8504: XML_SCHEMAS_ERR_NOROOT = 1
8505: XML_SCHEMAS_ERR_UNDECLAREDELEM = 2
8506: XML_SCHEMAS_ERR_NOTTOPLEVEL = 3
8507: XML_SCHEMAS_ERR_MISSING = 4
8508: XML_SCHEMAS_ERR_WRONGELEM = 5
8509: XML_SCHEMAS_ERR_NOTYPE = 6
8510: XML_SCHEMAS_ERR_NOROLLBACK = 7
8511: XML_SCHEMAS_ERR_ISABSTRACT = 8
8512: XML_SCHEMAS_ERR_NOTEMPTY = 9
8513: XML_SCHEMAS_ERR_ELEMCONT = 10
8514: XML_SCHEMAS_ERR_HAVEDEFAULT = 11
8515: XML_SCHEMAS_ERR_NOTNILLABLE = 12
8516: XML_SCHEMAS_ERR_EXTRACONTENT = 13
8517: XML_SCHEMAS_ERR_INVALIDATTR = 14
8518: XML_SCHEMAS_ERR_INVALIDELEM = 15
8519: XML_SCHEMAS_ERR_NOTDETERMINIST = 16
8520: XML_SCHEMAS_ERR_CONSTRUCT = 17
8521: XML_SCHEMAS_ERR_INTERNAL = 18
8522: XML_SCHEMAS_ERR_NOTSIMPLE = 19
8523: XML_SCHEMAS_ERR_ATTRUNKNOWN = 20
8524: XML_SCHEMAS_ERR_ATTRINVALID = 21
8525: XML_SCHEMAS_ERR_VALUE = 22
8526: XML_SCHEMAS_ERR_FACET = 23
8527: XML_SCHEMAS_ERR_ = 24
8528: XML_SCHEMAS_ERR_XXX = 25
8529:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>