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