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 | next = __next__
|
---|
546 |
|
---|
547 | #
|
---|
548 | # implements the breadth-first iterator for libxml2 DOM tree
|
---|
549 | #
|
---|
550 | class xmlCoreBreadthFirstItertor:
|
---|
551 | def __init__(self, node):
|
---|
552 | self.node = node
|
---|
553 | self.parents = []
|
---|
554 | def __iter__(self):
|
---|
555 | return self
|
---|
556 | def __next__(self):
|
---|
557 | while 1:
|
---|
558 | if self.node:
|
---|
559 | ret = self.node
|
---|
560 | self.parents.append(self.node)
|
---|
561 | self.node = self.node.next
|
---|
562 | return ret
|
---|
563 | try:
|
---|
564 | parent = self.parents.pop()
|
---|
565 | except IndexError:
|
---|
566 | raise StopIteration
|
---|
567 | self.node = parent.children
|
---|
568 | next = __next__
|
---|
569 |
|
---|
570 | #
|
---|
571 | # converters to present a nicer view of the XPath returns
|
---|
572 | #
|
---|
573 | def nodeWrap(o):
|
---|
574 | # TODO try to cast to the most appropriate node class
|
---|
575 | name = libxml2mod.type(o)
|
---|
576 | if name == "element" or name == "text":
|
---|
577 | return xmlNode(_obj=o)
|
---|
578 | if name == "attribute":
|
---|
579 | return xmlAttr(_obj=o)
|
---|
580 | if name[0:8] == "document":
|
---|
581 | return xmlDoc(_obj=o)
|
---|
582 | if name == "namespace":
|
---|
583 | return xmlNs(_obj=o)
|
---|
584 | if name == "elem_decl":
|
---|
585 | return xmlElement(_obj=o)
|
---|
586 | if name == "attribute_decl":
|
---|
587 | return xmlAttribute(_obj=o)
|
---|
588 | if name == "entity_decl":
|
---|
589 | return xmlEntity(_obj=o)
|
---|
590 | if name == "dtd":
|
---|
591 | return xmlDtd(_obj=o)
|
---|
592 | return xmlNode(_obj=o)
|
---|
593 |
|
---|
594 | def xpathObjectRet(o):
|
---|
595 | otype = type(o)
|
---|
596 | if otype == type([]):
|
---|
597 | ret = list(map(xpathObjectRet, o))
|
---|
598 | return ret
|
---|
599 | elif otype == type(()):
|
---|
600 | ret = list(map(xpathObjectRet, o))
|
---|
601 | return tuple(ret)
|
---|
602 | elif otype == type('') or otype == type(0) or otype == type(0.0):
|
---|
603 | return o
|
---|
604 | else:
|
---|
605 | return nodeWrap(o)
|
---|
606 |
|
---|
607 | #
|
---|
608 | # register an XPath function
|
---|
609 | #
|
---|
610 | def registerXPathFunction(ctxt, name, ns_uri, f):
|
---|
611 | ret = libxml2mod.xmlRegisterXPathFunction(ctxt, name, ns_uri, f)
|
---|
612 |
|
---|
613 | #
|
---|
614 | # For the xmlTextReader parser configuration
|
---|
615 | #
|
---|
616 | PARSER_LOADDTD=1
|
---|
617 | PARSER_DEFAULTATTRS=2
|
---|
618 | PARSER_VALIDATE=3
|
---|
619 | PARSER_SUBST_ENTITIES=4
|
---|
620 |
|
---|
621 | #
|
---|
622 | # For the error callback severities
|
---|
623 | #
|
---|
624 | PARSER_SEVERITY_VALIDITY_WARNING=1
|
---|
625 | PARSER_SEVERITY_VALIDITY_ERROR=2
|
---|
626 | PARSER_SEVERITY_WARNING=3
|
---|
627 | PARSER_SEVERITY_ERROR=4
|
---|
628 |
|
---|
629 | #
|
---|
630 | # register the libxml2 error handler
|
---|
631 | #
|
---|
632 | def registerErrorHandler(f, ctx):
|
---|
633 | """Register a Python written function to for error reporting.
|
---|
634 | The function is called back as f(ctx, error). """
|
---|
635 | import sys
|
---|
636 | if 'libxslt' not in sys.modules:
|
---|
637 | # normal behaviour when libxslt is not imported
|
---|
638 | ret = libxml2mod.xmlRegisterErrorHandler(f,ctx)
|
---|
639 | else:
|
---|
640 | # when libxslt is already imported, one must
|
---|
641 | # use libxst's error handler instead
|
---|
642 | import libxslt
|
---|
643 | ret = libxslt.registerErrorHandler(f,ctx)
|
---|
644 | return ret
|
---|
645 |
|
---|
646 | class parserCtxtCore:
|
---|
647 |
|
---|
648 | def __init__(self, _obj=None):
|
---|
649 | if _obj != None:
|
---|
650 | self._o = _obj;
|
---|
651 | return
|
---|
652 | self._o = None
|
---|
653 |
|
---|
654 | def __del__(self):
|
---|
655 | if self._o != None:
|
---|
656 | libxml2mod.xmlFreeParserCtxt(self._o)
|
---|
657 | self._o = None
|
---|
658 |
|
---|
659 | def setErrorHandler(self,f,arg):
|
---|
660 | """Register an error handler that will be called back as
|
---|
661 | f(arg,msg,severity,reserved).
|
---|
662 |
|
---|
663 | @reserved is currently always None."""
|
---|
664 | libxml2mod.xmlParserCtxtSetErrorHandler(self._o,f,arg)
|
---|
665 |
|
---|
666 | def getErrorHandler(self):
|
---|
667 | """Return (f,arg) as previously registered with setErrorHandler
|
---|
668 | or (None,None)."""
|
---|
669 | return libxml2mod.xmlParserCtxtGetErrorHandler(self._o)
|
---|
670 |
|
---|
671 | def addLocalCatalog(self, uri):
|
---|
672 | """Register a local catalog with the parser"""
|
---|
673 | return libxml2mod.addLocalCatalog(self._o, uri)
|
---|
674 |
|
---|
675 |
|
---|
676 | class ValidCtxtCore:
|
---|
677 |
|
---|
678 | def __init__(self, *args, **kw):
|
---|
679 | pass
|
---|
680 |
|
---|
681 | def setValidityErrorHandler(self, err_func, warn_func, arg=None):
|
---|
682 | """
|
---|
683 | Register error and warning handlers for DTD validation.
|
---|
684 | These will be called back as f(msg,arg)
|
---|
685 | """
|
---|
686 | libxml2mod.xmlSetValidErrors(self._o, err_func, warn_func, arg)
|
---|
687 |
|
---|
688 |
|
---|
689 | class SchemaValidCtxtCore:
|
---|
690 |
|
---|
691 | def __init__(self, *args, **kw):
|
---|
692 | pass
|
---|
693 |
|
---|
694 | def setValidityErrorHandler(self, err_func, warn_func, arg=None):
|
---|
695 | """
|
---|
696 | Register error and warning handlers for Schema validation.
|
---|
697 | These will be called back as f(msg,arg)
|
---|
698 | """
|
---|
699 | libxml2mod.xmlSchemaSetValidErrors(self._o, err_func, warn_func, arg)
|
---|
700 |
|
---|
701 |
|
---|
702 | class relaxNgValidCtxtCore:
|
---|
703 |
|
---|
704 | def __init__(self, *args, **kw):
|
---|
705 | pass
|
---|
706 |
|
---|
707 | def setValidityErrorHandler(self, err_func, warn_func, arg=None):
|
---|
708 | """
|
---|
709 | Register error and warning handlers for RelaxNG validation.
|
---|
710 | These will be called back as f(msg,arg)
|
---|
711 | """
|
---|
712 | libxml2mod.xmlRelaxNGSetValidErrors(self._o, err_func, warn_func, arg)
|
---|
713 |
|
---|
714 |
|
---|
715 | def _xmlTextReaderErrorFunc(xxx_todo_changeme,msg,severity,locator):
|
---|
716 | """Intermediate callback to wrap the locator"""
|
---|
717 | (f,arg) = xxx_todo_changeme
|
---|
718 | return f(arg,msg,severity,xmlTextReaderLocator(locator))
|
---|
719 |
|
---|
720 | class xmlTextReaderCore:
|
---|
721 |
|
---|
722 | def __init__(self, _obj=None):
|
---|
723 | self.input = None
|
---|
724 | if _obj != None:self._o = _obj;return
|
---|
725 | self._o = None
|
---|
726 |
|
---|
727 | def __del__(self):
|
---|
728 | if self._o != None:
|
---|
729 | libxml2mod.xmlFreeTextReader(self._o)
|
---|
730 | self._o = None
|
---|
731 |
|
---|
732 | def SetErrorHandler(self,f,arg):
|
---|
733 | """Register an error handler that will be called back as
|
---|
734 | f(arg,msg,severity,locator)."""
|
---|
735 | if f is None:
|
---|
736 | libxml2mod.xmlTextReaderSetErrorHandler(\
|
---|
737 | self._o,None,None)
|
---|
738 | else:
|
---|
739 | libxml2mod.xmlTextReaderSetErrorHandler(\
|
---|
740 | self._o,_xmlTextReaderErrorFunc,(f,arg))
|
---|
741 |
|
---|
742 | def GetErrorHandler(self):
|
---|
743 | """Return (f,arg) as previously registered with setErrorHandler
|
---|
744 | or (None,None)."""
|
---|
745 | f,arg = libxml2mod.xmlTextReaderGetErrorHandler(self._o)
|
---|
746 | if f is None:
|
---|
747 | return None,None
|
---|
748 | else:
|
---|
749 | # assert f is _xmlTextReaderErrorFunc
|
---|
750 | return arg
|
---|
751 |
|
---|
752 | #
|
---|
753 | # The cleanup now goes though a wrapper in libxml.c
|
---|
754 | #
|
---|
755 | def cleanupParser():
|
---|
756 | libxml2mod.xmlPythonCleanupParser()
|
---|
757 |
|
---|
758 | #
|
---|
759 | # The interface to xmlRegisterInputCallbacks.
|
---|
760 | # Since this API does not allow to pass a data object along with
|
---|
761 | # match/open callbacks, it is necessary to maintain a list of all
|
---|
762 | # Python callbacks.
|
---|
763 | #
|
---|
764 | __input_callbacks = []
|
---|
765 | def registerInputCallback(func):
|
---|
766 | def findOpenCallback(URI):
|
---|
767 | for cb in reversed(__input_callbacks):
|
---|
768 | o = cb(URI)
|
---|
769 | if o is not None:
|
---|
770 | return o
|
---|
771 | libxml2mod.xmlRegisterInputCallback(findOpenCallback)
|
---|
772 | __input_callbacks.append(func)
|
---|
773 |
|
---|
774 | def popInputCallbacks():
|
---|
775 | # First pop python-level callbacks, when no more available - start
|
---|
776 | # popping built-in ones.
|
---|
777 | if len(__input_callbacks) > 0:
|
---|
778 | __input_callbacks.pop()
|
---|
779 | if len(__input_callbacks) == 0:
|
---|
780 | libxml2mod.xmlUnregisterInputCallback()
|
---|
781 |
|
---|
782 | # WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
---|
783 | #
|
---|
784 | # Everything before this line comes from libxml.py
|
---|
785 | # Everything after this line is automatically generated
|
---|
786 | #
|
---|
787 | # WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
|
---|
788 |
|
---|
789 | #
|
---|
790 | # Functions from module HTMLparser
|
---|
791 | #
|
---|
792 |
|
---|
793 | def htmlCreateMemoryParserCtxt(buffer, size):
|
---|
794 | """Create a parser context for an HTML in-memory document. """
|
---|
795 | ret = libxml2mod.htmlCreateMemoryParserCtxt(buffer, size)
|
---|
796 | if ret is None:raise parserError('htmlCreateMemoryParserCtxt() failed')
|
---|
797 | return parserCtxt(_obj=ret)
|
---|
798 |
|
---|
799 | def htmlHandleOmittedElem(val):
|
---|
800 | """Set and return the previous value for handling HTML omitted
|
---|
801 | tags. """
|
---|
802 | ret = libxml2mod.htmlHandleOmittedElem(val)
|
---|
803 | return ret
|
---|
804 |
|
---|
805 | def htmlIsScriptAttribute(name):
|
---|
806 | """Check if an attribute is of content type Script """
|
---|
807 | ret = libxml2mod.htmlIsScriptAttribute(name)
|
---|
808 | return ret
|
---|
809 |
|
---|
810 | def htmlNewParserCtxt():
|
---|
811 | """Allocate and initialize a new parser context. """
|
---|
812 | ret = libxml2mod.htmlNewParserCtxt()
|
---|
813 | if ret is None:raise parserError('htmlNewParserCtxt() failed')
|
---|
814 | return parserCtxt(_obj=ret)
|
---|
815 |
|
---|
816 | def htmlParseDoc(cur, encoding):
|
---|
817 | """parse an HTML in-memory document and build a tree. """
|
---|
818 | ret = libxml2mod.htmlParseDoc(cur, encoding)
|
---|
819 | if ret is None:raise parserError('htmlParseDoc() failed')
|
---|
820 | return xmlDoc(_obj=ret)
|
---|
821 |
|
---|
822 | def htmlParseFile(filename, encoding):
|
---|
823 | """parse an HTML file and build a tree. Automatic support for
|
---|
824 | ZLIB/Compress compressed document is provided by default if
|
---|
825 | found at compile-time. """
|
---|
826 | ret = libxml2mod.htmlParseFile(filename, encoding)
|
---|
827 | if ret is None:raise parserError('htmlParseFile() failed')
|
---|
828 | return xmlDoc(_obj=ret)
|
---|
829 |
|
---|
830 | def htmlReadDoc(cur, URL, encoding, options):
|
---|
831 | """parse an XML in-memory document and build a tree. """
|
---|
832 | ret = libxml2mod.htmlReadDoc(cur, URL, encoding, options)
|
---|
833 | if ret is None:raise treeError('htmlReadDoc() failed')
|
---|
834 | return xmlDoc(_obj=ret)
|
---|
835 |
|
---|
836 | def htmlReadFd(fd, URL, encoding, options):
|
---|
837 | """parse an XML from a file descriptor and build a tree. """
|
---|
838 | ret = libxml2mod.htmlReadFd(fd, URL, encoding, options)
|
---|
839 | if ret is None:raise treeError('htmlReadFd() failed')
|
---|
840 | return xmlDoc(_obj=ret)
|
---|
841 |
|
---|
842 | def htmlReadFile(filename, encoding, options):
|
---|
843 | """parse an XML file from the filesystem or the network. """
|
---|
844 | ret = libxml2mod.htmlReadFile(filename, encoding, options)
|
---|
845 | if ret is None:raise treeError('htmlReadFile() failed')
|
---|
846 | return xmlDoc(_obj=ret)
|
---|
847 |
|
---|
848 | def htmlReadMemory(buffer, size, URL, encoding, options):
|
---|
849 | """parse an XML in-memory document and build a tree. """
|
---|
850 | ret = libxml2mod.htmlReadMemory(buffer, size, URL, encoding, options)
|
---|
851 | if ret is None:raise treeError('htmlReadMemory() failed')
|
---|
852 | return xmlDoc(_obj=ret)
|
---|
853 |
|
---|
854 | #
|
---|
855 | # Functions from module HTMLtree
|
---|
856 | #
|
---|
857 |
|
---|
858 | def htmlIsBooleanAttr(name):
|
---|
859 | """Determine if a given attribute is a boolean attribute. """
|
---|
860 | ret = libxml2mod.htmlIsBooleanAttr(name)
|
---|
861 | return ret
|
---|
862 |
|
---|
863 | def htmlNewDoc(URI, ExternalID):
|
---|
864 | """Creates a new HTML document """
|
---|
865 | ret = libxml2mod.htmlNewDoc(URI, ExternalID)
|
---|
866 | if ret is None:raise treeError('htmlNewDoc() failed')
|
---|
867 | return xmlDoc(_obj=ret)
|
---|
868 |
|
---|
869 | def htmlNewDocNoDtD(URI, ExternalID):
|
---|
870 | """Creates a new HTML document without a DTD node if @URI and
|
---|
871 | @ExternalID are None """
|
---|
872 | ret = libxml2mod.htmlNewDocNoDtD(URI, ExternalID)
|
---|
873 | if ret is None:raise treeError('htmlNewDocNoDtD() failed')
|
---|
874 | return xmlDoc(_obj=ret)
|
---|
875 |
|
---|
876 | #
|
---|
877 | # Functions from module SAX2
|
---|
878 | #
|
---|
879 |
|
---|
880 | def SAXDefaultVersion(version):
|
---|
881 | """Set the default version of SAX used globally by the
|
---|
882 | library. By default, during initialization the default is
|
---|
883 | set to 2. Note that it is generally a better coding style
|
---|
884 | to use xmlSAXVersion() to set up the version explicitly for
|
---|
885 | a given parsing context. """
|
---|
886 | ret = libxml2mod.xmlSAXDefaultVersion(version)
|
---|
887 | return ret
|
---|
888 |
|
---|
889 | def defaultSAXHandlerInit():
|
---|
890 | """Initialize the default SAX2 handler """
|
---|
891 | libxml2mod.xmlDefaultSAXHandlerInit()
|
---|
892 |
|
---|
893 | def docbDefaultSAXHandlerInit():
|
---|
894 | """Initialize the default SAX handler """
|
---|
895 | libxml2mod.docbDefaultSAXHandlerInit()
|
---|
896 |
|
---|
897 | def htmlDefaultSAXHandlerInit():
|
---|
898 | """Initialize the default SAX handler """
|
---|
899 | libxml2mod.htmlDefaultSAXHandlerInit()
|
---|
900 |
|
---|
901 | #
|
---|
902 | # Functions from module catalog
|
---|
903 | #
|
---|
904 |
|
---|
905 | def catalogAdd(type, orig, replace):
|
---|
906 | """Add an entry in the catalog, it may overwrite existing but
|
---|
907 | different entries. If called before any other catalog
|
---|
908 | routine, allows to override the default shared catalog put
|
---|
909 | in place by xmlInitializeCatalog(); """
|
---|
910 | ret = libxml2mod.xmlCatalogAdd(type, orig, replace)
|
---|
911 | return ret
|
---|
912 |
|
---|
913 | def catalogCleanup():
|
---|
914 | """Free up all the memory associated with catalogs """
|
---|
915 | libxml2mod.xmlCatalogCleanup()
|
---|
916 |
|
---|
917 | def catalogConvert():
|
---|
918 | """Convert all the SGML catalog entries as XML ones """
|
---|
919 | ret = libxml2mod.xmlCatalogConvert()
|
---|
920 | return ret
|
---|
921 |
|
---|
922 | def catalogDump(out):
|
---|
923 | """Dump all the global catalog content to the given file. """
|
---|
924 | if out is not None: out.flush()
|
---|
925 | libxml2mod.xmlCatalogDump(out)
|
---|
926 |
|
---|
927 | def catalogGetPublic(pubID):
|
---|
928 | """Try to lookup the catalog reference associated to a public
|
---|
929 | ID DEPRECATED, use xmlCatalogResolvePublic() """
|
---|
930 | ret = libxml2mod.xmlCatalogGetPublic(pubID)
|
---|
931 | return ret
|
---|
932 |
|
---|
933 | def catalogGetSystem(sysID):
|
---|
934 | """Try to lookup the catalog reference associated to a system
|
---|
935 | ID DEPRECATED, use xmlCatalogResolveSystem() """
|
---|
936 | ret = libxml2mod.xmlCatalogGetSystem(sysID)
|
---|
937 | return ret
|
---|
938 |
|
---|
939 | def catalogRemove(value):
|
---|
940 | """Remove an entry from the catalog """
|
---|
941 | ret = libxml2mod.xmlCatalogRemove(value)
|
---|
942 | return ret
|
---|
943 |
|
---|
944 | def catalogResolve(pubID, sysID):
|
---|
945 | """Do a complete resolution lookup of an External Identifier """
|
---|
946 | ret = libxml2mod.xmlCatalogResolve(pubID, sysID)
|
---|
947 | return ret
|
---|
948 |
|
---|
949 | def catalogResolvePublic(pubID):
|
---|
950 | """Try to lookup the catalog reference associated to a public
|
---|
951 | ID """
|
---|
952 | ret = libxml2mod.xmlCatalogResolvePublic(pubID)
|
---|
953 | return ret
|
---|
954 |
|
---|
955 | def catalogResolveSystem(sysID):
|
---|
956 | """Try to lookup the catalog resource for a system ID """
|
---|
957 | ret = libxml2mod.xmlCatalogResolveSystem(sysID)
|
---|
958 | return ret
|
---|
959 |
|
---|
960 | def catalogResolveURI(URI):
|
---|
961 | """Do a complete resolution lookup of an URI """
|
---|
962 | ret = libxml2mod.xmlCatalogResolveURI(URI)
|
---|
963 | return ret
|
---|
964 |
|
---|
965 | def catalogSetDebug(level):
|
---|
966 | """Used to set the debug level for catalog operation, 0
|
---|
967 | disable debugging, 1 enable it """
|
---|
968 | ret = libxml2mod.xmlCatalogSetDebug(level)
|
---|
969 | return ret
|
---|
970 |
|
---|
971 | def initializeCatalog():
|
---|
972 | """Do the catalog initialization. this function is not thread
|
---|
973 | safe, catalog initialization should preferably be done once
|
---|
974 | at startup """
|
---|
975 | libxml2mod.xmlInitializeCatalog()
|
---|
976 |
|
---|
977 | def loadACatalog(filename):
|
---|
978 | """Load the catalog and build the associated data structures.
|
---|
979 | This can be either an XML Catalog or an SGML Catalog It
|
---|
980 | will recurse in SGML CATALOG entries. On the other hand XML
|
---|
981 | Catalogs are not handled recursively. """
|
---|
982 | ret = libxml2mod.xmlLoadACatalog(filename)
|
---|
983 | if ret is None:raise treeError('xmlLoadACatalog() failed')
|
---|
984 | return catalog(_obj=ret)
|
---|
985 |
|
---|
986 | def loadCatalog(filename):
|
---|
987 | """Load the catalog and makes its definitions effective for
|
---|
988 | the default external entity loader. It will recurse in SGML
|
---|
989 | CATALOG entries. this function is not thread safe, catalog
|
---|
990 | initialization should preferably be done once at startup """
|
---|
991 | ret = libxml2mod.xmlLoadCatalog(filename)
|
---|
992 | return ret
|
---|
993 |
|
---|
994 | def loadCatalogs(pathss):
|
---|
995 | """Load the catalogs and makes their definitions effective for
|
---|
996 | the default external entity loader. this function is not
|
---|
997 | thread safe, catalog initialization should preferably be
|
---|
998 | done once at startup """
|
---|
999 | libxml2mod.xmlLoadCatalogs(pathss)
|
---|
1000 |
|
---|
1001 | def loadSGMLSuperCatalog(filename):
|
---|
1002 | """Load an SGML super catalog. It won't expand CATALOG or
|
---|
1003 | DELEGATE references. This is only needed for manipulating
|
---|
1004 | SGML Super Catalogs like adding and removing CATALOG or
|
---|
1005 | DELEGATE entries. """
|
---|
1006 | ret = libxml2mod.xmlLoadSGMLSuperCatalog(filename)
|
---|
1007 | if ret is None:raise treeError('xmlLoadSGMLSuperCatalog() failed')
|
---|
1008 | return catalog(_obj=ret)
|
---|
1009 |
|
---|
1010 | def newCatalog(sgml):
|
---|
1011 | """create a new Catalog. """
|
---|
1012 | ret = libxml2mod.xmlNewCatalog(sgml)
|
---|
1013 | if ret is None:raise treeError('xmlNewCatalog() failed')
|
---|
1014 | return catalog(_obj=ret)
|
---|
1015 |
|
---|
1016 | def parseCatalogFile(filename):
|
---|
1017 | """parse an XML file and build a tree. It's like
|
---|
1018 | xmlParseFile() except it bypass all catalog lookups. """
|
---|
1019 | ret = libxml2mod.xmlParseCatalogFile(filename)
|
---|
1020 | if ret is None:raise parserError('xmlParseCatalogFile() failed')
|
---|
1021 | return xmlDoc(_obj=ret)
|
---|
1022 |
|
---|
1023 | #
|
---|
1024 | # Functions from module chvalid
|
---|
1025 | #
|
---|
1026 |
|
---|
1027 | def isBaseChar(ch):
|
---|
1028 | """This function is DEPRECATED. Use xmlIsBaseChar_ch or
|
---|
1029 | xmlIsBaseCharQ instead """
|
---|
1030 | ret = libxml2mod.xmlIsBaseChar(ch)
|
---|
1031 | return ret
|
---|
1032 |
|
---|
1033 | def isBlank(ch):
|
---|
1034 | """This function is DEPRECATED. Use xmlIsBlank_ch or
|
---|
1035 | xmlIsBlankQ instead """
|
---|
1036 | ret = libxml2mod.xmlIsBlank(ch)
|
---|
1037 | return ret
|
---|
1038 |
|
---|
1039 | def isChar(ch):
|
---|
1040 | """This function is DEPRECATED. Use xmlIsChar_ch or xmlIsCharQ
|
---|
1041 | instead """
|
---|
1042 | ret = libxml2mod.xmlIsChar(ch)
|
---|
1043 | return ret
|
---|
1044 |
|
---|
1045 | def isCombining(ch):
|
---|
1046 | """This function is DEPRECATED. Use xmlIsCombiningQ instead """
|
---|
1047 | ret = libxml2mod.xmlIsCombining(ch)
|
---|
1048 | return ret
|
---|
1049 |
|
---|
1050 | def isDigit(ch):
|
---|
1051 | """This function is DEPRECATED. Use xmlIsDigit_ch or
|
---|
1052 | xmlIsDigitQ instead """
|
---|
1053 | ret = libxml2mod.xmlIsDigit(ch)
|
---|
1054 | return ret
|
---|
1055 |
|
---|
1056 | def isExtender(ch):
|
---|
1057 | """This function is DEPRECATED. Use xmlIsExtender_ch or
|
---|
1058 | xmlIsExtenderQ instead """
|
---|
1059 | ret = libxml2mod.xmlIsExtender(ch)
|
---|
1060 | return ret
|
---|
1061 |
|
---|
1062 | def isIdeographic(ch):
|
---|
1063 | """This function is DEPRECATED. Use xmlIsIdeographicQ instead """
|
---|
1064 | ret = libxml2mod.xmlIsIdeographic(ch)
|
---|
1065 | return ret
|
---|
1066 |
|
---|
1067 | def isPubidChar(ch):
|
---|
1068 | """This function is DEPRECATED. Use xmlIsPubidChar_ch or
|
---|
1069 | xmlIsPubidCharQ instead """
|
---|
1070 | ret = libxml2mod.xmlIsPubidChar(ch)
|
---|
1071 | return ret
|
---|
1072 |
|
---|
1073 | #
|
---|
1074 | # Functions from module debugXML
|
---|
1075 | #
|
---|
1076 |
|
---|
1077 | def boolToText(boolval):
|
---|
1078 | """Convenient way to turn bool into text """
|
---|
1079 | ret = libxml2mod.xmlBoolToText(boolval)
|
---|
1080 | return ret
|
---|
1081 |
|
---|
1082 | def debugDumpString(output, str):
|
---|
1083 | """Dumps informations about the string, shorten it if necessary """
|
---|
1084 | if output is not None: output.flush()
|
---|
1085 | libxml2mod.xmlDebugDumpString(output, str)
|
---|
1086 |
|
---|
1087 | def shellPrintXPathError(errorType, arg):
|
---|
1088 | """Print the xpath error to libxml default error channel """
|
---|
1089 | libxml2mod.xmlShellPrintXPathError(errorType, arg)
|
---|
1090 |
|
---|
1091 | #
|
---|
1092 | # Functions from module dict
|
---|
1093 | #
|
---|
1094 |
|
---|
1095 | def dictCleanup():
|
---|
1096 | """Free the dictionary mutex. Do not call unless sure the
|
---|
1097 | library is not in use anymore ! """
|
---|
1098 | libxml2mod.xmlDictCleanup()
|
---|
1099 |
|
---|
1100 | def initializeDict():
|
---|
1101 | """Do the dictionary mutex initialization. this function is
|
---|
1102 | deprecated """
|
---|
1103 | ret = libxml2mod.xmlInitializeDict()
|
---|
1104 | return ret
|
---|
1105 |
|
---|
1106 | #
|
---|
1107 | # Functions from module encoding
|
---|
1108 | #
|
---|
1109 |
|
---|
1110 | def addEncodingAlias(name, alias):
|
---|
1111 | """Registers an alias @alias for an encoding named @name.
|
---|
1112 | Existing alias will be overwritten. """
|
---|
1113 | ret = libxml2mod.xmlAddEncodingAlias(name, alias)
|
---|
1114 | return ret
|
---|
1115 |
|
---|
1116 | def cleanupCharEncodingHandlers():
|
---|
1117 | """Cleanup the memory allocated for the char encoding support,
|
---|
1118 | it unregisters all the encoding handlers and the aliases. """
|
---|
1119 | libxml2mod.xmlCleanupCharEncodingHandlers()
|
---|
1120 |
|
---|
1121 | def cleanupEncodingAliases():
|
---|
1122 | """Unregisters all aliases """
|
---|
1123 | libxml2mod.xmlCleanupEncodingAliases()
|
---|
1124 |
|
---|
1125 | def delEncodingAlias(alias):
|
---|
1126 | """Unregisters an encoding alias @alias """
|
---|
1127 | ret = libxml2mod.xmlDelEncodingAlias(alias)
|
---|
1128 | return ret
|
---|
1129 |
|
---|
1130 | def encodingAlias(alias):
|
---|
1131 | """Lookup an encoding name for the given alias. """
|
---|
1132 | ret = libxml2mod.xmlGetEncodingAlias(alias)
|
---|
1133 | return ret
|
---|
1134 |
|
---|
1135 | def initCharEncodingHandlers():
|
---|
1136 | """Initialize the char encoding support, it registers the
|
---|
1137 | default encoding supported. NOTE: while public, this
|
---|
1138 | function usually doesn't need to be called in normal
|
---|
1139 | processing. """
|
---|
1140 | libxml2mod.xmlInitCharEncodingHandlers()
|
---|
1141 |
|
---|
1142 | #
|
---|
1143 | # Functions from module entities
|
---|
1144 | #
|
---|
1145 |
|
---|
1146 | def cleanupPredefinedEntities():
|
---|
1147 | """Cleanup up the predefined entities table. Deprecated call """
|
---|
1148 | libxml2mod.xmlCleanupPredefinedEntities()
|
---|
1149 |
|
---|
1150 | def initializePredefinedEntities():
|
---|
1151 | """Set up the predefined entities. Deprecated call """
|
---|
1152 | libxml2mod.xmlInitializePredefinedEntities()
|
---|
1153 |
|
---|
1154 | def predefinedEntity(name):
|
---|
1155 | """Check whether this name is an predefined entity. """
|
---|
1156 | ret = libxml2mod.xmlGetPredefinedEntity(name)
|
---|
1157 | if ret is None:raise treeError('xmlGetPredefinedEntity() failed')
|
---|
1158 | return xmlEntity(_obj=ret)
|
---|
1159 |
|
---|
1160 | #
|
---|
1161 | # Functions from module globals
|
---|
1162 | #
|
---|
1163 |
|
---|
1164 | def cleanupGlobals():
|
---|
1165 | """Additional cleanup for multi-threading """
|
---|
1166 | libxml2mod.xmlCleanupGlobals()
|
---|
1167 |
|
---|
1168 | def initGlobals():
|
---|
1169 | """Additional initialisation for multi-threading """
|
---|
1170 | libxml2mod.xmlInitGlobals()
|
---|
1171 |
|
---|
1172 | def thrDefDefaultBufferSize(v):
|
---|
1173 | ret = libxml2mod.xmlThrDefDefaultBufferSize(v)
|
---|
1174 | return ret
|
---|
1175 |
|
---|
1176 | def thrDefDoValidityCheckingDefaultValue(v):
|
---|
1177 | ret = libxml2mod.xmlThrDefDoValidityCheckingDefaultValue(v)
|
---|
1178 | return ret
|
---|
1179 |
|
---|
1180 | def thrDefGetWarningsDefaultValue(v):
|
---|
1181 | ret = libxml2mod.xmlThrDefGetWarningsDefaultValue(v)
|
---|
1182 | return ret
|
---|
1183 |
|
---|
1184 | def thrDefIndentTreeOutput(v):
|
---|
1185 | ret = libxml2mod.xmlThrDefIndentTreeOutput(v)
|
---|
1186 | return ret
|
---|
1187 |
|
---|
1188 | def thrDefKeepBlanksDefaultValue(v):
|
---|
1189 | ret = libxml2mod.xmlThrDefKeepBlanksDefaultValue(v)
|
---|
1190 | return ret
|
---|
1191 |
|
---|
1192 | def thrDefLineNumbersDefaultValue(v):
|
---|
1193 | ret = libxml2mod.xmlThrDefLineNumbersDefaultValue(v)
|
---|
1194 | return ret
|
---|
1195 |
|
---|
1196 | def thrDefLoadExtDtdDefaultValue(v):
|
---|
1197 | ret = libxml2mod.xmlThrDefLoadExtDtdDefaultValue(v)
|
---|
1198 | return ret
|
---|
1199 |
|
---|
1200 | def thrDefParserDebugEntities(v):
|
---|
1201 | ret = libxml2mod.xmlThrDefParserDebugEntities(v)
|
---|
1202 | return ret
|
---|
1203 |
|
---|
1204 | def thrDefPedanticParserDefaultValue(v):
|
---|
1205 | ret = libxml2mod.xmlThrDefPedanticParserDefaultValue(v)
|
---|
1206 | return ret
|
---|
1207 |
|
---|
1208 | def thrDefSaveNoEmptyTags(v):
|
---|
1209 | ret = libxml2mod.xmlThrDefSaveNoEmptyTags(v)
|
---|
1210 | return ret
|
---|
1211 |
|
---|
1212 | def thrDefSubstituteEntitiesDefaultValue(v):
|
---|
1213 | ret = libxml2mod.xmlThrDefSubstituteEntitiesDefaultValue(v)
|
---|
1214 | return ret
|
---|
1215 |
|
---|
1216 | def thrDefTreeIndentString(v):
|
---|
1217 | ret = libxml2mod.xmlThrDefTreeIndentString(v)
|
---|
1218 | return ret
|
---|
1219 |
|
---|
1220 | #
|
---|
1221 | # Functions from module nanoftp
|
---|
1222 | #
|
---|
1223 |
|
---|
1224 | def nanoFTPCleanup():
|
---|
1225 | """Cleanup the FTP protocol layer. This cleanup proxy
|
---|
1226 | informations. """
|
---|
1227 | libxml2mod.xmlNanoFTPCleanup()
|
---|
1228 |
|
---|
1229 | def nanoFTPInit():
|
---|
1230 | """Initialize the FTP protocol layer. Currently it just checks
|
---|
1231 | for proxy informations, and get the hostname """
|
---|
1232 | libxml2mod.xmlNanoFTPInit()
|
---|
1233 |
|
---|
1234 | def nanoFTPProxy(host, port, user, passwd, type):
|
---|
1235 | """Setup the FTP proxy informations. This can also be done by
|
---|
1236 | using ftp_proxy ftp_proxy_user and ftp_proxy_password
|
---|
1237 | environment variables. """
|
---|
1238 | libxml2mod.xmlNanoFTPProxy(host, port, user, passwd, type)
|
---|
1239 |
|
---|
1240 | def nanoFTPScanProxy(URL):
|
---|
1241 | """(Re)Initialize the FTP Proxy context by parsing the URL and
|
---|
1242 | finding the protocol host port it indicates. Should be like
|
---|
1243 | ftp://myproxy/ or ftp://myproxy:3128/ A None URL cleans up
|
---|
1244 | proxy informations. """
|
---|
1245 | libxml2mod.xmlNanoFTPScanProxy(URL)
|
---|
1246 |
|
---|
1247 | #
|
---|
1248 | # Functions from module nanohttp
|
---|
1249 | #
|
---|
1250 |
|
---|
1251 | def nanoHTTPCleanup():
|
---|
1252 | """Cleanup the HTTP protocol layer. """
|
---|
1253 | libxml2mod.xmlNanoHTTPCleanup()
|
---|
1254 |
|
---|
1255 | def nanoHTTPInit():
|
---|
1256 | """Initialize the HTTP protocol layer. Currently it just
|
---|
1257 | checks for proxy informations """
|
---|
1258 | libxml2mod.xmlNanoHTTPInit()
|
---|
1259 |
|
---|
1260 | def nanoHTTPScanProxy(URL):
|
---|
1261 | """(Re)Initialize the HTTP Proxy context by parsing the URL
|
---|
1262 | and finding the protocol host port it indicates. Should be
|
---|
1263 | like http://myproxy/ or http://myproxy:3128/ A None URL
|
---|
1264 | cleans up proxy informations. """
|
---|
1265 | libxml2mod.xmlNanoHTTPScanProxy(URL)
|
---|
1266 |
|
---|
1267 | #
|
---|
1268 | # Functions from module parser
|
---|
1269 | #
|
---|
1270 |
|
---|
1271 | def createDocParserCtxt(cur):
|
---|
1272 | """Creates a parser context for an XML in-memory document. """
|
---|
1273 | ret = libxml2mod.xmlCreateDocParserCtxt(cur)
|
---|
1274 | if ret is None:raise parserError('xmlCreateDocParserCtxt() failed')
|
---|
1275 | return parserCtxt(_obj=ret)
|
---|
1276 |
|
---|
1277 | def initParser():
|
---|
1278 | """Initialization function for the XML parser. This is not
|
---|
1279 | reentrant. Call once before processing in case of use in
|
---|
1280 | multithreaded programs. """
|
---|
1281 | libxml2mod.xmlInitParser()
|
---|
1282 |
|
---|
1283 | def keepBlanksDefault(val):
|
---|
1284 | """Set and return the previous value for default blanks text
|
---|
1285 | nodes support. The 1.x version of the parser used an
|
---|
1286 | heuristic to try to detect ignorable white spaces. As a
|
---|
1287 | result the SAX callback was generating
|
---|
1288 | xmlSAX2IgnorableWhitespace() callbacks instead of
|
---|
1289 | characters() one, and when using the DOM output text nodes
|
---|
1290 | containing those blanks were not generated. The 2.x and
|
---|
1291 | later version will switch to the XML standard way and
|
---|
1292 | ignorableWhitespace() are only generated when running the
|
---|
1293 | parser in validating mode and when the current element
|
---|
1294 | doesn't allow CDATA or mixed content. This function is
|
---|
1295 | provided as a way to force the standard behavior on 1.X
|
---|
1296 | libs and to switch back to the old mode for compatibility
|
---|
1297 | when running 1.X client code on 2.X . Upgrade of 1.X code
|
---|
1298 | should be done by using xmlIsBlankNode() commodity function
|
---|
1299 | to detect the "empty" nodes generated. This value also
|
---|
1300 | affect autogeneration of indentation when saving code if
|
---|
1301 | blanks sections are kept, indentation is not generated. """
|
---|
1302 | ret = libxml2mod.xmlKeepBlanksDefault(val)
|
---|
1303 | return ret
|
---|
1304 |
|
---|
1305 | def lineNumbersDefault(val):
|
---|
1306 | """Set and return the previous value for enabling line numbers
|
---|
1307 | in elements contents. This may break on old application and
|
---|
1308 | is turned off by default. """
|
---|
1309 | ret = libxml2mod.xmlLineNumbersDefault(val)
|
---|
1310 | return ret
|
---|
1311 |
|
---|
1312 | def newParserCtxt():
|
---|
1313 | """Allocate and initialize a new parser context. """
|
---|
1314 | ret = libxml2mod.xmlNewParserCtxt()
|
---|
1315 | if ret is None:raise parserError('xmlNewParserCtxt() failed')
|
---|
1316 | return parserCtxt(_obj=ret)
|
---|
1317 |
|
---|
1318 | def parseDTD(ExternalID, SystemID):
|
---|
1319 | """Load and parse an external subset. """
|
---|
1320 | ret = libxml2mod.xmlParseDTD(ExternalID, SystemID)
|
---|
1321 | if ret is None:raise parserError('xmlParseDTD() failed')
|
---|
1322 | return xmlDtd(_obj=ret)
|
---|
1323 |
|
---|
1324 | def parseDoc(cur):
|
---|
1325 | """parse an XML in-memory document and build a tree. """
|
---|
1326 | ret = libxml2mod.xmlParseDoc(cur)
|
---|
1327 | if ret is None:raise parserError('xmlParseDoc() failed')
|
---|
1328 | return xmlDoc(_obj=ret)
|
---|
1329 |
|
---|
1330 | def parseEntity(filename):
|
---|
1331 | """parse an XML external entity out of context and build a
|
---|
1332 | tree. [78] extParsedEnt ::= TextDecl? content This
|
---|
1333 | correspond to a "Well Balanced" chunk """
|
---|
1334 | ret = libxml2mod.xmlParseEntity(filename)
|
---|
1335 | if ret is None:raise parserError('xmlParseEntity() failed')
|
---|
1336 | return xmlDoc(_obj=ret)
|
---|
1337 |
|
---|
1338 | def parseFile(filename):
|
---|
1339 | """parse an XML file and build a tree. Automatic support for
|
---|
1340 | ZLIB/Compress compressed document is provided by default if
|
---|
1341 | found at compile-time. """
|
---|
1342 | ret = libxml2mod.xmlParseFile(filename)
|
---|
1343 | if ret is None:raise parserError('xmlParseFile() failed')
|
---|
1344 | return xmlDoc(_obj=ret)
|
---|
1345 |
|
---|
1346 | def parseMemory(buffer, size):
|
---|
1347 | """parse an XML in-memory block and build a tree. """
|
---|
1348 | ret = libxml2mod.xmlParseMemory(buffer, size)
|
---|
1349 | if ret is None:raise parserError('xmlParseMemory() failed')
|
---|
1350 | return xmlDoc(_obj=ret)
|
---|
1351 |
|
---|
1352 | def pedanticParserDefault(val):
|
---|
1353 | """Set and return the previous value for enabling pedantic
|
---|
1354 | warnings. """
|
---|
1355 | ret = libxml2mod.xmlPedanticParserDefault(val)
|
---|
1356 | return ret
|
---|
1357 |
|
---|
1358 | def readDoc(cur, URL, encoding, options):
|
---|
1359 | """parse an XML in-memory document and build a tree. """
|
---|
1360 | ret = libxml2mod.xmlReadDoc(cur, URL, encoding, options)
|
---|
1361 | if ret is None:raise treeError('xmlReadDoc() failed')
|
---|
1362 | return xmlDoc(_obj=ret)
|
---|
1363 |
|
---|
1364 | def readFd(fd, URL, encoding, options):
|
---|
1365 | """parse an XML from a file descriptor and build a tree. NOTE
|
---|
1366 | that the file descriptor will not be closed when the reader
|
---|
1367 | is closed or reset. """
|
---|
1368 | ret = libxml2mod.xmlReadFd(fd, URL, encoding, options)
|
---|
1369 | if ret is None:raise treeError('xmlReadFd() failed')
|
---|
1370 | return xmlDoc(_obj=ret)
|
---|
1371 |
|
---|
1372 | def readFile(filename, encoding, options):
|
---|
1373 | """parse an XML file from the filesystem or the network. """
|
---|
1374 | ret = libxml2mod.xmlReadFile(filename, encoding, options)
|
---|
1375 | if ret is None:raise treeError('xmlReadFile() failed')
|
---|
1376 | return xmlDoc(_obj=ret)
|
---|
1377 |
|
---|
1378 | def readMemory(buffer, size, URL, encoding, options):
|
---|
1379 | """parse an XML in-memory document and build a tree. """
|
---|
1380 | ret = libxml2mod.xmlReadMemory(buffer, size, URL, encoding, options)
|
---|
1381 | if ret is None:raise treeError('xmlReadMemory() failed')
|
---|
1382 | return xmlDoc(_obj=ret)
|
---|
1383 |
|
---|
1384 | def recoverDoc(cur):
|
---|
1385 | """parse an XML in-memory document and build a tree. In the
|
---|
1386 | case the document is not Well Formed, a attempt to build a
|
---|
1387 | tree is tried anyway """
|
---|
1388 | ret = libxml2mod.xmlRecoverDoc(cur)
|
---|
1389 | if ret is None:raise treeError('xmlRecoverDoc() failed')
|
---|
1390 | return xmlDoc(_obj=ret)
|
---|
1391 |
|
---|
1392 | def recoverFile(filename):
|
---|
1393 | """parse an XML file and build a tree. Automatic support for
|
---|
1394 | ZLIB/Compress compressed document is provided by default if
|
---|
1395 | found at compile-time. In the case the document is not Well
|
---|
1396 | Formed, it attempts to build a tree anyway """
|
---|
1397 | ret = libxml2mod.xmlRecoverFile(filename)
|
---|
1398 | if ret is None:raise treeError('xmlRecoverFile() failed')
|
---|
1399 | return xmlDoc(_obj=ret)
|
---|
1400 |
|
---|
1401 | def recoverMemory(buffer, size):
|
---|
1402 | """parse an XML in-memory block and build a tree. In the case
|
---|
1403 | the document is not Well Formed, an attempt to build a tree
|
---|
1404 | is tried anyway """
|
---|
1405 | ret = libxml2mod.xmlRecoverMemory(buffer, size)
|
---|
1406 | if ret is None:raise treeError('xmlRecoverMemory() failed')
|
---|
1407 | return xmlDoc(_obj=ret)
|
---|
1408 |
|
---|
1409 | def substituteEntitiesDefault(val):
|
---|
1410 | """Set and return the previous value for default entity
|
---|
1411 | support. Initially the parser always keep entity references
|
---|
1412 | instead of substituting entity values in the output. This
|
---|
1413 | function has to be used to change the default parser
|
---|
1414 | behavior SAX::substituteEntities() has to be used for
|
---|
1415 | changing that on a file by file basis. """
|
---|
1416 | ret = libxml2mod.xmlSubstituteEntitiesDefault(val)
|
---|
1417 | return ret
|
---|
1418 |
|
---|
1419 | #
|
---|
1420 | # Functions from module parserInternals
|
---|
1421 | #
|
---|
1422 |
|
---|
1423 | def checkLanguageID(lang):
|
---|
1424 | """Checks that the value conforms to the LanguageID
|
---|
1425 | production: NOTE: this is somewhat deprecated, those
|
---|
1426 | productions were removed from the XML Second edition. [33]
|
---|
1427 | LanguageID ::= Langcode ('-' Subcode)* [34] Langcode ::=
|
---|
1428 | ISO639Code | IanaCode | UserCode [35] ISO639Code ::=
|
---|
1429 | ([a-z] | [A-Z]) ([a-z] | [A-Z]) [36] IanaCode ::= ('i' |
|
---|
1430 | 'I') '-' ([a-z] | [A-Z])+ [37] UserCode ::= ('x' | 'X') '-'
|
---|
1431 | ([a-z] | [A-Z])+ [38] Subcode ::= ([a-z] | [A-Z])+ The
|
---|
1432 | current REC reference the sucessors of RFC 1766, currently
|
---|
1433 | 5646 http://www.rfc-editor.org/rfc/rfc5646.txt langtag
|
---|
1434 | = language ["-" script] ["-" region] *("-" variant) *("-"
|
---|
1435 | extension) ["-" privateuse] language = 2*3ALPHA
|
---|
1436 | ; shortest ISO 639 code ["-" extlang] ; sometimes
|
---|
1437 | followed by ; extended language subtags / 4ALPHA
|
---|
1438 | ; or reserved for future use / 5*8ALPHA ; or
|
---|
1439 | registered language subtag extlang = 3ALPHA
|
---|
1440 | ; selected ISO 639 codes *2("-" 3ALPHA) ; permanently
|
---|
1441 | reserved script = 4ALPHA ; ISO 15924
|
---|
1442 | code region = 2ALPHA ; ISO 3166-1 code
|
---|
1443 | / 3DIGIT ; UN M.49 code variant =
|
---|
1444 | 5*8alphanum ; registered variants / (DIGIT
|
---|
1445 | 3alphanum) extension = singleton 1*("-" (2*8alphanum))
|
---|
1446 | ; Single alphanumerics ; "x" reserved for private use
|
---|
1447 | singleton = DIGIT ; 0 - 9 / %x41-57
|
---|
1448 | ; A - W / %x59-5A ; Y - Z / %x61-77
|
---|
1449 | ; a - w / %x79-7A ; y - z it sounds right to
|
---|
1450 | still allow Irregular i-xxx IANA and user codes too The
|
---|
1451 | parser below doesn't try to cope with extension or
|
---|
1452 | privateuse that could be added but that's not interoperable
|
---|
1453 | anyway """
|
---|
1454 | ret = libxml2mod.xmlCheckLanguageID(lang)
|
---|
1455 | return ret
|
---|
1456 |
|
---|
1457 | def copyChar(len, out, val):
|
---|
1458 | """append the char value in the array """
|
---|
1459 | ret = libxml2mod.xmlCopyChar(len, out, val)
|
---|
1460 | return ret
|
---|
1461 |
|
---|
1462 | def copyCharMultiByte(out, val):
|
---|
1463 | """append the char value in the array """
|
---|
1464 | ret = libxml2mod.xmlCopyCharMultiByte(out, val)
|
---|
1465 | return ret
|
---|
1466 |
|
---|
1467 | def createEntityParserCtxt(URL, ID, base):
|
---|
1468 | """Create a parser context for an external entity Automatic
|
---|
1469 | support for ZLIB/Compress compressed document is provided
|
---|
1470 | by default if found at compile-time. """
|
---|
1471 | ret = libxml2mod.xmlCreateEntityParserCtxt(URL, ID, base)
|
---|
1472 | if ret is None:raise parserError('xmlCreateEntityParserCtxt() failed')
|
---|
1473 | return parserCtxt(_obj=ret)
|
---|
1474 |
|
---|
1475 | def createFileParserCtxt(filename):
|
---|
1476 | """Create a parser context for a file content. Automatic
|
---|
1477 | support for ZLIB/Compress compressed document is provided
|
---|
1478 | by default if found at compile-time. """
|
---|
1479 | ret = libxml2mod.xmlCreateFileParserCtxt(filename)
|
---|
1480 | if ret is None:raise parserError('xmlCreateFileParserCtxt() failed')
|
---|
1481 | return parserCtxt(_obj=ret)
|
---|
1482 |
|
---|
1483 | def createMemoryParserCtxt(buffer, size):
|
---|
1484 | """Create a parser context for an XML in-memory document. """
|
---|
1485 | ret = libxml2mod.xmlCreateMemoryParserCtxt(buffer, size)
|
---|
1486 | if ret is None:raise parserError('xmlCreateMemoryParserCtxt() failed')
|
---|
1487 | return parserCtxt(_obj=ret)
|
---|
1488 |
|
---|
1489 | def createURLParserCtxt(filename, options):
|
---|
1490 | """Create a parser context for a file or URL content.
|
---|
1491 | Automatic support for ZLIB/Compress compressed document is
|
---|
1492 | provided by default if found at compile-time and for file
|
---|
1493 | accesses """
|
---|
1494 | ret = libxml2mod.xmlCreateURLParserCtxt(filename, options)
|
---|
1495 | if ret is None:raise parserError('xmlCreateURLParserCtxt() failed')
|
---|
1496 | return parserCtxt(_obj=ret)
|
---|
1497 |
|
---|
1498 | def htmlCreateFileParserCtxt(filename, encoding):
|
---|
1499 | """Create a parser context for a file content. Automatic
|
---|
1500 | support for ZLIB/Compress compressed document is provided
|
---|
1501 | by default if found at compile-time. """
|
---|
1502 | ret = libxml2mod.htmlCreateFileParserCtxt(filename, encoding)
|
---|
1503 | if ret is None:raise parserError('htmlCreateFileParserCtxt() failed')
|
---|
1504 | return parserCtxt(_obj=ret)
|
---|
1505 |
|
---|
1506 | def htmlInitAutoClose():
|
---|
1507 | """Initialize the htmlStartCloseIndex for fast lookup of
|
---|
1508 | closing tags names. This is not reentrant. Call
|
---|
1509 | xmlInitParser() once before processing in case of use in
|
---|
1510 | multithreaded programs. """
|
---|
1511 | libxml2mod.htmlInitAutoClose()
|
---|
1512 |
|
---|
1513 | def isLetter(c):
|
---|
1514 | """Check whether the character is allowed by the production
|
---|
1515 | [84] Letter ::= BaseChar | Ideographic """
|
---|
1516 | ret = libxml2mod.xmlIsLetter(c)
|
---|
1517 | return ret
|
---|
1518 |
|
---|
1519 | def namePop(ctxt):
|
---|
1520 | """Pops the top element name from the name stack """
|
---|
1521 | if ctxt is None: ctxt__o = None
|
---|
1522 | else: ctxt__o = ctxt._o
|
---|
1523 | ret = libxml2mod.namePop(ctxt__o)
|
---|
1524 | return ret
|
---|
1525 |
|
---|
1526 | def namePush(ctxt, value):
|
---|
1527 | """Pushes a new element name on top of the name stack """
|
---|
1528 | if ctxt is None: ctxt__o = None
|
---|
1529 | else: ctxt__o = ctxt._o
|
---|
1530 | ret = libxml2mod.namePush(ctxt__o, value)
|
---|
1531 | return ret
|
---|
1532 |
|
---|
1533 | def nodePop(ctxt):
|
---|
1534 | """Pops the top element node from the node stack """
|
---|
1535 | if ctxt is None: ctxt__o = None
|
---|
1536 | else: ctxt__o = ctxt._o
|
---|
1537 | ret = libxml2mod.nodePop(ctxt__o)
|
---|
1538 | if ret is None:raise treeError('nodePop() failed')
|
---|
1539 | return xmlNode(_obj=ret)
|
---|
1540 |
|
---|
1541 | def nodePush(ctxt, value):
|
---|
1542 | """Pushes a new element node on top of the node stack """
|
---|
1543 | if ctxt is None: ctxt__o = None
|
---|
1544 | else: ctxt__o = ctxt._o
|
---|
1545 | if value is None: value__o = None
|
---|
1546 | else: value__o = value._o
|
---|
1547 | ret = libxml2mod.nodePush(ctxt__o, value__o)
|
---|
1548 | return ret
|
---|
1549 |
|
---|
1550 | #
|
---|
1551 | # Functions from module python
|
---|
1552 | #
|
---|
1553 |
|
---|
1554 | def SAXParseFile(SAX, URI, recover):
|
---|
1555 | """Interface to parse an XML file or resource pointed by an
|
---|
1556 | URI to build an event flow to the SAX object """
|
---|
1557 | libxml2mod.xmlSAXParseFile(SAX, URI, recover)
|
---|
1558 |
|
---|
1559 | def createInputBuffer(file, encoding):
|
---|
1560 | """Create a libxml2 input buffer from a Python file """
|
---|
1561 | ret = libxml2mod.xmlCreateInputBuffer(file, encoding)
|
---|
1562 | if ret is None:raise treeError('xmlCreateInputBuffer() failed')
|
---|
1563 | return inputBuffer(_obj=ret)
|
---|
1564 |
|
---|
1565 | def createOutputBuffer(file, encoding):
|
---|
1566 | """Create a libxml2 output buffer from a Python file """
|
---|
1567 | ret = libxml2mod.xmlCreateOutputBuffer(file, encoding)
|
---|
1568 | if ret is None:raise treeError('xmlCreateOutputBuffer() failed')
|
---|
1569 | return outputBuffer(_obj=ret)
|
---|
1570 |
|
---|
1571 | def createPushParser(SAX, chunk, size, URI):
|
---|
1572 | """Create a progressive XML parser context to build either an
|
---|
1573 | event flow if the SAX object is not None, or a DOM tree
|
---|
1574 | otherwise. """
|
---|
1575 | ret = libxml2mod.xmlCreatePushParser(SAX, chunk, size, URI)
|
---|
1576 | if ret is None:raise parserError('xmlCreatePushParser() failed')
|
---|
1577 | return parserCtxt(_obj=ret)
|
---|
1578 |
|
---|
1579 | def debugMemory(activate):
|
---|
1580 | """Switch on the generation of line number for elements nodes.
|
---|
1581 | Also returns the number of bytes allocated and not freed by
|
---|
1582 | libxml2 since memory debugging was switched on. """
|
---|
1583 | ret = libxml2mod.xmlDebugMemory(activate)
|
---|
1584 | return ret
|
---|
1585 |
|
---|
1586 | def dumpMemory():
|
---|
1587 | """dump the memory allocated in the file .memdump """
|
---|
1588 | libxml2mod.xmlDumpMemory()
|
---|
1589 |
|
---|
1590 | def htmlCreatePushParser(SAX, chunk, size, URI):
|
---|
1591 | """Create a progressive HTML parser context to build either an
|
---|
1592 | event flow if the SAX object is not None, or a DOM tree
|
---|
1593 | otherwise. """
|
---|
1594 | ret = libxml2mod.htmlCreatePushParser(SAX, chunk, size, URI)
|
---|
1595 | if ret is None:raise parserError('htmlCreatePushParser() failed')
|
---|
1596 | return parserCtxt(_obj=ret)
|
---|
1597 |
|
---|
1598 | def htmlSAXParseFile(SAX, URI, encoding):
|
---|
1599 | """Interface to parse an HTML file or resource pointed by an
|
---|
1600 | URI to build an event flow to the SAX object """
|
---|
1601 | libxml2mod.htmlSAXParseFile(SAX, URI, encoding)
|
---|
1602 |
|
---|
1603 | def memoryUsed():
|
---|
1604 | """Returns the total amount of memory allocated by libxml2 """
|
---|
1605 | ret = libxml2mod.xmlMemoryUsed()
|
---|
1606 | return ret
|
---|
1607 |
|
---|
1608 | def newNode(name):
|
---|
1609 | """Create a new Node """
|
---|
1610 | ret = libxml2mod.xmlNewNode(name)
|
---|
1611 | if ret is None:raise treeError('xmlNewNode() failed')
|
---|
1612 | return xmlNode(_obj=ret)
|
---|
1613 |
|
---|
1614 | def pythonCleanupParser():
|
---|
1615 | """Cleanup function for the XML library. It tries to reclaim
|
---|
1616 | all parsing related global memory allocated for the library
|
---|
1617 | processing. It doesn't deallocate any document related
|
---|
1618 | memory. Calling this function should not prevent reusing
|
---|
1619 | the library but one should call xmlCleanupParser() only
|
---|
1620 | when the process has finished using the library or XML
|
---|
1621 | document built with it. """
|
---|
1622 | libxml2mod.xmlPythonCleanupParser()
|
---|
1623 |
|
---|
1624 | def setEntityLoader(resolver):
|
---|
1625 | """Set the entity resolver as a python function """
|
---|
1626 | ret = libxml2mod.xmlSetEntityLoader(resolver)
|
---|
1627 | return ret
|
---|
1628 |
|
---|
1629 | #
|
---|
1630 | # Functions from module relaxng
|
---|
1631 | #
|
---|
1632 |
|
---|
1633 | def relaxNGCleanupTypes():
|
---|
1634 | """Cleanup the default Schemas type library associated to
|
---|
1635 | RelaxNG """
|
---|
1636 | libxml2mod.xmlRelaxNGCleanupTypes()
|
---|
1637 |
|
---|
1638 | def relaxNGInitTypes():
|
---|
1639 | """Initilize the default type libraries. """
|
---|
1640 | ret = libxml2mod.xmlRelaxNGInitTypes()
|
---|
1641 | return ret
|
---|
1642 |
|
---|
1643 | def relaxNGNewMemParserCtxt(buffer, size):
|
---|
1644 | """Create an XML RelaxNGs parse context for that memory buffer
|
---|
1645 | expected to contain an XML RelaxNGs file. """
|
---|
1646 | ret = libxml2mod.xmlRelaxNGNewMemParserCtxt(buffer, size)
|
---|
1647 | if ret is None:raise parserError('xmlRelaxNGNewMemParserCtxt() failed')
|
---|
1648 | return relaxNgParserCtxt(_obj=ret)
|
---|
1649 |
|
---|
1650 | def relaxNGNewParserCtxt(URL):
|
---|
1651 | """Create an XML RelaxNGs parse context for that file/resource
|
---|
1652 | expected to contain an XML RelaxNGs file. """
|
---|
1653 | ret = libxml2mod.xmlRelaxNGNewParserCtxt(URL)
|
---|
1654 | if ret is None:raise parserError('xmlRelaxNGNewParserCtxt() failed')
|
---|
1655 | return relaxNgParserCtxt(_obj=ret)
|
---|
1656 |
|
---|
1657 | #
|
---|
1658 | # Functions from module tree
|
---|
1659 | #
|
---|
1660 |
|
---|
1661 | def buildQName(ncname, prefix, memory, len):
|
---|
1662 | """Builds the QName @prefix:@ncname in @memory if there is
|
---|
1663 | enough space and prefix is not None nor empty, otherwise
|
---|
1664 | allocate a new string. If prefix is None or empty it
|
---|
1665 | returns ncname. """
|
---|
1666 | ret = libxml2mod.xmlBuildQName(ncname, prefix, memory, len)
|
---|
1667 | return ret
|
---|
1668 |
|
---|
1669 | def compressMode():
|
---|
1670 | """get the default compression mode used, ZLIB based. """
|
---|
1671 | ret = libxml2mod.xmlGetCompressMode()
|
---|
1672 | return ret
|
---|
1673 |
|
---|
1674 | def isXHTML(systemID, publicID):
|
---|
1675 | """Try to find if the document correspond to an XHTML DTD """
|
---|
1676 | ret = libxml2mod.xmlIsXHTML(systemID, publicID)
|
---|
1677 | return ret
|
---|
1678 |
|
---|
1679 | def newComment(content):
|
---|
1680 | """Creation of a new node containing a comment. """
|
---|
1681 | ret = libxml2mod.xmlNewComment(content)
|
---|
1682 | if ret is None:raise treeError('xmlNewComment() failed')
|
---|
1683 | return xmlNode(_obj=ret)
|
---|
1684 |
|
---|
1685 | def newDoc(version):
|
---|
1686 | """Creates a new XML document """
|
---|
1687 | ret = libxml2mod.xmlNewDoc(version)
|
---|
1688 | if ret is None:raise treeError('xmlNewDoc() failed')
|
---|
1689 | return xmlDoc(_obj=ret)
|
---|
1690 |
|
---|
1691 | def newPI(name, content):
|
---|
1692 | """Creation of a processing instruction element. Use
|
---|
1693 | xmlDocNewPI preferably to get string interning """
|
---|
1694 | ret = libxml2mod.xmlNewPI(name, content)
|
---|
1695 | if ret is None:raise treeError('xmlNewPI() failed')
|
---|
1696 | return xmlNode(_obj=ret)
|
---|
1697 |
|
---|
1698 | def newText(content):
|
---|
1699 | """Creation of a new text node. """
|
---|
1700 | ret = libxml2mod.xmlNewText(content)
|
---|
1701 | if ret is None:raise treeError('xmlNewText() failed')
|
---|
1702 | return xmlNode(_obj=ret)
|
---|
1703 |
|
---|
1704 | def newTextLen(content, len):
|
---|
1705 | """Creation of a new text node with an extra parameter for the
|
---|
1706 | content's length """
|
---|
1707 | ret = libxml2mod.xmlNewTextLen(content, len)
|
---|
1708 | if ret is None:raise treeError('xmlNewTextLen() failed')
|
---|
1709 | return xmlNode(_obj=ret)
|
---|
1710 |
|
---|
1711 | def setCompressMode(mode):
|
---|
1712 | """set the default compression mode used, ZLIB based Correct
|
---|
1713 | values: 0 (uncompressed) to 9 (max compression) """
|
---|
1714 | libxml2mod.xmlSetCompressMode(mode)
|
---|
1715 |
|
---|
1716 | def validateNCName(value, space):
|
---|
1717 | """Check that a value conforms to the lexical space of NCName """
|
---|
1718 | ret = libxml2mod.xmlValidateNCName(value, space)
|
---|
1719 | return ret
|
---|
1720 |
|
---|
1721 | def validateNMToken(value, space):
|
---|
1722 | """Check that a value conforms to the lexical space of NMToken """
|
---|
1723 | ret = libxml2mod.xmlValidateNMToken(value, space)
|
---|
1724 | return ret
|
---|
1725 |
|
---|
1726 | def validateName(value, space):
|
---|
1727 | """Check that a value conforms to the lexical space of Name """
|
---|
1728 | ret = libxml2mod.xmlValidateName(value, space)
|
---|
1729 | return ret
|
---|
1730 |
|
---|
1731 | def validateQName(value, space):
|
---|
1732 | """Check that a value conforms to the lexical space of QName """
|
---|
1733 | ret = libxml2mod.xmlValidateQName(value, space)
|
---|
1734 | return ret
|
---|
1735 |
|
---|
1736 | #
|
---|
1737 | # Functions from module uri
|
---|
1738 | #
|
---|
1739 |
|
---|
1740 | def URIEscape(str):
|
---|
1741 | """Escaping routine, does not do validity checks ! It will try
|
---|
1742 | to escape the chars needing this, but this is heuristic
|
---|
1743 | based it's impossible to be sure. """
|
---|
1744 | ret = libxml2mod.xmlURIEscape(str)
|
---|
1745 | return ret
|
---|
1746 |
|
---|
1747 | def URIEscapeStr(str, list):
|
---|
1748 | """This routine escapes a string to hex, ignoring reserved
|
---|
1749 | characters (a-z) and the characters in the exception list. """
|
---|
1750 | ret = libxml2mod.xmlURIEscapeStr(str, list)
|
---|
1751 | return ret
|
---|
1752 |
|
---|
1753 | def URIUnescapeString(str, len, target):
|
---|
1754 | """Unescaping routine, but does not check that the string is
|
---|
1755 | an URI. The output is a direct unsigned char translation of
|
---|
1756 | %XX values (no encoding) Note that the length of the result
|
---|
1757 | can only be smaller or same size as the input string. """
|
---|
1758 | ret = libxml2mod.xmlURIUnescapeString(str, len, target)
|
---|
1759 | return ret
|
---|
1760 |
|
---|
1761 | def buildRelativeURI(URI, base):
|
---|
1762 | """Expresses the URI of the reference in terms relative to the
|
---|
1763 | base. Some examples of this operation include: base =
|
---|
1764 | "http://site1.com/docs/book1.html" URI input
|
---|
1765 | URI returned docs/pic1.gif pic1.gif
|
---|
1766 | docs/img/pic1.gif img/pic1.gif img/pic1.gif
|
---|
1767 | ../img/pic1.gif http://site1.com/docs/pic1.gif pic1.gif
|
---|
1768 | http://site2.com/docs/pic1.gif
|
---|
1769 | http://site2.com/docs/pic1.gif base = "docs/book1.html"
|
---|
1770 | URI input URI returned docs/pic1.gif
|
---|
1771 | pic1.gif docs/img/pic1.gif img/pic1.gif
|
---|
1772 | img/pic1.gif ../img/pic1.gif
|
---|
1773 | http://site1.com/docs/pic1.gif
|
---|
1774 | http://site1.com/docs/pic1.gif Note: if the URI reference
|
---|
1775 | is really wierd or complicated, it may be worthwhile to
|
---|
1776 | first convert it into a "nice" one by calling xmlBuildURI
|
---|
1777 | (using 'base') before calling this routine, since this
|
---|
1778 | routine (for reasonable efficiency) assumes URI has already
|
---|
1779 | been through some validation. """
|
---|
1780 | ret = libxml2mod.xmlBuildRelativeURI(URI, base)
|
---|
1781 | return ret
|
---|
1782 |
|
---|
1783 | def buildURI(URI, base):
|
---|
1784 | """Computes he final URI of the reference done by checking
|
---|
1785 | that the given URI is valid, and building the final URI
|
---|
1786 | using the base URI. This is processed according to section
|
---|
1787 | 5.2 of the RFC 2396 5.2. Resolving Relative References to
|
---|
1788 | Absolute Form """
|
---|
1789 | ret = libxml2mod.xmlBuildURI(URI, base)
|
---|
1790 | return ret
|
---|
1791 |
|
---|
1792 | def canonicPath(path):
|
---|
1793 | """Constructs a canonic path from the specified path. """
|
---|
1794 | ret = libxml2mod.xmlCanonicPath(path)
|
---|
1795 | return ret
|
---|
1796 |
|
---|
1797 | def createURI():
|
---|
1798 | """Simply creates an empty xmlURI """
|
---|
1799 | ret = libxml2mod.xmlCreateURI()
|
---|
1800 | if ret is None:raise uriError('xmlCreateURI() failed')
|
---|
1801 | return URI(_obj=ret)
|
---|
1802 |
|
---|
1803 | def normalizeURIPath(path):
|
---|
1804 | """Applies the 5 normalization steps to a path string--that
|
---|
1805 | is, RFC 2396 Section 5.2, steps 6.c through 6.g.
|
---|
1806 | Normalization occurs directly on the string, no new
|
---|
1807 | allocation is done """
|
---|
1808 | ret = libxml2mod.xmlNormalizeURIPath(path)
|
---|
1809 | return ret
|
---|
1810 |
|
---|
1811 | def parseURI(str):
|
---|
1812 | """Parse an URI based on RFC 3986 URI-reference = [
|
---|
1813 | absoluteURI | relativeURI ] [ "#" fragment ] """
|
---|
1814 | ret = libxml2mod.xmlParseURI(str)
|
---|
1815 | if ret is None:raise uriError('xmlParseURI() failed')
|
---|
1816 | return URI(_obj=ret)
|
---|
1817 |
|
---|
1818 | def parseURIRaw(str, raw):
|
---|
1819 | """Parse an URI but allows to keep intact the original
|
---|
1820 | fragments. URI-reference = URI / relative-ref """
|
---|
1821 | ret = libxml2mod.xmlParseURIRaw(str, raw)
|
---|
1822 | if ret is None:raise uriError('xmlParseURIRaw() failed')
|
---|
1823 | return URI(_obj=ret)
|
---|
1824 |
|
---|
1825 | def pathToURI(path):
|
---|
1826 | """Constructs an URI expressing the existing path """
|
---|
1827 | ret = libxml2mod.xmlPathToURI(path)
|
---|
1828 | return ret
|
---|
1829 |
|
---|
1830 | #
|
---|
1831 | # Functions from module valid
|
---|
1832 | #
|
---|
1833 |
|
---|
1834 | def newValidCtxt():
|
---|
1835 | """Allocate a validation context structure. """
|
---|
1836 | ret = libxml2mod.xmlNewValidCtxt()
|
---|
1837 | if ret is None:raise treeError('xmlNewValidCtxt() failed')
|
---|
1838 | return ValidCtxt(_obj=ret)
|
---|
1839 |
|
---|
1840 | def validateNameValue(value):
|
---|
1841 | """Validate that the given value match Name production """
|
---|
1842 | ret = libxml2mod.xmlValidateNameValue(value)
|
---|
1843 | return ret
|
---|
1844 |
|
---|
1845 | def validateNamesValue(value):
|
---|
1846 | """Validate that the given value match Names production """
|
---|
1847 | ret = libxml2mod.xmlValidateNamesValue(value)
|
---|
1848 | return ret
|
---|
1849 |
|
---|
1850 | def validateNmtokenValue(value):
|
---|
1851 | """Validate that the given value match Nmtoken production [
|
---|
1852 | VC: Name Token ] """
|
---|
1853 | ret = libxml2mod.xmlValidateNmtokenValue(value)
|
---|
1854 | return ret
|
---|
1855 |
|
---|
1856 | def validateNmtokensValue(value):
|
---|
1857 | """Validate that the given value match Nmtokens production [
|
---|
1858 | VC: Name Token ] """
|
---|
1859 | ret = libxml2mod.xmlValidateNmtokensValue(value)
|
---|
1860 | return ret
|
---|
1861 |
|
---|
1862 | #
|
---|
1863 | # Functions from module xmlIO
|
---|
1864 | #
|
---|
1865 |
|
---|
1866 | def checkFilename(path):
|
---|
1867 | """function checks to see if @path is a valid source (file,
|
---|
1868 | socket...) for XML. if stat is not available on the target
|
---|
1869 | machine, """
|
---|
1870 | ret = libxml2mod.xmlCheckFilename(path)
|
---|
1871 | return ret
|
---|
1872 |
|
---|
1873 | def cleanupInputCallbacks():
|
---|
1874 | """clears the entire input callback table. this includes the
|
---|
1875 | compiled-in I/O. """
|
---|
1876 | libxml2mod.xmlCleanupInputCallbacks()
|
---|
1877 |
|
---|
1878 | def cleanupOutputCallbacks():
|
---|
1879 | """clears the entire output callback table. this includes the
|
---|
1880 | compiled-in I/O callbacks. """
|
---|
1881 | libxml2mod.xmlCleanupOutputCallbacks()
|
---|
1882 |
|
---|
1883 | def fileMatch(filename):
|
---|
1884 | """input from FILE * """
|
---|
1885 | ret = libxml2mod.xmlFileMatch(filename)
|
---|
1886 | return ret
|
---|
1887 |
|
---|
1888 | def iOFTPMatch(filename):
|
---|
1889 | """check if the URI matches an FTP one """
|
---|
1890 | ret = libxml2mod.xmlIOFTPMatch(filename)
|
---|
1891 | return ret
|
---|
1892 |
|
---|
1893 | def iOHTTPMatch(filename):
|
---|
1894 | """check if the URI matches an HTTP one """
|
---|
1895 | ret = libxml2mod.xmlIOHTTPMatch(filename)
|
---|
1896 | return ret
|
---|
1897 |
|
---|
1898 | def normalizeWindowsPath(path):
|
---|
1899 | """This function is obsolete. Please see xmlURIFromPath in
|
---|
1900 | uri.c for a better solution. """
|
---|
1901 | ret = libxml2mod.xmlNormalizeWindowsPath(path)
|
---|
1902 | return ret
|
---|
1903 |
|
---|
1904 | def parserGetDirectory(filename):
|
---|
1905 | """lookup the directory for that file """
|
---|
1906 | ret = libxml2mod.xmlParserGetDirectory(filename)
|
---|
1907 | return ret
|
---|
1908 |
|
---|
1909 | def registerDefaultInputCallbacks():
|
---|
1910 | """Registers the default compiled-in I/O handlers. """
|
---|
1911 | libxml2mod.xmlRegisterDefaultInputCallbacks()
|
---|
1912 |
|
---|
1913 | def registerDefaultOutputCallbacks():
|
---|
1914 | """Registers the default compiled-in I/O handlers. """
|
---|
1915 | libxml2mod.xmlRegisterDefaultOutputCallbacks()
|
---|
1916 |
|
---|
1917 | def registerHTTPPostCallbacks():
|
---|
1918 | """By default, libxml submits HTTP output requests using the
|
---|
1919 | "PUT" method. Calling this method changes the HTTP output
|
---|
1920 | method to use the "POST" method instead. """
|
---|
1921 | libxml2mod.xmlRegisterHTTPPostCallbacks()
|
---|
1922 |
|
---|
1923 | #
|
---|
1924 | # Functions from module xmlerror
|
---|
1925 | #
|
---|
1926 |
|
---|
1927 | def lastError():
|
---|
1928 | """Get the last global error registered. This is per thread if
|
---|
1929 | compiled with thread support. """
|
---|
1930 | ret = libxml2mod.xmlGetLastError()
|
---|
1931 | if ret is None:raise treeError('xmlGetLastError() failed')
|
---|
1932 | return Error(_obj=ret)
|
---|
1933 |
|
---|
1934 | def resetLastError():
|
---|
1935 | """Cleanup the last global error registered. For parsing error
|
---|
1936 | this does not change the well-formedness result. """
|
---|
1937 | libxml2mod.xmlResetLastError()
|
---|
1938 |
|
---|
1939 | #
|
---|
1940 | # Functions from module xmlreader
|
---|
1941 | #
|
---|
1942 |
|
---|
1943 | def newTextReaderFilename(URI):
|
---|
1944 | """Create an xmlTextReader structure fed with the resource at
|
---|
1945 | @URI """
|
---|
1946 | ret = libxml2mod.xmlNewTextReaderFilename(URI)
|
---|
1947 | if ret is None:raise treeError('xmlNewTextReaderFilename() failed')
|
---|
1948 | return xmlTextReader(_obj=ret)
|
---|
1949 |
|
---|
1950 | def readerForDoc(cur, URL, encoding, options):
|
---|
1951 | """Create an xmltextReader for an XML in-memory document. The
|
---|
1952 | parsing flags @options are a combination of xmlParserOption. """
|
---|
1953 | ret = libxml2mod.xmlReaderForDoc(cur, URL, encoding, options)
|
---|
1954 | if ret is None:raise treeError('xmlReaderForDoc() failed')
|
---|
1955 | return xmlTextReader(_obj=ret)
|
---|
1956 |
|
---|
1957 | def readerForFd(fd, URL, encoding, options):
|
---|
1958 | """Create an xmltextReader for an XML from a file descriptor.
|
---|
1959 | The parsing flags @options are a combination of
|
---|
1960 | xmlParserOption. NOTE that the file descriptor will not be
|
---|
1961 | closed when the reader is closed or reset. """
|
---|
1962 | ret = libxml2mod.xmlReaderForFd(fd, URL, encoding, options)
|
---|
1963 | if ret is None:raise treeError('xmlReaderForFd() failed')
|
---|
1964 | return xmlTextReader(_obj=ret)
|
---|
1965 |
|
---|
1966 | def readerForFile(filename, encoding, options):
|
---|
1967 | """parse an XML file from the filesystem or the network. The
|
---|
1968 | parsing flags @options are a combination of xmlParserOption. """
|
---|
1969 | ret = libxml2mod.xmlReaderForFile(filename, encoding, options)
|
---|
1970 | if ret is None:raise treeError('xmlReaderForFile() failed')
|
---|
1971 | return xmlTextReader(_obj=ret)
|
---|
1972 |
|
---|
1973 | def readerForMemory(buffer, size, URL, encoding, options):
|
---|
1974 | """Create an xmltextReader for an XML in-memory document. The
|
---|
1975 | parsing flags @options are a combination of xmlParserOption. """
|
---|
1976 | ret = libxml2mod.xmlReaderForMemory(buffer, size, URL, encoding, options)
|
---|
1977 | if ret is None:raise treeError('xmlReaderForMemory() failed')
|
---|
1978 | return xmlTextReader(_obj=ret)
|
---|
1979 |
|
---|
1980 | #
|
---|
1981 | # Functions from module xmlregexp
|
---|
1982 | #
|
---|
1983 |
|
---|
1984 | def regexpCompile(regexp):
|
---|
1985 | """Parses a regular expression conforming to XML Schemas Part
|
---|
1986 | 2 Datatype Appendix F and builds an automata suitable for
|
---|
1987 | testing strings against that regular expression """
|
---|
1988 | ret = libxml2mod.xmlRegexpCompile(regexp)
|
---|
1989 | if ret is None:raise treeError('xmlRegexpCompile() failed')
|
---|
1990 | return xmlReg(_obj=ret)
|
---|
1991 |
|
---|
1992 | #
|
---|
1993 | # Functions from module xmlschemas
|
---|
1994 | #
|
---|
1995 |
|
---|
1996 | def schemaNewMemParserCtxt(buffer, size):
|
---|
1997 | """Create an XML Schemas parse context for that memory buffer
|
---|
1998 | expected to contain an XML Schemas file. """
|
---|
1999 | ret = libxml2mod.xmlSchemaNewMemParserCtxt(buffer, size)
|
---|
2000 | if ret is None:raise parserError('xmlSchemaNewMemParserCtxt() failed')
|
---|
2001 | return SchemaParserCtxt(_obj=ret)
|
---|
2002 |
|
---|
2003 | def schemaNewParserCtxt(URL):
|
---|
2004 | """Create an XML Schemas parse context for that file/resource
|
---|
2005 | expected to contain an XML Schemas file. """
|
---|
2006 | ret = libxml2mod.xmlSchemaNewParserCtxt(URL)
|
---|
2007 | if ret is None:raise parserError('xmlSchemaNewParserCtxt() failed')
|
---|
2008 | return SchemaParserCtxt(_obj=ret)
|
---|
2009 |
|
---|
2010 | #
|
---|
2011 | # Functions from module xmlschemastypes
|
---|
2012 | #
|
---|
2013 |
|
---|
2014 | def schemaCleanupTypes():
|
---|
2015 | """Cleanup the default XML Schemas type library """
|
---|
2016 | libxml2mod.xmlSchemaCleanupTypes()
|
---|
2017 |
|
---|
2018 | def schemaCollapseString(value):
|
---|
2019 | """Removes and normalize white spaces in the string """
|
---|
2020 | ret = libxml2mod.xmlSchemaCollapseString(value)
|
---|
2021 | return ret
|
---|
2022 |
|
---|
2023 | def schemaInitTypes():
|
---|
2024 | """Initialize the default XML Schemas type library """
|
---|
2025 | libxml2mod.xmlSchemaInitTypes()
|
---|
2026 |
|
---|
2027 | def schemaWhiteSpaceReplace(value):
|
---|
2028 | """Replaces 0xd, 0x9 and 0xa with a space. """
|
---|
2029 | ret = libxml2mod.xmlSchemaWhiteSpaceReplace(value)
|
---|
2030 | return ret
|
---|
2031 |
|
---|
2032 | #
|
---|
2033 | # Functions from module xmlstring
|
---|
2034 | #
|
---|
2035 |
|
---|
2036 | def UTF8Charcmp(utf1, utf2):
|
---|
2037 | """compares the two UCS4 values """
|
---|
2038 | ret = libxml2mod.xmlUTF8Charcmp(utf1, utf2)
|
---|
2039 | return ret
|
---|
2040 |
|
---|
2041 | def UTF8Size(utf):
|
---|
2042 | """calculates the internal size of a UTF8 character """
|
---|
2043 | ret = libxml2mod.xmlUTF8Size(utf)
|
---|
2044 | return ret
|
---|
2045 |
|
---|
2046 | def UTF8Strlen(utf):
|
---|
2047 | """compute the length of an UTF8 string, it doesn't do a full
|
---|
2048 | UTF8 checking of the content of the string. """
|
---|
2049 | ret = libxml2mod.xmlUTF8Strlen(utf)
|
---|
2050 | return ret
|
---|
2051 |
|
---|
2052 | def UTF8Strloc(utf, utfchar):
|
---|
2053 | """a function to provide the relative location of a UTF8 char """
|
---|
2054 | ret = libxml2mod.xmlUTF8Strloc(utf, utfchar)
|
---|
2055 | return ret
|
---|
2056 |
|
---|
2057 | def UTF8Strndup(utf, len):
|
---|
2058 | """a strndup for array of UTF8's """
|
---|
2059 | ret = libxml2mod.xmlUTF8Strndup(utf, len)
|
---|
2060 | return ret
|
---|
2061 |
|
---|
2062 | def UTF8Strpos(utf, pos):
|
---|
2063 | """a function to provide the equivalent of fetching a
|
---|
2064 | character from a string array """
|
---|
2065 | ret = libxml2mod.xmlUTF8Strpos(utf, pos)
|
---|
2066 | return ret
|
---|
2067 |
|
---|
2068 | def UTF8Strsize(utf, len):
|
---|
2069 | """storage size of an UTF8 string the behaviour is not
|
---|
2070 | garanteed if the input string is not UTF-8 """
|
---|
2071 | ret = libxml2mod.xmlUTF8Strsize(utf, len)
|
---|
2072 | return ret
|
---|
2073 |
|
---|
2074 | def UTF8Strsub(utf, start, len):
|
---|
2075 | """Create a substring from a given UTF-8 string Note:
|
---|
2076 | positions are given in units of UTF-8 chars """
|
---|
2077 | ret = libxml2mod.xmlUTF8Strsub(utf, start, len)
|
---|
2078 | return ret
|
---|
2079 |
|
---|
2080 | def checkUTF8(utf):
|
---|
2081 | """Checks @utf for being valid UTF-8. @utf is assumed to be
|
---|
2082 | null-terminated. This function is not super-strict, as it
|
---|
2083 | will allow longer UTF-8 sequences than necessary. Note that
|
---|
2084 | Java is capable of producing these sequences if provoked.
|
---|
2085 | Also note, this routine checks for the 4-byte maximum size,
|
---|
2086 | but does not check for 0x10ffff maximum value. """
|
---|
2087 | ret = libxml2mod.xmlCheckUTF8(utf)
|
---|
2088 | return ret
|
---|
2089 |
|
---|
2090 | #
|
---|
2091 | # Functions from module xmlunicode
|
---|
2092 | #
|
---|
2093 |
|
---|
2094 | def uCSIsAegeanNumbers(code):
|
---|
2095 | """Check whether the character is part of AegeanNumbers UCS
|
---|
2096 | Block """
|
---|
2097 | ret = libxml2mod.xmlUCSIsAegeanNumbers(code)
|
---|
2098 | return ret
|
---|
2099 |
|
---|
2100 | def uCSIsAlphabeticPresentationForms(code):
|
---|
2101 | """Check whether the character is part of
|
---|
2102 | AlphabeticPresentationForms UCS Block """
|
---|
2103 | ret = libxml2mod.xmlUCSIsAlphabeticPresentationForms(code)
|
---|
2104 | return ret
|
---|
2105 |
|
---|
2106 | def uCSIsArabic(code):
|
---|
2107 | """Check whether the character is part of Arabic UCS Block """
|
---|
2108 | ret = libxml2mod.xmlUCSIsArabic(code)
|
---|
2109 | return ret
|
---|
2110 |
|
---|
2111 | def uCSIsArabicPresentationFormsA(code):
|
---|
2112 | """Check whether the character is part of
|
---|
2113 | ArabicPresentationForms-A UCS Block """
|
---|
2114 | ret = libxml2mod.xmlUCSIsArabicPresentationFormsA(code)
|
---|
2115 | return ret
|
---|
2116 |
|
---|
2117 | def uCSIsArabicPresentationFormsB(code):
|
---|
2118 | """Check whether the character is part of
|
---|
2119 | ArabicPresentationForms-B UCS Block """
|
---|
2120 | ret = libxml2mod.xmlUCSIsArabicPresentationFormsB(code)
|
---|
2121 | return ret
|
---|
2122 |
|
---|
2123 | def uCSIsArmenian(code):
|
---|
2124 | """Check whether the character is part of Armenian UCS Block """
|
---|
2125 | ret = libxml2mod.xmlUCSIsArmenian(code)
|
---|
2126 | return ret
|
---|
2127 |
|
---|
2128 | def uCSIsArrows(code):
|
---|
2129 | """Check whether the character is part of Arrows UCS Block """
|
---|
2130 | ret = libxml2mod.xmlUCSIsArrows(code)
|
---|
2131 | return ret
|
---|
2132 |
|
---|
2133 | def uCSIsBasicLatin(code):
|
---|
2134 | """Check whether the character is part of BasicLatin UCS Block """
|
---|
2135 | ret = libxml2mod.xmlUCSIsBasicLatin(code)
|
---|
2136 | return ret
|
---|
2137 |
|
---|
2138 | def uCSIsBengali(code):
|
---|
2139 | """Check whether the character is part of Bengali UCS Block """
|
---|
2140 | ret = libxml2mod.xmlUCSIsBengali(code)
|
---|
2141 | return ret
|
---|
2142 |
|
---|
2143 | def uCSIsBlock(code, block):
|
---|
2144 | """Check whether the character is part of the UCS Block """
|
---|
2145 | ret = libxml2mod.xmlUCSIsBlock(code, block)
|
---|
2146 | return ret
|
---|
2147 |
|
---|
2148 | def uCSIsBlockElements(code):
|
---|
2149 | """Check whether the character is part of BlockElements UCS
|
---|
2150 | Block """
|
---|
2151 | ret = libxml2mod.xmlUCSIsBlockElements(code)
|
---|
2152 | return ret
|
---|
2153 |
|
---|
2154 | def uCSIsBopomofo(code):
|
---|
2155 | """Check whether the character is part of Bopomofo UCS Block """
|
---|
2156 | ret = libxml2mod.xmlUCSIsBopomofo(code)
|
---|
2157 | return ret
|
---|
2158 |
|
---|
2159 | def uCSIsBopomofoExtended(code):
|
---|
2160 | """Check whether the character is part of BopomofoExtended UCS
|
---|
2161 | Block """
|
---|
2162 | ret = libxml2mod.xmlUCSIsBopomofoExtended(code)
|
---|
2163 | return ret
|
---|
2164 |
|
---|
2165 | def uCSIsBoxDrawing(code):
|
---|
2166 | """Check whether the character is part of BoxDrawing UCS Block """
|
---|
2167 | ret = libxml2mod.xmlUCSIsBoxDrawing(code)
|
---|
2168 | return ret
|
---|
2169 |
|
---|
2170 | def uCSIsBraillePatterns(code):
|
---|
2171 | """Check whether the character is part of BraillePatterns UCS
|
---|
2172 | Block """
|
---|
2173 | ret = libxml2mod.xmlUCSIsBraillePatterns(code)
|
---|
2174 | return ret
|
---|
2175 |
|
---|
2176 | def uCSIsBuhid(code):
|
---|
2177 | """Check whether the character is part of Buhid UCS Block """
|
---|
2178 | ret = libxml2mod.xmlUCSIsBuhid(code)
|
---|
2179 | return ret
|
---|
2180 |
|
---|
2181 | def uCSIsByzantineMusicalSymbols(code):
|
---|
2182 | """Check whether the character is part of
|
---|
2183 | ByzantineMusicalSymbols UCS Block """
|
---|
2184 | ret = libxml2mod.xmlUCSIsByzantineMusicalSymbols(code)
|
---|
2185 | return ret
|
---|
2186 |
|
---|
2187 | def uCSIsCJKCompatibility(code):
|
---|
2188 | """Check whether the character is part of CJKCompatibility UCS
|
---|
2189 | Block """
|
---|
2190 | ret = libxml2mod.xmlUCSIsCJKCompatibility(code)
|
---|
2191 | return ret
|
---|
2192 |
|
---|
2193 | def uCSIsCJKCompatibilityForms(code):
|
---|
2194 | """Check whether the character is part of
|
---|
2195 | CJKCompatibilityForms UCS Block """
|
---|
2196 | ret = libxml2mod.xmlUCSIsCJKCompatibilityForms(code)
|
---|
2197 | return ret
|
---|
2198 |
|
---|
2199 | def uCSIsCJKCompatibilityIdeographs(code):
|
---|
2200 | """Check whether the character is part of
|
---|
2201 | CJKCompatibilityIdeographs UCS Block """
|
---|
2202 | ret = libxml2mod.xmlUCSIsCJKCompatibilityIdeographs(code)
|
---|
2203 | return ret
|
---|
2204 |
|
---|
2205 | def uCSIsCJKCompatibilityIdeographsSupplement(code):
|
---|
2206 | """Check whether the character is part of
|
---|
2207 | CJKCompatibilityIdeographsSupplement UCS Block """
|
---|
2208 | ret = libxml2mod.xmlUCSIsCJKCompatibilityIdeographsSupplement(code)
|
---|
2209 | return ret
|
---|
2210 |
|
---|
2211 | def uCSIsCJKRadicalsSupplement(code):
|
---|
2212 | """Check whether the character is part of
|
---|
2213 | CJKRadicalsSupplement UCS Block """
|
---|
2214 | ret = libxml2mod.xmlUCSIsCJKRadicalsSupplement(code)
|
---|
2215 | return ret
|
---|
2216 |
|
---|
2217 | def uCSIsCJKSymbolsandPunctuation(code):
|
---|
2218 | """Check whether the character is part of
|
---|
2219 | CJKSymbolsandPunctuation UCS Block """
|
---|
2220 | ret = libxml2mod.xmlUCSIsCJKSymbolsandPunctuation(code)
|
---|
2221 | return ret
|
---|
2222 |
|
---|
2223 | def uCSIsCJKUnifiedIdeographs(code):
|
---|
2224 | """Check whether the character is part of CJKUnifiedIdeographs
|
---|
2225 | UCS Block """
|
---|
2226 | ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographs(code)
|
---|
2227 | return ret
|
---|
2228 |
|
---|
2229 | def uCSIsCJKUnifiedIdeographsExtensionA(code):
|
---|
2230 | """Check whether the character is part of
|
---|
2231 | CJKUnifiedIdeographsExtensionA UCS Block """
|
---|
2232 | ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographsExtensionA(code)
|
---|
2233 | return ret
|
---|
2234 |
|
---|
2235 | def uCSIsCJKUnifiedIdeographsExtensionB(code):
|
---|
2236 | """Check whether the character is part of
|
---|
2237 | CJKUnifiedIdeographsExtensionB UCS Block """
|
---|
2238 | ret = libxml2mod.xmlUCSIsCJKUnifiedIdeographsExtensionB(code)
|
---|
2239 | return ret
|
---|
2240 |
|
---|
2241 | def uCSIsCat(code, cat):
|
---|
2242 | """Check whether the character is part of the UCS Category """
|
---|
2243 | ret = libxml2mod.xmlUCSIsCat(code, cat)
|
---|
2244 | return ret
|
---|
2245 |
|
---|
2246 | def uCSIsCatC(code):
|
---|
2247 | """Check whether the character is part of C UCS Category """
|
---|
2248 | ret = libxml2mod.xmlUCSIsCatC(code)
|
---|
2249 | return ret
|
---|
2250 |
|
---|
2251 | def uCSIsCatCc(code):
|
---|
2252 | """Check whether the character is part of Cc UCS Category """
|
---|
2253 | ret = libxml2mod.xmlUCSIsCatCc(code)
|
---|
2254 | return ret
|
---|
2255 |
|
---|
2256 | def uCSIsCatCf(code):
|
---|
2257 | """Check whether the character is part of Cf UCS Category """
|
---|
2258 | ret = libxml2mod.xmlUCSIsCatCf(code)
|
---|
2259 | return ret
|
---|
2260 |
|
---|
2261 | def uCSIsCatCo(code):
|
---|
2262 | """Check whether the character is part of Co UCS Category """
|
---|
2263 | ret = libxml2mod.xmlUCSIsCatCo(code)
|
---|
2264 | return ret
|
---|
2265 |
|
---|
2266 | def uCSIsCatCs(code):
|
---|
2267 | """Check whether the character is part of Cs UCS Category """
|
---|
2268 | ret = libxml2mod.xmlUCSIsCatCs(code)
|
---|
2269 | return ret
|
---|
2270 |
|
---|
2271 | def uCSIsCatL(code):
|
---|
2272 | """Check whether the character is part of L UCS Category """
|
---|
2273 | ret = libxml2mod.xmlUCSIsCatL(code)
|
---|
2274 | return ret
|
---|
2275 |
|
---|
2276 | def uCSIsCatLl(code):
|
---|
2277 | """Check whether the character is part of Ll UCS Category """
|
---|
2278 | ret = libxml2mod.xmlUCSIsCatLl(code)
|
---|
2279 | return ret
|
---|
2280 |
|
---|
2281 | def uCSIsCatLm(code):
|
---|
2282 | """Check whether the character is part of Lm UCS Category """
|
---|
2283 | ret = libxml2mod.xmlUCSIsCatLm(code)
|
---|
2284 | return ret
|
---|
2285 |
|
---|
2286 | def uCSIsCatLo(code):
|
---|
2287 | """Check whether the character is part of Lo UCS Category """
|
---|
2288 | ret = libxml2mod.xmlUCSIsCatLo(code)
|
---|
2289 | return ret
|
---|
2290 |
|
---|
2291 | def uCSIsCatLt(code):
|
---|
2292 | """Check whether the character is part of Lt UCS Category """
|
---|
2293 | ret = libxml2mod.xmlUCSIsCatLt(code)
|
---|
2294 | return ret
|
---|
2295 |
|
---|
2296 | def uCSIsCatLu(code):
|
---|
2297 | """Check whether the character is part of Lu UCS Category """
|
---|
2298 | ret = libxml2mod.xmlUCSIsCatLu(code)
|
---|
2299 | return ret
|
---|
2300 |
|
---|
2301 | def uCSIsCatM(code):
|
---|
2302 | """Check whether the character is part of M UCS Category """
|
---|
2303 | ret = libxml2mod.xmlUCSIsCatM(code)
|
---|
2304 | return ret
|
---|
2305 |
|
---|
2306 | def uCSIsCatMc(code):
|
---|
2307 | """Check whether the character is part of Mc UCS Category """
|
---|
2308 | ret = libxml2mod.xmlUCSIsCatMc(code)
|
---|
2309 | return ret
|
---|
2310 |
|
---|
2311 | def uCSIsCatMe(code):
|
---|
2312 | """Check whether the character is part of Me UCS Category """
|
---|
2313 | ret = libxml2mod.xmlUCSIsCatMe(code)
|
---|
2314 | return ret
|
---|
2315 |
|
---|
2316 | def uCSIsCatMn(code):
|
---|
2317 | """Check whether the character is part of Mn UCS Category """
|
---|
2318 | ret = libxml2mod.xmlUCSIsCatMn(code)
|
---|
2319 | return ret
|
---|
2320 |
|
---|
2321 | def uCSIsCatN(code):
|
---|
2322 | """Check whether the character is part of N UCS Category """
|
---|
2323 | ret = libxml2mod.xmlUCSIsCatN(code)
|
---|
2324 | return ret
|
---|
2325 |
|
---|
2326 | def uCSIsCatNd(code):
|
---|
2327 | """Check whether the character is part of Nd UCS Category """
|
---|
2328 | ret = libxml2mod.xmlUCSIsCatNd(code)
|
---|
2329 | return ret
|
---|
2330 |
|
---|
2331 | def uCSIsCatNl(code):
|
---|
2332 | """Check whether the character is part of Nl UCS Category """
|
---|
2333 | ret = libxml2mod.xmlUCSIsCatNl(code)
|
---|
2334 | return ret
|
---|
2335 |
|
---|
2336 | def uCSIsCatNo(code):
|
---|
2337 | """Check whether the character is part of No UCS Category """
|
---|
2338 | ret = libxml2mod.xmlUCSIsCatNo(code)
|
---|
2339 | return ret
|
---|
2340 |
|
---|
2341 | def uCSIsCatP(code):
|
---|
2342 | """Check whether the character is part of P UCS Category """
|
---|
2343 | ret = libxml2mod.xmlUCSIsCatP(code)
|
---|
2344 | return ret
|
---|
2345 |
|
---|
2346 | def uCSIsCatPc(code):
|
---|
2347 | """Check whether the character is part of Pc UCS Category """
|
---|
2348 | ret = libxml2mod.xmlUCSIsCatPc(code)
|
---|
2349 | return ret
|
---|
2350 |
|
---|
2351 | def uCSIsCatPd(code):
|
---|
2352 | """Check whether the character is part of Pd UCS Category """
|
---|
2353 | ret = libxml2mod.xmlUCSIsCatPd(code)
|
---|
2354 | return ret
|
---|
2355 |
|
---|
2356 | def uCSIsCatPe(code):
|
---|
2357 | """Check whether the character is part of Pe UCS Category """
|
---|
2358 | ret = libxml2mod.xmlUCSIsCatPe(code)
|
---|
2359 | return ret
|
---|
2360 |
|
---|
2361 | def uCSIsCatPf(code):
|
---|
2362 | """Check whether the character is part of Pf UCS Category """
|
---|
2363 | ret = libxml2mod.xmlUCSIsCatPf(code)
|
---|
2364 | return ret
|
---|
2365 |
|
---|
2366 | def uCSIsCatPi(code):
|
---|
2367 | """Check whether the character is part of Pi UCS Category """
|
---|
2368 | ret = libxml2mod.xmlUCSIsCatPi(code)
|
---|
2369 | return ret
|
---|
2370 |
|
---|
2371 | def uCSIsCatPo(code):
|
---|
2372 | """Check whether the character is part of Po UCS Category """
|
---|
2373 | ret = libxml2mod.xmlUCSIsCatPo(code)
|
---|
2374 | return ret
|
---|
2375 |
|
---|
2376 | def uCSIsCatPs(code):
|
---|
2377 | """Check whether the character is part of Ps UCS Category """
|
---|
2378 | ret = libxml2mod.xmlUCSIsCatPs(code)
|
---|
2379 | return ret
|
---|
2380 |
|
---|
2381 | def uCSIsCatS(code):
|
---|
2382 | """Check whether the character is part of S UCS Category """
|
---|
2383 | ret = libxml2mod.xmlUCSIsCatS(code)
|
---|
2384 | return ret
|
---|
2385 |
|
---|
2386 | def uCSIsCatSc(code):
|
---|
2387 | """Check whether the character is part of Sc UCS Category """
|
---|
2388 | ret = libxml2mod.xmlUCSIsCatSc(code)
|
---|
2389 | return ret
|
---|
2390 |
|
---|
2391 | def uCSIsCatSk(code):
|
---|
2392 | """Check whether the character is part of Sk UCS Category """
|
---|
2393 | ret = libxml2mod.xmlUCSIsCatSk(code)
|
---|
2394 | return ret
|
---|
2395 |
|
---|
2396 | def uCSIsCatSm(code):
|
---|
2397 | """Check whether the character is part of Sm UCS Category """
|
---|
2398 | ret = libxml2mod.xmlUCSIsCatSm(code)
|
---|
2399 | return ret
|
---|
2400 |
|
---|
2401 | def uCSIsCatSo(code):
|
---|
2402 | """Check whether the character is part of So UCS Category """
|
---|
2403 | ret = libxml2mod.xmlUCSIsCatSo(code)
|
---|
2404 | return ret
|
---|
2405 |
|
---|
2406 | def uCSIsCatZ(code):
|
---|
2407 | """Check whether the character is part of Z UCS Category """
|
---|
2408 | ret = libxml2mod.xmlUCSIsCatZ(code)
|
---|
2409 | return ret
|
---|
2410 |
|
---|
2411 | def uCSIsCatZl(code):
|
---|
2412 | """Check whether the character is part of Zl UCS Category """
|
---|
2413 | ret = libxml2mod.xmlUCSIsCatZl(code)
|
---|
2414 | return ret
|
---|
2415 |
|
---|
2416 | def uCSIsCatZp(code):
|
---|
2417 | """Check whether the character is part of Zp UCS Category """
|
---|
2418 | ret = libxml2mod.xmlUCSIsCatZp(code)
|
---|
2419 | return ret
|
---|
2420 |
|
---|
2421 | def uCSIsCatZs(code):
|
---|
2422 | """Check whether the character is part of Zs UCS Category """
|
---|
2423 | ret = libxml2mod.xmlUCSIsCatZs(code)
|
---|
2424 | return ret
|
---|
2425 |
|
---|
2426 | def uCSIsCherokee(code):
|
---|
2427 | """Check whether the character is part of Cherokee UCS Block """
|
---|
2428 | ret = libxml2mod.xmlUCSIsCherokee(code)
|
---|
2429 | return ret
|
---|
2430 |
|
---|
2431 | def uCSIsCombiningDiacriticalMarks(code):
|
---|
2432 | """Check whether the character is part of
|
---|
2433 | CombiningDiacriticalMarks UCS Block """
|
---|
2434 | ret = libxml2mod.xmlUCSIsCombiningDiacriticalMarks(code)
|
---|
2435 | return ret
|
---|
2436 |
|
---|
2437 | def uCSIsCombiningDiacriticalMarksforSymbols(code):
|
---|
2438 | """Check whether the character is part of
|
---|
2439 | CombiningDiacriticalMarksforSymbols UCS Block """
|
---|
2440 | ret = libxml2mod.xmlUCSIsCombiningDiacriticalMarksforSymbols(code)
|
---|
2441 | return ret
|
---|
2442 |
|
---|
2443 | def uCSIsCombiningHalfMarks(code):
|
---|
2444 | """Check whether the character is part of CombiningHalfMarks
|
---|
2445 | UCS Block """
|
---|
2446 | ret = libxml2mod.xmlUCSIsCombiningHalfMarks(code)
|
---|
2447 | return ret
|
---|
2448 |
|
---|
2449 | def uCSIsCombiningMarksforSymbols(code):
|
---|
2450 | """Check whether the character is part of
|
---|
2451 | CombiningMarksforSymbols UCS Block """
|
---|
2452 | ret = libxml2mod.xmlUCSIsCombiningMarksforSymbols(code)
|
---|
2453 | return ret
|
---|
2454 |
|
---|
2455 | def uCSIsControlPictures(code):
|
---|
2456 | """Check whether the character is part of ControlPictures UCS
|
---|
2457 | Block """
|
---|
2458 | ret = libxml2mod.xmlUCSIsControlPictures(code)
|
---|
2459 | return ret
|
---|
2460 |
|
---|
2461 | def uCSIsCurrencySymbols(code):
|
---|
2462 | """Check whether the character is part of CurrencySymbols UCS
|
---|
2463 | Block """
|
---|
2464 | ret = libxml2mod.xmlUCSIsCurrencySymbols(code)
|
---|
2465 | return ret
|
---|
2466 |
|
---|
2467 | def uCSIsCypriotSyllabary(code):
|
---|
2468 | """Check whether the character is part of CypriotSyllabary UCS
|
---|
2469 | Block """
|
---|
2470 | ret = libxml2mod.xmlUCSIsCypriotSyllabary(code)
|
---|
2471 | return ret
|
---|
2472 |
|
---|
2473 | def uCSIsCyrillic(code):
|
---|
2474 | """Check whether the character is part of Cyrillic UCS Block """
|
---|
2475 | ret = libxml2mod.xmlUCSIsCyrillic(code)
|
---|
2476 | return ret
|
---|
2477 |
|
---|
2478 | def uCSIsCyrillicSupplement(code):
|
---|
2479 | """Check whether the character is part of CyrillicSupplement
|
---|
2480 | UCS Block """
|
---|
2481 | ret = libxml2mod.xmlUCSIsCyrillicSupplement(code)
|
---|
2482 | return ret
|
---|
2483 |
|
---|
2484 | def uCSIsDeseret(code):
|
---|
2485 | """Check whether the character is part of Deseret UCS Block """
|
---|
2486 | ret = libxml2mod.xmlUCSIsDeseret(code)
|
---|
2487 | return ret
|
---|
2488 |
|
---|
2489 | def uCSIsDevanagari(code):
|
---|
2490 | """Check whether the character is part of Devanagari UCS Block """
|
---|
2491 | ret = libxml2mod.xmlUCSIsDevanagari(code)
|
---|
2492 | return ret
|
---|
2493 |
|
---|
2494 | def uCSIsDingbats(code):
|
---|
2495 | """Check whether the character is part of Dingbats UCS Block """
|
---|
2496 | ret = libxml2mod.xmlUCSIsDingbats(code)
|
---|
2497 | return ret
|
---|
2498 |
|
---|
2499 | def uCSIsEnclosedAlphanumerics(code):
|
---|
2500 | """Check whether the character is part of
|
---|
2501 | EnclosedAlphanumerics UCS Block """
|
---|
2502 | ret = libxml2mod.xmlUCSIsEnclosedAlphanumerics(code)
|
---|
2503 | return ret
|
---|
2504 |
|
---|
2505 | def uCSIsEnclosedCJKLettersandMonths(code):
|
---|
2506 | """Check whether the character is part of
|
---|
2507 | EnclosedCJKLettersandMonths UCS Block """
|
---|
2508 | ret = libxml2mod.xmlUCSIsEnclosedCJKLettersandMonths(code)
|
---|
2509 | return ret
|
---|
2510 |
|
---|
2511 | def uCSIsEthiopic(code):
|
---|
2512 | """Check whether the character is part of Ethiopic UCS Block """
|
---|
2513 | ret = libxml2mod.xmlUCSIsEthiopic(code)
|
---|
2514 | return ret
|
---|
2515 |
|
---|
2516 | def uCSIsGeneralPunctuation(code):
|
---|
2517 | """Check whether the character is part of GeneralPunctuation
|
---|
2518 | UCS Block """
|
---|
2519 | ret = libxml2mod.xmlUCSIsGeneralPunctuation(code)
|
---|
2520 | return ret
|
---|
2521 |
|
---|
2522 | def uCSIsGeometricShapes(code):
|
---|
2523 | """Check whether the character is part of GeometricShapes UCS
|
---|
2524 | Block """
|
---|
2525 | ret = libxml2mod.xmlUCSIsGeometricShapes(code)
|
---|
2526 | return ret
|
---|
2527 |
|
---|
2528 | def uCSIsGeorgian(code):
|
---|
2529 | """Check whether the character is part of Georgian UCS Block """
|
---|
2530 | ret = libxml2mod.xmlUCSIsGeorgian(code)
|
---|
2531 | return ret
|
---|
2532 |
|
---|
2533 | def uCSIsGothic(code):
|
---|
2534 | """Check whether the character is part of Gothic UCS Block """
|
---|
2535 | ret = libxml2mod.xmlUCSIsGothic(code)
|
---|
2536 | return ret
|
---|
2537 |
|
---|
2538 | def uCSIsGreek(code):
|
---|
2539 | """Check whether the character is part of Greek UCS Block """
|
---|
2540 | ret = libxml2mod.xmlUCSIsGreek(code)
|
---|
2541 | return ret
|
---|
2542 |
|
---|
2543 | def uCSIsGreekExtended(code):
|
---|
2544 | """Check whether the character is part of GreekExtended UCS
|
---|
2545 | Block """
|
---|
2546 | ret = libxml2mod.xmlUCSIsGreekExtended(code)
|
---|
2547 | return ret
|
---|
2548 |
|
---|
2549 | def uCSIsGreekandCoptic(code):
|
---|
2550 | """Check whether the character is part of GreekandCoptic UCS
|
---|
2551 | Block """
|
---|
2552 | ret = libxml2mod.xmlUCSIsGreekandCoptic(code)
|
---|
2553 | return ret
|
---|
2554 |
|
---|
2555 | def uCSIsGujarati(code):
|
---|
2556 | """Check whether the character is part of Gujarati UCS Block """
|
---|
2557 | ret = libxml2mod.xmlUCSIsGujarati(code)
|
---|
2558 | return ret
|
---|
2559 |
|
---|
2560 | def uCSIsGurmukhi(code):
|
---|
2561 | """Check whether the character is part of Gurmukhi UCS Block """
|
---|
2562 | ret = libxml2mod.xmlUCSIsGurmukhi(code)
|
---|
2563 | return ret
|
---|
2564 |
|
---|
2565 | def uCSIsHalfwidthandFullwidthForms(code):
|
---|
2566 | """Check whether the character is part of
|
---|
2567 | HalfwidthandFullwidthForms UCS Block """
|
---|
2568 | ret = libxml2mod.xmlUCSIsHalfwidthandFullwidthForms(code)
|
---|
2569 | return ret
|
---|
2570 |
|
---|
2571 | def uCSIsHangulCompatibilityJamo(code):
|
---|
2572 | """Check whether the character is part of
|
---|
2573 | HangulCompatibilityJamo UCS Block """
|
---|
2574 | ret = libxml2mod.xmlUCSIsHangulCompatibilityJamo(code)
|
---|
2575 | return ret
|
---|
2576 |
|
---|
2577 | def uCSIsHangulJamo(code):
|
---|
2578 | """Check whether the character is part of HangulJamo UCS Block """
|
---|
2579 | ret = libxml2mod.xmlUCSIsHangulJamo(code)
|
---|
2580 | return ret
|
---|
2581 |
|
---|
2582 | def uCSIsHangulSyllables(code):
|
---|
2583 | """Check whether the character is part of HangulSyllables UCS
|
---|
2584 | Block """
|
---|
2585 | ret = libxml2mod.xmlUCSIsHangulSyllables(code)
|
---|
2586 | return ret
|
---|
2587 |
|
---|
2588 | def uCSIsHanunoo(code):
|
---|
2589 | """Check whether the character is part of Hanunoo UCS Block """
|
---|
2590 | ret = libxml2mod.xmlUCSIsHanunoo(code)
|
---|
2591 | return ret
|
---|
2592 |
|
---|
2593 | def uCSIsHebrew(code):
|
---|
2594 | """Check whether the character is part of Hebrew UCS Block """
|
---|
2595 | ret = libxml2mod.xmlUCSIsHebrew(code)
|
---|
2596 | return ret
|
---|
2597 |
|
---|
2598 | def uCSIsHighPrivateUseSurrogates(code):
|
---|
2599 | """Check whether the character is part of
|
---|
2600 | HighPrivateUseSurrogates UCS Block """
|
---|
2601 | ret = libxml2mod.xmlUCSIsHighPrivateUseSurrogates(code)
|
---|
2602 | return ret
|
---|
2603 |
|
---|
2604 | def uCSIsHighSurrogates(code):
|
---|
2605 | """Check whether the character is part of HighSurrogates UCS
|
---|
2606 | Block """
|
---|
2607 | ret = libxml2mod.xmlUCSIsHighSurrogates(code)
|
---|
2608 | return ret
|
---|
2609 |
|
---|
2610 | def uCSIsHiragana(code):
|
---|
2611 | """Check whether the character is part of Hiragana UCS Block """
|
---|
2612 | ret = libxml2mod.xmlUCSIsHiragana(code)
|
---|
2613 | return ret
|
---|
2614 |
|
---|
2615 | def uCSIsIPAExtensions(code):
|
---|
2616 | """Check whether the character is part of IPAExtensions UCS
|
---|
2617 | Block """
|
---|
2618 | ret = libxml2mod.xmlUCSIsIPAExtensions(code)
|
---|
2619 | return ret
|
---|
2620 |
|
---|
2621 | def uCSIsIdeographicDescriptionCharacters(code):
|
---|
2622 | """Check whether the character is part of
|
---|
2623 | IdeographicDescriptionCharacters UCS Block """
|
---|
2624 | ret = libxml2mod.xmlUCSIsIdeographicDescriptionCharacters(code)
|
---|
2625 | return ret
|
---|
2626 |
|
---|
2627 | def uCSIsKanbun(code):
|
---|
2628 | """Check whether the character is part of Kanbun UCS Block """
|
---|
2629 | ret = libxml2mod.xmlUCSIsKanbun(code)
|
---|
2630 | return ret
|
---|
2631 |
|
---|
2632 | def uCSIsKangxiRadicals(code):
|
---|
2633 | """Check whether the character is part of KangxiRadicals UCS
|
---|
2634 | Block """
|
---|
2635 | ret = libxml2mod.xmlUCSIsKangxiRadicals(code)
|
---|
2636 | return ret
|
---|
2637 |
|
---|
2638 | def uCSIsKannada(code):
|
---|
2639 | """Check whether the character is part of Kannada UCS Block """
|
---|
2640 | ret = libxml2mod.xmlUCSIsKannada(code)
|
---|
2641 | return ret
|
---|
2642 |
|
---|
2643 | def uCSIsKatakana(code):
|
---|
2644 | """Check whether the character is part of Katakana UCS Block """
|
---|
2645 | ret = libxml2mod.xmlUCSIsKatakana(code)
|
---|
2646 | return ret
|
---|
2647 |
|
---|
2648 | def uCSIsKatakanaPhoneticExtensions(code):
|
---|
2649 | """Check whether the character is part of
|
---|
2650 | KatakanaPhoneticExtensions UCS Block """
|
---|
2651 | ret = libxml2mod.xmlUCSIsKatakanaPhoneticExtensions(code)
|
---|
2652 | return ret
|
---|
2653 |
|
---|
2654 | def uCSIsKhmer(code):
|
---|
2655 | """Check whether the character is part of Khmer UCS Block """
|
---|
2656 | ret = libxml2mod.xmlUCSIsKhmer(code)
|
---|
2657 | return ret
|
---|
2658 |
|
---|
2659 | def uCSIsKhmerSymbols(code):
|
---|
2660 | """Check whether the character is part of KhmerSymbols UCS
|
---|
2661 | Block """
|
---|
2662 | ret = libxml2mod.xmlUCSIsKhmerSymbols(code)
|
---|
2663 | return ret
|
---|
2664 |
|
---|
2665 | def uCSIsLao(code):
|
---|
2666 | """Check whether the character is part of Lao UCS Block """
|
---|
2667 | ret = libxml2mod.xmlUCSIsLao(code)
|
---|
2668 | return ret
|
---|
2669 |
|
---|
2670 | def uCSIsLatin1Supplement(code):
|
---|
2671 | """Check whether the character is part of Latin-1Supplement
|
---|
2672 | UCS Block """
|
---|
2673 | ret = libxml2mod.xmlUCSIsLatin1Supplement(code)
|
---|
2674 | return ret
|
---|
2675 |
|
---|
2676 | def uCSIsLatinExtendedA(code):
|
---|
2677 | """Check whether the character is part of LatinExtended-A UCS
|
---|
2678 | Block """
|
---|
2679 | ret = libxml2mod.xmlUCSIsLatinExtendedA(code)
|
---|
2680 | return ret
|
---|
2681 |
|
---|
2682 | def uCSIsLatinExtendedAdditional(code):
|
---|
2683 | """Check whether the character is part of
|
---|
2684 | LatinExtendedAdditional UCS Block """
|
---|
2685 | ret = libxml2mod.xmlUCSIsLatinExtendedAdditional(code)
|
---|
2686 | return ret
|
---|
2687 |
|
---|
2688 | def uCSIsLatinExtendedB(code):
|
---|
2689 | """Check whether the character is part of LatinExtended-B UCS
|
---|
2690 | Block """
|
---|
2691 | ret = libxml2mod.xmlUCSIsLatinExtendedB(code)
|
---|
2692 | return ret
|
---|
2693 |
|
---|
2694 | def uCSIsLetterlikeSymbols(code):
|
---|
2695 | """Check whether the character is part of LetterlikeSymbols
|
---|
2696 | UCS Block """
|
---|
2697 | ret = libxml2mod.xmlUCSIsLetterlikeSymbols(code)
|
---|
2698 | return ret
|
---|
2699 |
|
---|
2700 | def uCSIsLimbu(code):
|
---|
2701 | """Check whether the character is part of Limbu UCS Block """
|
---|
2702 | ret = libxml2mod.xmlUCSIsLimbu(code)
|
---|
2703 | return ret
|
---|
2704 |
|
---|
2705 | def uCSIsLinearBIdeograms(code):
|
---|
2706 | """Check whether the character is part of LinearBIdeograms UCS
|
---|
2707 | Block """
|
---|
2708 | ret = libxml2mod.xmlUCSIsLinearBIdeograms(code)
|
---|
2709 | return ret
|
---|
2710 |
|
---|
2711 | def uCSIsLinearBSyllabary(code):
|
---|
2712 | """Check whether the character is part of LinearBSyllabary UCS
|
---|
2713 | Block """
|
---|
2714 | ret = libxml2mod.xmlUCSIsLinearBSyllabary(code)
|
---|
2715 | return ret
|
---|
2716 |
|
---|
2717 | def uCSIsLowSurrogates(code):
|
---|
2718 | """Check whether the character is part of LowSurrogates UCS
|
---|
2719 | Block """
|
---|
2720 | ret = libxml2mod.xmlUCSIsLowSurrogates(code)
|
---|
2721 | return ret
|
---|
2722 |
|
---|
2723 | def uCSIsMalayalam(code):
|
---|
2724 | """Check whether the character is part of Malayalam UCS Block """
|
---|
2725 | ret = libxml2mod.xmlUCSIsMalayalam(code)
|
---|
2726 | return ret
|
---|
2727 |
|
---|
2728 | def uCSIsMathematicalAlphanumericSymbols(code):
|
---|
2729 | """Check whether the character is part of
|
---|
2730 | MathematicalAlphanumericSymbols UCS Block """
|
---|
2731 | ret = libxml2mod.xmlUCSIsMathematicalAlphanumericSymbols(code)
|
---|
2732 | return ret
|
---|
2733 |
|
---|
2734 | def uCSIsMathematicalOperators(code):
|
---|
2735 | """Check whether the character is part of
|
---|
2736 | MathematicalOperators UCS Block """
|
---|
2737 | ret = libxml2mod.xmlUCSIsMathematicalOperators(code)
|
---|
2738 | return ret
|
---|
2739 |
|
---|
2740 | def uCSIsMiscellaneousMathematicalSymbolsA(code):
|
---|
2741 | """Check whether the character is part of
|
---|
2742 | MiscellaneousMathematicalSymbols-A UCS Block """
|
---|
2743 | ret = libxml2mod.xmlUCSIsMiscellaneousMathematicalSymbolsA(code)
|
---|
2744 | return ret
|
---|
2745 |
|
---|
2746 | def uCSIsMiscellaneousMathematicalSymbolsB(code):
|
---|
2747 | """Check whether the character is part of
|
---|
2748 | MiscellaneousMathematicalSymbols-B UCS Block """
|
---|
2749 | ret = libxml2mod.xmlUCSIsMiscellaneousMathematicalSymbolsB(code)
|
---|
2750 | return ret
|
---|
2751 |
|
---|
2752 | def uCSIsMiscellaneousSymbols(code):
|
---|
2753 | """Check whether the character is part of MiscellaneousSymbols
|
---|
2754 | UCS Block """
|
---|
2755 | ret = libxml2mod.xmlUCSIsMiscellaneousSymbols(code)
|
---|
2756 | return ret
|
---|
2757 |
|
---|
2758 | def uCSIsMiscellaneousSymbolsandArrows(code):
|
---|
2759 | """Check whether the character is part of
|
---|
2760 | MiscellaneousSymbolsandArrows UCS Block """
|
---|
2761 | ret = libxml2mod.xmlUCSIsMiscellaneousSymbolsandArrows(code)
|
---|
2762 | return ret
|
---|
2763 |
|
---|
2764 | def uCSIsMiscellaneousTechnical(code):
|
---|
2765 | """Check whether the character is part of
|
---|
2766 | MiscellaneousTechnical UCS Block """
|
---|
2767 | ret = libxml2mod.xmlUCSIsMiscellaneousTechnical(code)
|
---|
2768 | return ret
|
---|
2769 |
|
---|
2770 | def uCSIsMongolian(code):
|
---|
2771 | """Check whether the character is part of Mongolian UCS Block """
|
---|
2772 | ret = libxml2mod.xmlUCSIsMongolian(code)
|
---|
2773 | return ret
|
---|
2774 |
|
---|
2775 | def uCSIsMusicalSymbols(code):
|
---|
2776 | """Check whether the character is part of MusicalSymbols UCS
|
---|
2777 | Block """
|
---|
2778 | ret = libxml2mod.xmlUCSIsMusicalSymbols(code)
|
---|
2779 | return ret
|
---|
2780 |
|
---|
2781 | def uCSIsMyanmar(code):
|
---|
2782 | """Check whether the character is part of Myanmar UCS Block """
|
---|
2783 | ret = libxml2mod.xmlUCSIsMyanmar(code)
|
---|
2784 | return ret
|
---|
2785 |
|
---|
2786 | def uCSIsNumberForms(code):
|
---|
2787 | """Check whether the character is part of NumberForms UCS Block """
|
---|
2788 | ret = libxml2mod.xmlUCSIsNumberForms(code)
|
---|
2789 | return ret
|
---|
2790 |
|
---|
2791 | def uCSIsOgham(code):
|
---|
2792 | """Check whether the character is part of Ogham UCS Block """
|
---|
2793 | ret = libxml2mod.xmlUCSIsOgham(code)
|
---|
2794 | return ret
|
---|
2795 |
|
---|
2796 | def uCSIsOldItalic(code):
|
---|
2797 | """Check whether the character is part of OldItalic UCS Block """
|
---|
2798 | ret = libxml2mod.xmlUCSIsOldItalic(code)
|
---|
2799 | return ret
|
---|
2800 |
|
---|
2801 | def uCSIsOpticalCharacterRecognition(code):
|
---|
2802 | """Check whether the character is part of
|
---|
2803 | OpticalCharacterRecognition UCS Block """
|
---|
2804 | ret = libxml2mod.xmlUCSIsOpticalCharacterRecognition(code)
|
---|
2805 | return ret
|
---|
2806 |
|
---|
2807 | def uCSIsOriya(code):
|
---|
2808 | """Check whether the character is part of Oriya UCS Block """
|
---|
2809 | ret = libxml2mod.xmlUCSIsOriya(code)
|
---|
2810 | return ret
|
---|
2811 |
|
---|
2812 | def uCSIsOsmanya(code):
|
---|
2813 | """Check whether the character is part of Osmanya UCS Block """
|
---|
2814 | ret = libxml2mod.xmlUCSIsOsmanya(code)
|
---|
2815 | return ret
|
---|
2816 |
|
---|
2817 | def uCSIsPhoneticExtensions(code):
|
---|
2818 | """Check whether the character is part of PhoneticExtensions
|
---|
2819 | UCS Block """
|
---|
2820 | ret = libxml2mod.xmlUCSIsPhoneticExtensions(code)
|
---|
2821 | return ret
|
---|
2822 |
|
---|
2823 | def uCSIsPrivateUse(code):
|
---|
2824 | """Check whether the character is part of PrivateUse UCS Block """
|
---|
2825 | ret = libxml2mod.xmlUCSIsPrivateUse(code)
|
---|
2826 | return ret
|
---|
2827 |
|
---|
2828 | def uCSIsPrivateUseArea(code):
|
---|
2829 | """Check whether the character is part of PrivateUseArea UCS
|
---|
2830 | Block """
|
---|
2831 | ret = libxml2mod.xmlUCSIsPrivateUseArea(code)
|
---|
2832 | return ret
|
---|
2833 |
|
---|
2834 | def uCSIsRunic(code):
|
---|
2835 | """Check whether the character is part of Runic UCS Block """
|
---|
2836 | ret = libxml2mod.xmlUCSIsRunic(code)
|
---|
2837 | return ret
|
---|
2838 |
|
---|
2839 | def uCSIsShavian(code):
|
---|
2840 | """Check whether the character is part of Shavian UCS Block """
|
---|
2841 | ret = libxml2mod.xmlUCSIsShavian(code)
|
---|
2842 | return ret
|
---|
2843 |
|
---|
2844 | def uCSIsSinhala(code):
|
---|
2845 | """Check whether the character is part of Sinhala UCS Block """
|
---|
2846 | ret = libxml2mod.xmlUCSIsSinhala(code)
|
---|
2847 | return ret
|
---|
2848 |
|
---|
2849 | def uCSIsSmallFormVariants(code):
|
---|
2850 | """Check whether the character is part of SmallFormVariants
|
---|
2851 | UCS Block """
|
---|
2852 | ret = libxml2mod.xmlUCSIsSmallFormVariants(code)
|
---|
2853 | return ret
|
---|
2854 |
|
---|
2855 | def uCSIsSpacingModifierLetters(code):
|
---|
2856 | """Check whether the character is part of
|
---|
2857 | SpacingModifierLetters UCS Block """
|
---|
2858 | ret = libxml2mod.xmlUCSIsSpacingModifierLetters(code)
|
---|
2859 | return ret
|
---|
2860 |
|
---|
2861 | def uCSIsSpecials(code):
|
---|
2862 | """Check whether the character is part of Specials UCS Block """
|
---|
2863 | ret = libxml2mod.xmlUCSIsSpecials(code)
|
---|
2864 | return ret
|
---|
2865 |
|
---|
2866 | def uCSIsSuperscriptsandSubscripts(code):
|
---|
2867 | """Check whether the character is part of
|
---|
2868 | SuperscriptsandSubscripts UCS Block """
|
---|
2869 | ret = libxml2mod.xmlUCSIsSuperscriptsandSubscripts(code)
|
---|
2870 | return ret
|
---|
2871 |
|
---|
2872 | def uCSIsSupplementalArrowsA(code):
|
---|
2873 | """Check whether the character is part of SupplementalArrows-A
|
---|
2874 | UCS Block """
|
---|
2875 | ret = libxml2mod.xmlUCSIsSupplementalArrowsA(code)
|
---|
2876 | return ret
|
---|
2877 |
|
---|
2878 | def uCSIsSupplementalArrowsB(code):
|
---|
2879 | """Check whether the character is part of SupplementalArrows-B
|
---|
2880 | UCS Block """
|
---|
2881 | ret = libxml2mod.xmlUCSIsSupplementalArrowsB(code)
|
---|
2882 | return ret
|
---|
2883 |
|
---|
2884 | def uCSIsSupplementalMathematicalOperators(code):
|
---|
2885 | """Check whether the character is part of
|
---|
2886 | SupplementalMathematicalOperators UCS Block """
|
---|
2887 | ret = libxml2mod.xmlUCSIsSupplementalMathematicalOperators(code)
|
---|
2888 | return ret
|
---|
2889 |
|
---|
2890 | def uCSIsSupplementaryPrivateUseAreaA(code):
|
---|
2891 | """Check whether the character is part of
|
---|
2892 | SupplementaryPrivateUseArea-A UCS Block """
|
---|
2893 | ret = libxml2mod.xmlUCSIsSupplementaryPrivateUseAreaA(code)
|
---|
2894 | return ret
|
---|
2895 |
|
---|
2896 | def uCSIsSupplementaryPrivateUseAreaB(code):
|
---|
2897 | """Check whether the character is part of
|
---|
2898 | SupplementaryPrivateUseArea-B UCS Block """
|
---|
2899 | ret = libxml2mod.xmlUCSIsSupplementaryPrivateUseAreaB(code)
|
---|
2900 | return ret
|
---|
2901 |
|
---|
2902 | def uCSIsSyriac(code):
|
---|
2903 | """Check whether the character is part of Syriac UCS Block """
|
---|
2904 | ret = libxml2mod.xmlUCSIsSyriac(code)
|
---|
2905 | return ret
|
---|
2906 |
|
---|
2907 | def uCSIsTagalog(code):
|
---|
2908 | """Check whether the character is part of Tagalog UCS Block """
|
---|
2909 | ret = libxml2mod.xmlUCSIsTagalog(code)
|
---|
2910 | return ret
|
---|
2911 |
|
---|
2912 | def uCSIsTagbanwa(code):
|
---|
2913 | """Check whether the character is part of Tagbanwa UCS Block """
|
---|
2914 | ret = libxml2mod.xmlUCSIsTagbanwa(code)
|
---|
2915 | return ret
|
---|
2916 |
|
---|
2917 | def uCSIsTags(code):
|
---|
2918 | """Check whether the character is part of Tags UCS Block """
|
---|
2919 | ret = libxml2mod.xmlUCSIsTags(code)
|
---|
2920 | return ret
|
---|
2921 |
|
---|
2922 | def uCSIsTaiLe(code):
|
---|
2923 | """Check whether the character is part of TaiLe UCS Block """
|
---|
2924 | ret = libxml2mod.xmlUCSIsTaiLe(code)
|
---|
2925 | return ret
|
---|
2926 |
|
---|
2927 | def uCSIsTaiXuanJingSymbols(code):
|
---|
2928 | """Check whether the character is part of TaiXuanJingSymbols
|
---|
2929 | UCS Block """
|
---|
2930 | ret = libxml2mod.xmlUCSIsTaiXuanJingSymbols(code)
|
---|
2931 | return ret
|
---|
2932 |
|
---|
2933 | def uCSIsTamil(code):
|
---|
2934 | """Check whether the character is part of Tamil UCS Block """
|
---|
2935 | ret = libxml2mod.xmlUCSIsTamil(code)
|
---|
2936 | return ret
|
---|
2937 |
|
---|
2938 | def uCSIsTelugu(code):
|
---|
2939 | """Check whether the character is part of Telugu UCS Block """
|
---|
2940 | ret = libxml2mod.xmlUCSIsTelugu(code)
|
---|
2941 | return ret
|
---|
2942 |
|
---|
2943 | def uCSIsThaana(code):
|
---|
2944 | """Check whether the character is part of Thaana UCS Block """
|
---|
2945 | ret = libxml2mod.xmlUCSIsThaana(code)
|
---|
2946 | return ret
|
---|
2947 |
|
---|
2948 | def uCSIsThai(code):
|
---|
2949 | """Check whether the character is part of Thai UCS Block """
|
---|
2950 | ret = libxml2mod.xmlUCSIsThai(code)
|
---|
2951 | return ret
|
---|
2952 |
|
---|
2953 | def uCSIsTibetan(code):
|
---|
2954 | """Check whether the character is part of Tibetan UCS Block """
|
---|
2955 | ret = libxml2mod.xmlUCSIsTibetan(code)
|
---|
2956 | return ret
|
---|
2957 |
|
---|
2958 | def uCSIsUgaritic(code):
|
---|
2959 | """Check whether the character is part of Ugaritic UCS Block """
|
---|
2960 | ret = libxml2mod.xmlUCSIsUgaritic(code)
|
---|
2961 | return ret
|
---|
2962 |
|
---|
2963 | def uCSIsUnifiedCanadianAboriginalSyllabics(code):
|
---|
2964 | """Check whether the character is part of
|
---|
2965 | UnifiedCanadianAboriginalSyllabics UCS Block """
|
---|
2966 | ret = libxml2mod.xmlUCSIsUnifiedCanadianAboriginalSyllabics(code)
|
---|
2967 | return ret
|
---|
2968 |
|
---|
2969 | def uCSIsVariationSelectors(code):
|
---|
2970 | """Check whether the character is part of VariationSelectors
|
---|
2971 | UCS Block """
|
---|
2972 | ret = libxml2mod.xmlUCSIsVariationSelectors(code)
|
---|
2973 | return ret
|
---|
2974 |
|
---|
2975 | def uCSIsVariationSelectorsSupplement(code):
|
---|
2976 | """Check whether the character is part of
|
---|
2977 | VariationSelectorsSupplement UCS Block """
|
---|
2978 | ret = libxml2mod.xmlUCSIsVariationSelectorsSupplement(code)
|
---|
2979 | return ret
|
---|
2980 |
|
---|
2981 | def uCSIsYiRadicals(code):
|
---|
2982 | """Check whether the character is part of YiRadicals UCS Block """
|
---|
2983 | ret = libxml2mod.xmlUCSIsYiRadicals(code)
|
---|
2984 | return ret
|
---|
2985 |
|
---|
2986 | def uCSIsYiSyllables(code):
|
---|
2987 | """Check whether the character is part of YiSyllables UCS Block """
|
---|
2988 | ret = libxml2mod.xmlUCSIsYiSyllables(code)
|
---|
2989 | return ret
|
---|
2990 |
|
---|
2991 | def uCSIsYijingHexagramSymbols(code):
|
---|
2992 | """Check whether the character is part of
|
---|
2993 | YijingHexagramSymbols UCS Block """
|
---|
2994 | ret = libxml2mod.xmlUCSIsYijingHexagramSymbols(code)
|
---|
2995 | return ret
|
---|
2996 |
|
---|
2997 | #
|
---|
2998 | # Functions from module xmlversion
|
---|
2999 | #
|
---|
3000 |
|
---|
3001 | def checkVersion(version):
|
---|
3002 | """check the compiled lib version against the include one.
|
---|
3003 | This can warn or immediately kill the application """
|
---|
3004 | libxml2mod.xmlCheckVersion(version)
|
---|
3005 |
|
---|
3006 | #
|
---|
3007 | # Functions from module xpathInternals
|
---|
3008 | #
|
---|
3009 |
|
---|
3010 | def valuePop(ctxt):
|
---|
3011 | """Pops the top XPath object from the value stack """
|
---|
3012 | if ctxt is None: ctxt__o = None
|
---|
3013 | else: ctxt__o = ctxt._o
|
---|
3014 | ret = libxml2mod.valuePop(ctxt__o)
|
---|
3015 | return ret
|
---|
3016 |
|
---|
3017 | class xmlNode(xmlCore):
|
---|
3018 | def __init__(self, _obj=None):
|
---|
3019 | if checkWrapper(_obj) != 0: raise TypeError('xmlNode got a wrong wrapper object type')
|
---|
3020 | self._o = _obj
|
---|
3021 | xmlCore.__init__(self, _obj=_obj)
|
---|
3022 |
|
---|
3023 | def __repr__(self):
|
---|
3024 | return "<xmlNode (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
|
---|
3025 |
|
---|
3026 | # accessors for xmlNode
|
---|
3027 | def ns(self):
|
---|
3028 | """Get the namespace of a node """
|
---|
3029 | ret = libxml2mod.xmlNodeGetNs(self._o)
|
---|
3030 | if ret is None:return None
|
---|
3031 | __tmp = xmlNs(_obj=ret)
|
---|
3032 | return __tmp
|
---|
3033 |
|
---|
3034 | def nsDefs(self):
|
---|
3035 | """Get the namespace of a node """
|
---|
3036 | ret = libxml2mod.xmlNodeGetNsDefs(self._o)
|
---|
3037 | if ret is None:return None
|
---|
3038 | __tmp = xmlNs(_obj=ret)
|
---|
3039 | return __tmp
|
---|
3040 |
|
---|
3041 | #
|
---|
3042 | # xmlNode functions from module debugXML
|
---|
3043 | #
|
---|
3044 |
|
---|
3045 | def debugDumpNode(self, output, depth):
|
---|
3046 | """Dumps debug information for the element node, it is
|
---|
3047 | recursive """
|
---|
3048 | libxml2mod.xmlDebugDumpNode(output, self._o, depth)
|
---|
3049 |
|
---|
3050 | def debugDumpNodeList(self, output, depth):
|
---|
3051 | """Dumps debug information for the list of element node, it is
|
---|
3052 | recursive """
|
---|
3053 | libxml2mod.xmlDebugDumpNodeList(output, self._o, depth)
|
---|
3054 |
|
---|
3055 | def debugDumpOneNode(self, output, depth):
|
---|
3056 | """Dumps debug information for the element node, it is not
|
---|
3057 | recursive """
|
---|
3058 | libxml2mod.xmlDebugDumpOneNode(output, self._o, depth)
|
---|
3059 |
|
---|
3060 | def lsCountNode(self):
|
---|
3061 | """Count the children of @node. """
|
---|
3062 | ret = libxml2mod.xmlLsCountNode(self._o)
|
---|
3063 | return ret
|
---|
3064 |
|
---|
3065 | def lsOneNode(self, output):
|
---|
3066 | """Dump to @output the type and name of @node. """
|
---|
3067 | libxml2mod.xmlLsOneNode(output, self._o)
|
---|
3068 |
|
---|
3069 | def shellPrintNode(self):
|
---|
3070 | """Print node to the output FILE """
|
---|
3071 | libxml2mod.xmlShellPrintNode(self._o)
|
---|
3072 |
|
---|
3073 | #
|
---|
3074 | # xmlNode functions from module tree
|
---|
3075 | #
|
---|
3076 |
|
---|
3077 | def addChild(self, cur):
|
---|
3078 | """Add a new node to @parent, at the end of the child (or
|
---|
3079 | property) list merging adjacent TEXT nodes (in which case
|
---|
3080 | @cur is freed) If the new node is ATTRIBUTE, it is added
|
---|
3081 | into properties instead of children. If there is an
|
---|
3082 | attribute with equal name, it is first destroyed. """
|
---|
3083 | if cur is None: cur__o = None
|
---|
3084 | else: cur__o = cur._o
|
---|
3085 | ret = libxml2mod.xmlAddChild(self._o, cur__o)
|
---|
3086 | if ret is None:raise treeError('xmlAddChild() failed')
|
---|
3087 | __tmp = xmlNode(_obj=ret)
|
---|
3088 | return __tmp
|
---|
3089 |
|
---|
3090 | def addChildList(self, cur):
|
---|
3091 | """Add a list of node at the end of the child list of the
|
---|
3092 | parent merging adjacent TEXT nodes (@cur may be freed) """
|
---|
3093 | if cur is None: cur__o = None
|
---|
3094 | else: cur__o = cur._o
|
---|
3095 | ret = libxml2mod.xmlAddChildList(self._o, cur__o)
|
---|
3096 | if ret is None:raise treeError('xmlAddChildList() failed')
|
---|
3097 | __tmp = xmlNode(_obj=ret)
|
---|
3098 | return __tmp
|
---|
3099 |
|
---|
3100 | def addContent(self, content):
|
---|
3101 | """Append the extra substring to the node content. NOTE: In
|
---|
3102 | contrast to xmlNodeSetContent(), @content is supposed to be
|
---|
3103 | raw text, so unescaped XML special chars are allowed,
|
---|
3104 | entity references are not supported. """
|
---|
3105 | libxml2mod.xmlNodeAddContent(self._o, content)
|
---|
3106 |
|
---|
3107 | def addContentLen(self, content, len):
|
---|
3108 | """Append the extra substring to the node content. NOTE: In
|
---|
3109 | contrast to xmlNodeSetContentLen(), @content is supposed to
|
---|
3110 | be raw text, so unescaped XML special chars are allowed,
|
---|
3111 | entity references are not supported. """
|
---|
3112 | libxml2mod.xmlNodeAddContentLen(self._o, content, len)
|
---|
3113 |
|
---|
3114 | def addNextSibling(self, elem):
|
---|
3115 | """Add a new node @elem as the next sibling of @cur If the new
|
---|
3116 | node was already inserted in a document it is first
|
---|
3117 | unlinked from its existing context. As a result of text
|
---|
3118 | merging @elem may be freed. If the new node is ATTRIBUTE,
|
---|
3119 | it is added into properties instead of children. If there
|
---|
3120 | is an attribute with equal name, it is first destroyed. """
|
---|
3121 | if elem is None: elem__o = None
|
---|
3122 | else: elem__o = elem._o
|
---|
3123 | ret = libxml2mod.xmlAddNextSibling(self._o, elem__o)
|
---|
3124 | if ret is None:raise treeError('xmlAddNextSibling() failed')
|
---|
3125 | __tmp = xmlNode(_obj=ret)
|
---|
3126 | return __tmp
|
---|
3127 |
|
---|
3128 | def addPrevSibling(self, elem):
|
---|
3129 | """Add a new node @elem as the previous sibling of @cur
|
---|
3130 | merging adjacent TEXT nodes (@elem may be freed) If the new
|
---|
3131 | node was already inserted in a document it is first
|
---|
3132 | unlinked from its existing context. If the new node is
|
---|
3133 | ATTRIBUTE, it is added into properties instead of children.
|
---|
3134 | If there is an attribute with equal name, it is first
|
---|
3135 | destroyed. """
|
---|
3136 | if elem is None: elem__o = None
|
---|
3137 | else: elem__o = elem._o
|
---|
3138 | ret = libxml2mod.xmlAddPrevSibling(self._o, elem__o)
|
---|
3139 | if ret is None:raise treeError('xmlAddPrevSibling() failed')
|
---|
3140 | __tmp = xmlNode(_obj=ret)
|
---|
3141 | return __tmp
|
---|
3142 |
|
---|
3143 | def addSibling(self, elem):
|
---|
3144 | """Add a new element @elem to the list of siblings of @cur
|
---|
3145 | merging adjacent TEXT nodes (@elem may be freed) If the new
|
---|
3146 | element was already inserted in a document it is first
|
---|
3147 | unlinked from its existing context. """
|
---|
3148 | if elem is None: elem__o = None
|
---|
3149 | else: elem__o = elem._o
|
---|
3150 | ret = libxml2mod.xmlAddSibling(self._o, elem__o)
|
---|
3151 | if ret is None:raise treeError('xmlAddSibling() failed')
|
---|
3152 | __tmp = xmlNode(_obj=ret)
|
---|
3153 | return __tmp
|
---|
3154 |
|
---|
3155 | def copyNode(self, extended):
|
---|
3156 | """Do a copy of the node. """
|
---|
3157 | ret = libxml2mod.xmlCopyNode(self._o, extended)
|
---|
3158 | if ret is None:raise treeError('xmlCopyNode() failed')
|
---|
3159 | __tmp = xmlNode(_obj=ret)
|
---|
3160 | return __tmp
|
---|
3161 |
|
---|
3162 | def copyNodeList(self):
|
---|
3163 | """Do a recursive copy of the node list. Use
|
---|
3164 | xmlDocCopyNodeList() if possible to ensure string interning. """
|
---|
3165 | ret = libxml2mod.xmlCopyNodeList(self._o)
|
---|
3166 | if ret is None:raise treeError('xmlCopyNodeList() failed')
|
---|
3167 | __tmp = xmlNode(_obj=ret)
|
---|
3168 | return __tmp
|
---|
3169 |
|
---|
3170 | def copyProp(self, cur):
|
---|
3171 | """Do a copy of the attribute. """
|
---|
3172 | if cur is None: cur__o = None
|
---|
3173 | else: cur__o = cur._o
|
---|
3174 | ret = libxml2mod.xmlCopyProp(self._o, cur__o)
|
---|
3175 | if ret is None:raise treeError('xmlCopyProp() failed')
|
---|
3176 | __tmp = xmlAttr(_obj=ret)
|
---|
3177 | return __tmp
|
---|
3178 |
|
---|
3179 | def copyPropList(self, cur):
|
---|
3180 | """Do a copy of an attribute list. """
|
---|
3181 | if cur is None: cur__o = None
|
---|
3182 | else: cur__o = cur._o
|
---|
3183 | ret = libxml2mod.xmlCopyPropList(self._o, cur__o)
|
---|
3184 | if ret is None:raise treeError('xmlCopyPropList() failed')
|
---|
3185 | __tmp = xmlAttr(_obj=ret)
|
---|
3186 | return __tmp
|
---|
3187 |
|
---|
3188 | def docCopyNode(self, doc, extended):
|
---|
3189 | """Do a copy of the node to a given document. """
|
---|
3190 | if doc is None: doc__o = None
|
---|
3191 | else: doc__o = doc._o
|
---|
3192 | ret = libxml2mod.xmlDocCopyNode(self._o, doc__o, extended)
|
---|
3193 | if ret is None:raise treeError('xmlDocCopyNode() failed')
|
---|
3194 | __tmp = xmlNode(_obj=ret)
|
---|
3195 | return __tmp
|
---|
3196 |
|
---|
3197 | def docCopyNodeList(self, doc):
|
---|
3198 | """Do a recursive copy of the node list. """
|
---|
3199 | if doc is None: doc__o = None
|
---|
3200 | else: doc__o = doc._o
|
---|
3201 | ret = libxml2mod.xmlDocCopyNodeList(doc__o, self._o)
|
---|
3202 | if ret is None:raise treeError('xmlDocCopyNodeList() failed')
|
---|
3203 | __tmp = xmlNode(_obj=ret)
|
---|
3204 | return __tmp
|
---|
3205 |
|
---|
3206 | def docSetRootElement(self, doc):
|
---|
3207 | """Set the root element of the document (doc->children is a
|
---|
3208 | list containing possibly comments, PIs, etc ...). """
|
---|
3209 | if doc is None: doc__o = None
|
---|
3210 | else: doc__o = doc._o
|
---|
3211 | ret = libxml2mod.xmlDocSetRootElement(doc__o, self._o)
|
---|
3212 | if ret is None:return None
|
---|
3213 | __tmp = xmlNode(_obj=ret)
|
---|
3214 | return __tmp
|
---|
3215 |
|
---|
3216 | def firstElementChild(self):
|
---|
3217 | """Finds the first child node of that element which is a
|
---|
3218 | Element node Note the handling of entities references is
|
---|
3219 | different than in the W3C DOM element traversal spec since
|
---|
3220 | we don't have back reference from entities content to
|
---|
3221 | entities references. """
|
---|
3222 | ret = libxml2mod.xmlFirstElementChild(self._o)
|
---|
3223 | if ret is None:return None
|
---|
3224 | __tmp = xmlNode(_obj=ret)
|
---|
3225 | return __tmp
|
---|
3226 |
|
---|
3227 | def freeNode(self):
|
---|
3228 | """Free a node, this is a recursive behaviour, all the
|
---|
3229 | children are freed too. This doesn't unlink the child from
|
---|
3230 | the list, use xmlUnlinkNode() first. """
|
---|
3231 | libxml2mod.xmlFreeNode(self._o)
|
---|
3232 |
|
---|
3233 | def freeNodeList(self):
|
---|
3234 | """Free a node and all its siblings, this is a recursive
|
---|
3235 | behaviour, all the children are freed too. """
|
---|
3236 | libxml2mod.xmlFreeNodeList(self._o)
|
---|
3237 |
|
---|
3238 | def getBase(self, doc):
|
---|
3239 | """Searches for the BASE URL. The code should work on both XML
|
---|
3240 | and HTML document even if base mechanisms are completely
|
---|
3241 | different. It returns the base as defined in RFC 2396
|
---|
3242 | sections 5.1.1. Base URI within Document Content and 5.1.2.
|
---|
3243 | Base URI from the Encapsulating Entity However it does not
|
---|
3244 | return the document base (5.1.3), use doc->URL in this case """
|
---|
3245 | if doc is None: doc__o = None
|
---|
3246 | else: doc__o = doc._o
|
---|
3247 | ret = libxml2mod.xmlNodeGetBase(doc__o, self._o)
|
---|
3248 | return ret
|
---|
3249 |
|
---|
3250 | def getContent(self):
|
---|
3251 | """Read the value of a node, this can be either the text
|
---|
3252 | carried directly by this node if it's a TEXT node or the
|
---|
3253 | aggregate string of the values carried by this node child's
|
---|
3254 | (TEXT and ENTITY_REF). Entity references are substituted. """
|
---|
3255 | ret = libxml2mod.xmlNodeGetContent(self._o)
|
---|
3256 | return ret
|
---|
3257 |
|
---|
3258 | def getLang(self):
|
---|
3259 | """Searches the language of a node, i.e. the values of the
|
---|
3260 | xml:lang attribute or the one carried by the nearest
|
---|
3261 | ancestor. """
|
---|
3262 | ret = libxml2mod.xmlNodeGetLang(self._o)
|
---|
3263 | return ret
|
---|
3264 |
|
---|
3265 | def getSpacePreserve(self):
|
---|
3266 | """Searches the space preserving behaviour of a node, i.e. the
|
---|
3267 | values of the xml:space attribute or the one carried by the
|
---|
3268 | nearest ancestor. """
|
---|
3269 | ret = libxml2mod.xmlNodeGetSpacePreserve(self._o)
|
---|
3270 | return ret
|
---|
3271 |
|
---|
3272 | def hasNsProp(self, name, nameSpace):
|
---|
3273 | """Search for an attribute associated to a node This attribute
|
---|
3274 | has to be anchored in the namespace specified. This does
|
---|
3275 | the entity substitution. This function looks in DTD
|
---|
3276 | attribute declaration for #FIXED or default declaration
|
---|
3277 | values unless DTD use has been turned off. Note that a
|
---|
3278 | namespace of None indicates to use the default namespace. """
|
---|
3279 | ret = libxml2mod.xmlHasNsProp(self._o, name, nameSpace)
|
---|
3280 | if ret is None:return None
|
---|
3281 | __tmp = xmlAttr(_obj=ret)
|
---|
3282 | return __tmp
|
---|
3283 |
|
---|
3284 | def hasProp(self, name):
|
---|
3285 | """Search an attribute associated to a node This function also
|
---|
3286 | looks in DTD attribute declaration for #FIXED or default
|
---|
3287 | declaration values unless DTD use has been turned off. """
|
---|
3288 | ret = libxml2mod.xmlHasProp(self._o, name)
|
---|
3289 | if ret is None:return None
|
---|
3290 | __tmp = xmlAttr(_obj=ret)
|
---|
3291 | return __tmp
|
---|
3292 |
|
---|
3293 | def isBlankNode(self):
|
---|
3294 | """Checks whether this node is an empty or whitespace only
|
---|
3295 | (and possibly ignorable) text-node. """
|
---|
3296 | ret = libxml2mod.xmlIsBlankNode(self._o)
|
---|
3297 | return ret
|
---|
3298 |
|
---|
3299 | def isText(self):
|
---|
3300 | """Is this node a Text node ? """
|
---|
3301 | ret = libxml2mod.xmlNodeIsText(self._o)
|
---|
3302 | return ret
|
---|
3303 |
|
---|
3304 | def lastChild(self):
|
---|
3305 | """Search the last child of a node. """
|
---|
3306 | ret = libxml2mod.xmlGetLastChild(self._o)
|
---|
3307 | if ret is None:raise treeError('xmlGetLastChild() failed')
|
---|
3308 | __tmp = xmlNode(_obj=ret)
|
---|
3309 | return __tmp
|
---|
3310 |
|
---|
3311 | def lastElementChild(self):
|
---|
3312 | """Finds the last child node of that element which is a
|
---|
3313 | Element node Note the handling of entities references is
|
---|
3314 | different than in the W3C DOM element traversal spec since
|
---|
3315 | we don't have back reference from entities content to
|
---|
3316 | entities references. """
|
---|
3317 | ret = libxml2mod.xmlLastElementChild(self._o)
|
---|
3318 | if ret is None:return None
|
---|
3319 | __tmp = xmlNode(_obj=ret)
|
---|
3320 | return __tmp
|
---|
3321 |
|
---|
3322 | def lineNo(self):
|
---|
3323 | """Get line number of @node. Try to override the limitation of
|
---|
3324 | lines being store in 16 bits ints if XML_PARSE_BIG_LINES
|
---|
3325 | parser option was used """
|
---|
3326 | ret = libxml2mod.xmlGetLineNo(self._o)
|
---|
3327 | return ret
|
---|
3328 |
|
---|
3329 | def listGetRawString(self, doc, inLine):
|
---|
3330 | """Builds the string equivalent to the text contained in the
|
---|
3331 | Node list made of TEXTs and ENTITY_REFs, contrary to
|
---|
3332 | xmlNodeListGetString() this function doesn't do any
|
---|
3333 | character encoding handling. """
|
---|
3334 | if doc is None: doc__o = None
|
---|
3335 | else: doc__o = doc._o
|
---|
3336 | ret = libxml2mod.xmlNodeListGetRawString(doc__o, self._o, inLine)
|
---|
3337 | return ret
|
---|
3338 |
|
---|
3339 | def listGetString(self, doc, inLine):
|
---|
3340 | """Build the string equivalent to the text contained in the
|
---|
3341 | Node list made of TEXTs and ENTITY_REFs """
|
---|
3342 | if doc is None: doc__o = None
|
---|
3343 | else: doc__o = doc._o
|
---|
3344 | ret = libxml2mod.xmlNodeListGetString(doc__o, self._o, inLine)
|
---|
3345 | return ret
|
---|
3346 |
|
---|
3347 | def newChild(self, ns, name, content):
|
---|
3348 | """Creation of a new child element, added at the end of
|
---|
3349 | @parent children list. @ns and @content parameters are
|
---|
3350 | optional (None). If @ns is None, the newly created element
|
---|
3351 | inherits the namespace of @parent. If @content is non None,
|
---|
3352 | a child list containing the TEXTs and ENTITY_REFs node will
|
---|
3353 | be created. NOTE: @content is supposed to be a piece of XML
|
---|
3354 | CDATA, so it allows entity references. XML special chars
|
---|
3355 | must be escaped first by using
|
---|
3356 | xmlEncodeEntitiesReentrant(), or xmlNewTextChild() should
|
---|
3357 | be used. """
|
---|
3358 | if ns is None: ns__o = None
|
---|
3359 | else: ns__o = ns._o
|
---|
3360 | ret = libxml2mod.xmlNewChild(self._o, ns__o, name, content)
|
---|
3361 | if ret is None:raise treeError('xmlNewChild() failed')
|
---|
3362 | __tmp = xmlNode(_obj=ret)
|
---|
3363 | return __tmp
|
---|
3364 |
|
---|
3365 | def newNs(self, href, prefix):
|
---|
3366 | """Creation of a new Namespace. This function will refuse to
|
---|
3367 | create a namespace with a similar prefix than an existing
|
---|
3368 | one present on this node. Note that for a default
|
---|
3369 | namespace, @prefix should be None. We use href==None in
|
---|
3370 | the case of an element creation where the namespace was not
|
---|
3371 | defined. """
|
---|
3372 | ret = libxml2mod.xmlNewNs(self._o, href, prefix)
|
---|
3373 | if ret is None:raise treeError('xmlNewNs() failed')
|
---|
3374 | __tmp = xmlNs(_obj=ret)
|
---|
3375 | return __tmp
|
---|
3376 |
|
---|
3377 | def newNsProp(self, ns, name, value):
|
---|
3378 | """Create a new property tagged with a namespace and carried
|
---|
3379 | by a node. """
|
---|
3380 | if ns is None: ns__o = None
|
---|
3381 | else: ns__o = ns._o
|
---|
3382 | ret = libxml2mod.xmlNewNsProp(self._o, ns__o, name, value)
|
---|
3383 | if ret is None:raise treeError('xmlNewNsProp() failed')
|
---|
3384 | __tmp = xmlAttr(_obj=ret)
|
---|
3385 | return __tmp
|
---|
3386 |
|
---|
3387 | def newNsPropEatName(self, ns, name, value):
|
---|
3388 | """Create a new property tagged with a namespace and carried
|
---|
3389 | by a node. """
|
---|
3390 | if ns is None: ns__o = None
|
---|
3391 | else: ns__o = ns._o
|
---|
3392 | ret = libxml2mod.xmlNewNsPropEatName(self._o, ns__o, name, value)
|
---|
3393 | if ret is None:raise treeError('xmlNewNsPropEatName() failed')
|
---|
3394 | __tmp = xmlAttr(_obj=ret)
|
---|
3395 | return __tmp
|
---|
3396 |
|
---|
3397 | def newProp(self, name, value):
|
---|
3398 | """Create a new property carried by a node. """
|
---|
3399 | ret = libxml2mod.xmlNewProp(self._o, name, value)
|
---|
3400 | if ret is None:raise treeError('xmlNewProp() failed')
|
---|
3401 | __tmp = xmlAttr(_obj=ret)
|
---|
3402 | return __tmp
|
---|
3403 |
|
---|
3404 | def newTextChild(self, ns, name, content):
|
---|
3405 | """Creation of a new child element, added at the end of
|
---|
3406 | @parent children list. @ns and @content parameters are
|
---|
3407 | optional (None). If @ns is None, the newly created element
|
---|
3408 | inherits the namespace of @parent. If @content is non None,
|
---|
3409 | a child TEXT node will be created containing the string
|
---|
3410 | @content. NOTE: Use xmlNewChild() if @content will contain
|
---|
3411 | entities that need to be preserved. Use this function,
|
---|
3412 | xmlNewTextChild(), if you need to ensure that reserved XML
|
---|
3413 | chars that might appear in @content, such as the ampersand,
|
---|
3414 | greater-than or less-than signs, are automatically replaced
|
---|
3415 | by their XML escaped entity representations. """
|
---|
3416 | if ns is None: ns__o = None
|
---|
3417 | else: ns__o = ns._o
|
---|
3418 | ret = libxml2mod.xmlNewTextChild(self._o, ns__o, name, content)
|
---|
3419 | if ret is None:raise treeError('xmlNewTextChild() failed')
|
---|
3420 | __tmp = xmlNode(_obj=ret)
|
---|
3421 | return __tmp
|
---|
3422 |
|
---|
3423 | def nextElementSibling(self):
|
---|
3424 | """Finds the first closest next sibling of the node which is
|
---|
3425 | an element node. Note the handling of entities references
|
---|
3426 | is different than in the W3C DOM element traversal spec
|
---|
3427 | since we don't have back reference from entities content to
|
---|
3428 | entities references. """
|
---|
3429 | ret = libxml2mod.xmlNextElementSibling(self._o)
|
---|
3430 | if ret is None:return None
|
---|
3431 | __tmp = xmlNode(_obj=ret)
|
---|
3432 | return __tmp
|
---|
3433 |
|
---|
3434 | def noNsProp(self, name):
|
---|
3435 | """Search and get the value of an attribute associated to a
|
---|
3436 | node This does the entity substitution. This function looks
|
---|
3437 | in DTD attribute declaration for #FIXED or default
|
---|
3438 | declaration values unless DTD use has been turned off. This
|
---|
3439 | function is similar to xmlGetProp except it will accept
|
---|
3440 | only an attribute in no namespace. """
|
---|
3441 | ret = libxml2mod.xmlGetNoNsProp(self._o, name)
|
---|
3442 | return ret
|
---|
3443 |
|
---|
3444 | def nodePath(self):
|
---|
3445 | """Build a structure based Path for the given node """
|
---|
3446 | ret = libxml2mod.xmlGetNodePath(self._o)
|
---|
3447 | return ret
|
---|
3448 |
|
---|
3449 | def nsProp(self, name, nameSpace):
|
---|
3450 | """Search and get the value of an attribute associated to a
|
---|
3451 | node This attribute has to be anchored in the namespace
|
---|
3452 | specified. This does the entity substitution. This function
|
---|
3453 | looks in DTD attribute declaration for #FIXED or default
|
---|
3454 | declaration values unless DTD use has been turned off. """
|
---|
3455 | ret = libxml2mod.xmlGetNsProp(self._o, name, nameSpace)
|
---|
3456 | return ret
|
---|
3457 |
|
---|
3458 | def previousElementSibling(self):
|
---|
3459 | """Finds the first closest previous sibling of the node which
|
---|
3460 | is an element node. Note the handling of entities
|
---|
3461 | references is different than in the W3C DOM element
|
---|
3462 | traversal spec since we don't have back reference from
|
---|
3463 | entities content to entities references. """
|
---|
3464 | ret = libxml2mod.xmlPreviousElementSibling(self._o)
|
---|
3465 | if ret is None:return None
|
---|
3466 | __tmp = xmlNode(_obj=ret)
|
---|
3467 | return __tmp
|
---|
3468 |
|
---|
3469 | def prop(self, name):
|
---|
3470 | """Search and get the value of an attribute associated to a
|
---|
3471 | node This does the entity substitution. This function looks
|
---|
3472 | in DTD attribute declaration for #FIXED or default
|
---|
3473 | declaration values unless DTD use has been turned off.
|
---|
3474 | NOTE: this function acts independently of namespaces
|
---|
3475 | associated to the attribute. Use xmlGetNsProp() or
|
---|
3476 | xmlGetNoNsProp() for namespace aware processing. """
|
---|
3477 | ret = libxml2mod.xmlGetProp(self._o, name)
|
---|
3478 | return ret
|
---|
3479 |
|
---|
3480 | def reconciliateNs(self, doc):
|
---|
3481 | """This function checks that all the namespaces declared
|
---|
3482 | within the given tree are properly declared. This is needed
|
---|
3483 | for example after Copy or Cut and then paste operations.
|
---|
3484 | The subtree may still hold pointers to namespace
|
---|
3485 | declarations outside the subtree or invalid/masked. As much
|
---|
3486 | as possible the function try to reuse the existing
|
---|
3487 | namespaces found in the new environment. If not possible
|
---|
3488 | the new namespaces are redeclared on @tree at the top of
|
---|
3489 | the given subtree. """
|
---|
3490 | if doc is None: doc__o = None
|
---|
3491 | else: doc__o = doc._o
|
---|
3492 | ret = libxml2mod.xmlReconciliateNs(doc__o, self._o)
|
---|
3493 | return ret
|
---|
3494 |
|
---|
3495 | def replaceNode(self, cur):
|
---|
3496 | """Unlink the old node from its current context, prune the new
|
---|
3497 | one at the same place. If @cur was already inserted in a
|
---|
3498 | document it is first unlinked from its existing context. """
|
---|
3499 | if cur is None: cur__o = None
|
---|
3500 | else: cur__o = cur._o
|
---|
3501 | ret = libxml2mod.xmlReplaceNode(self._o, cur__o)
|
---|
3502 | if ret is None:raise treeError('xmlReplaceNode() failed')
|
---|
3503 | __tmp = xmlNode(_obj=ret)
|
---|
3504 | return __tmp
|
---|
3505 |
|
---|
3506 | def searchNs(self, doc, nameSpace):
|
---|
3507 | """Search a Ns registered under a given name space for a
|
---|
3508 | document. recurse on the parents until it finds the defined
|
---|
3509 | namespace or return None otherwise. @nameSpace can be None,
|
---|
3510 | this is a search for the default namespace. We don't allow
|
---|
3511 | to cross entities boundaries. If you don't declare the
|
---|
3512 | namespace within those you will be in troubles !!! A
|
---|
3513 | warning is generated to cover this case. """
|
---|
3514 | if doc is None: doc__o = None
|
---|
3515 | else: doc__o = doc._o
|
---|
3516 | ret = libxml2mod.xmlSearchNs(doc__o, self._o, nameSpace)
|
---|
3517 | if ret is None:raise treeError('xmlSearchNs() failed')
|
---|
3518 | __tmp = xmlNs(_obj=ret)
|
---|
3519 | return __tmp
|
---|
3520 |
|
---|
3521 | def searchNsByHref(self, doc, href):
|
---|
3522 | """Search a Ns aliasing a given URI. Recurse on the parents
|
---|
3523 | until it finds the defined namespace or return None
|
---|
3524 | otherwise. """
|
---|
3525 | if doc is None: doc__o = None
|
---|
3526 | else: doc__o = doc._o
|
---|
3527 | ret = libxml2mod.xmlSearchNsByHref(doc__o, self._o, href)
|
---|
3528 | if ret is None:raise treeError('xmlSearchNsByHref() failed')
|
---|
3529 | __tmp = xmlNs(_obj=ret)
|
---|
3530 | return __tmp
|
---|
3531 |
|
---|
3532 | def setBase(self, uri):
|
---|
3533 | """Set (or reset) the base URI of a node, i.e. the value of
|
---|
3534 | the xml:base attribute. """
|
---|
3535 | libxml2mod.xmlNodeSetBase(self._o, uri)
|
---|
3536 |
|
---|
3537 | def setContent(self, content):
|
---|
3538 | """Replace the content of a node. NOTE: @content is supposed
|
---|
3539 | to be a piece of XML CDATA, so it allows entity references,
|
---|
3540 | but XML special chars need to be escaped first by using
|
---|
3541 | xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars(). """
|
---|
3542 | libxml2mod.xmlNodeSetContent(self._o, content)
|
---|
3543 |
|
---|
3544 | def setContentLen(self, content, len):
|
---|
3545 | """Replace the content of a node. NOTE: @content is supposed
|
---|
3546 | to be a piece of XML CDATA, so it allows entity references,
|
---|
3547 | but XML special chars need to be escaped first by using
|
---|
3548 | xmlEncodeEntitiesReentrant() resp. xmlEncodeSpecialChars(). """
|
---|
3549 | libxml2mod.xmlNodeSetContentLen(self._o, content, len)
|
---|
3550 |
|
---|
3551 | def setLang(self, lang):
|
---|
3552 | """Set the language of a node, i.e. the values of the xml:lang
|
---|
3553 | attribute. """
|
---|
3554 | libxml2mod.xmlNodeSetLang(self._o, lang)
|
---|
3555 |
|
---|
3556 | def setListDoc(self, doc):
|
---|
3557 | """update all nodes in the list to point to the right document """
|
---|
3558 | if doc is None: doc__o = None
|
---|
3559 | else: doc__o = doc._o
|
---|
3560 | libxml2mod.xmlSetListDoc(self._o, doc__o)
|
---|
3561 |
|
---|
3562 | def setName(self, name):
|
---|
3563 | """Set (or reset) the name of a node. """
|
---|
3564 | libxml2mod.xmlNodeSetName(self._o, name)
|
---|
3565 |
|
---|
3566 | def setNs(self, ns):
|
---|
3567 | """Associate a namespace to a node, a posteriori. """
|
---|
3568 | if ns is None: ns__o = None
|
---|
3569 | else: ns__o = ns._o
|
---|
3570 | libxml2mod.xmlSetNs(self._o, ns__o)
|
---|
3571 |
|
---|
3572 | def setNsProp(self, ns, name, value):
|
---|
3573 | """Set (or reset) an attribute carried by a node. The ns
|
---|
3574 | structure must be in scope, this is not checked """
|
---|
3575 | if ns is None: ns__o = None
|
---|
3576 | else: ns__o = ns._o
|
---|
3577 | ret = libxml2mod.xmlSetNsProp(self._o, ns__o, name, value)
|
---|
3578 | if ret is None:raise treeError('xmlSetNsProp() failed')
|
---|
3579 | __tmp = xmlAttr(_obj=ret)
|
---|
3580 | return __tmp
|
---|
3581 |
|
---|
3582 | def setProp(self, name, value):
|
---|
3583 | """Set (or reset) an attribute carried by a node. If @name has
|
---|
3584 | a prefix, then the corresponding namespace-binding will be
|
---|
3585 | used, if in scope; it is an error it there's no such
|
---|
3586 | ns-binding for the prefix in scope. """
|
---|
3587 | ret = libxml2mod.xmlSetProp(self._o, name, value)
|
---|
3588 | if ret is None:raise treeError('xmlSetProp() failed')
|
---|
3589 | __tmp = xmlAttr(_obj=ret)
|
---|
3590 | return __tmp
|
---|
3591 |
|
---|
3592 | def setSpacePreserve(self, val):
|
---|
3593 | """Set (or reset) the space preserving behaviour of a node,
|
---|
3594 | i.e. the value of the xml:space attribute. """
|
---|
3595 | libxml2mod.xmlNodeSetSpacePreserve(self._o, val)
|
---|
3596 |
|
---|
3597 | def setTreeDoc(self, doc):
|
---|
3598 | """update all nodes under the tree to point to the right
|
---|
3599 | document """
|
---|
3600 | if doc is None: doc__o = None
|
---|
3601 | else: doc__o = doc._o
|
---|
3602 | libxml2mod.xmlSetTreeDoc(self._o, doc__o)
|
---|
3603 |
|
---|
3604 | def textConcat(self, content, len):
|
---|
3605 | """Concat the given string at the end of the existing node
|
---|
3606 | content """
|
---|
3607 | ret = libxml2mod.xmlTextConcat(self._o, content, len)
|
---|
3608 | return ret
|
---|
3609 |
|
---|
3610 | def textMerge(self, second):
|
---|
3611 | """Merge two text nodes into one """
|
---|
3612 | if second is None: second__o = None
|
---|
3613 | else: second__o = second._o
|
---|
3614 | ret = libxml2mod.xmlTextMerge(self._o, second__o)
|
---|
3615 | if ret is None:raise treeError('xmlTextMerge() failed')
|
---|
3616 | __tmp = xmlNode(_obj=ret)
|
---|
3617 | return __tmp
|
---|
3618 |
|
---|
3619 | def unlinkNode(self):
|
---|
3620 | """Unlink a node from it's current context, the node is not
|
---|
3621 | freed If one need to free the node, use xmlFreeNode()
|
---|
3622 | routine after the unlink to discard it. Note that namespace
|
---|
3623 | nodes can't be unlinked as they do not have pointer to
|
---|
3624 | their parent. """
|
---|
3625 | libxml2mod.xmlUnlinkNode(self._o)
|
---|
3626 |
|
---|
3627 | def unsetNsProp(self, ns, name):
|
---|
3628 | """Remove an attribute carried by a node. """
|
---|
3629 | if ns is None: ns__o = None
|
---|
3630 | else: ns__o = ns._o
|
---|
3631 | ret = libxml2mod.xmlUnsetNsProp(self._o, ns__o, name)
|
---|
3632 | return ret
|
---|
3633 |
|
---|
3634 | def unsetProp(self, name):
|
---|
3635 | """Remove an attribute carried by a node. This handles only
|
---|
3636 | attributes in no namespace. """
|
---|
3637 | ret = libxml2mod.xmlUnsetProp(self._o, name)
|
---|
3638 | return ret
|
---|
3639 |
|
---|
3640 | #
|
---|
3641 | # xmlNode functions from module valid
|
---|
3642 | #
|
---|
3643 |
|
---|
3644 | def isID(self, doc, attr):
|
---|
3645 | """Determine whether an attribute is of type ID. In case we
|
---|
3646 | have DTD(s) then this is done if DTD loading has been
|
---|
3647 | requested. In the case of HTML documents parsed with the
|
---|
3648 | HTML parser, then ID detection is done systematically. """
|
---|
3649 | if doc is None: doc__o = None
|
---|
3650 | else: doc__o = doc._o
|
---|
3651 | if attr is None: attr__o = None
|
---|
3652 | else: attr__o = attr._o
|
---|
3653 | ret = libxml2mod.xmlIsID(doc__o, self._o, attr__o)
|
---|
3654 | return ret
|
---|
3655 |
|
---|
3656 | def isRef(self, doc, attr):
|
---|
3657 | """Determine whether an attribute is of type Ref. In case we
|
---|
3658 | have DTD(s) then this is simple, otherwise we use an
|
---|
3659 | heuristic: name Ref (upper or lowercase). """
|
---|
3660 | if doc is None: doc__o = None
|
---|
3661 | else: doc__o = doc._o
|
---|
3662 | if attr is None: attr__o = None
|
---|
3663 | else: attr__o = attr._o
|
---|
3664 | ret = libxml2mod.xmlIsRef(doc__o, self._o, attr__o)
|
---|
3665 | return ret
|
---|
3666 |
|
---|
3667 | def validNormalizeAttributeValue(self, doc, name, value):
|
---|
3668 | """Does the validation related extra step of the normalization
|
---|
3669 | of attribute values: If the declared value is not CDATA,
|
---|
3670 | then the XML processor must further process the normalized
|
---|
3671 | attribute value by discarding any leading and trailing
|
---|
3672 | space (#x20) characters, and by replacing sequences of
|
---|
3673 | space (#x20) characters by single space (#x20) character. """
|
---|
3674 | if doc is None: doc__o = None
|
---|
3675 | else: doc__o = doc._o
|
---|
3676 | ret = libxml2mod.xmlValidNormalizeAttributeValue(doc__o, self._o, name, value)
|
---|
3677 | return ret
|
---|
3678 |
|
---|
3679 | #
|
---|
3680 | # xmlNode functions from module xinclude
|
---|
3681 | #
|
---|
3682 |
|
---|
3683 | def xincludeProcessTree(self):
|
---|
3684 | """Implement the XInclude substitution for the given subtree """
|
---|
3685 | ret = libxml2mod.xmlXIncludeProcessTree(self._o)
|
---|
3686 | return ret
|
---|
3687 |
|
---|
3688 | def xincludeProcessTreeFlags(self, flags):
|
---|
3689 | """Implement the XInclude substitution for the given subtree """
|
---|
3690 | ret = libxml2mod.xmlXIncludeProcessTreeFlags(self._o, flags)
|
---|
3691 | return ret
|
---|
3692 |
|
---|
3693 | #
|
---|
3694 | # xmlNode functions from module xmlschemas
|
---|
3695 | #
|
---|
3696 |
|
---|
3697 | def schemaValidateOneElement(self, ctxt):
|
---|
3698 | """Validate a branch of a tree, starting with the given @elem. """
|
---|
3699 | if ctxt is None: ctxt__o = None
|
---|
3700 | else: ctxt__o = ctxt._o
|
---|
3701 | ret = libxml2mod.xmlSchemaValidateOneElement(ctxt__o, self._o)
|
---|
3702 | return ret
|
---|
3703 |
|
---|
3704 | #
|
---|
3705 | # xmlNode functions from module xpath
|
---|
3706 | #
|
---|
3707 |
|
---|
3708 | def xpathCastNodeToNumber(self):
|
---|
3709 | """Converts a node to its number value """
|
---|
3710 | ret = libxml2mod.xmlXPathCastNodeToNumber(self._o)
|
---|
3711 | return ret
|
---|
3712 |
|
---|
3713 | def xpathCastNodeToString(self):
|
---|
3714 | """Converts a node to its string value. """
|
---|
3715 | ret = libxml2mod.xmlXPathCastNodeToString(self._o)
|
---|
3716 | return ret
|
---|
3717 |
|
---|
3718 | def xpathCmpNodes(self, node2):
|
---|
3719 | """Compare two nodes w.r.t document order """
|
---|
3720 | if node2 is None: node2__o = None
|
---|
3721 | else: node2__o = node2._o
|
---|
3722 | ret = libxml2mod.xmlXPathCmpNodes(self._o, node2__o)
|
---|
3723 | return ret
|
---|
3724 |
|
---|
3725 | def xpathNodeEval(self, str, ctx):
|
---|
3726 | """Evaluate the XPath Location Path in the given context. The
|
---|
3727 | node 'node' is set as the context node. The context node is
|
---|
3728 | not restored. """
|
---|
3729 | if ctx is None: ctx__o = None
|
---|
3730 | else: ctx__o = ctx._o
|
---|
3731 | ret = libxml2mod.xmlXPathNodeEval(self._o, str, ctx__o)
|
---|
3732 | if ret is None:raise xpathError('xmlXPathNodeEval() failed')
|
---|
3733 | return xpathObjectRet(ret)
|
---|
3734 |
|
---|
3735 | #
|
---|
3736 | # xmlNode functions from module xpathInternals
|
---|
3737 | #
|
---|
3738 |
|
---|
3739 | def xpathNewNodeSet(self):
|
---|
3740 | """Create a new xmlXPathObjectPtr of type NodeSet and
|
---|
3741 | initialize it with the single Node @val """
|
---|
3742 | ret = libxml2mod.xmlXPathNewNodeSet(self._o)
|
---|
3743 | if ret is None:raise xpathError('xmlXPathNewNodeSet() failed')
|
---|
3744 | return xpathObjectRet(ret)
|
---|
3745 |
|
---|
3746 | def xpathNewValueTree(self):
|
---|
3747 | """Create a new xmlXPathObjectPtr of type Value Tree (XSLT)
|
---|
3748 | and initialize it with the tree root @val """
|
---|
3749 | ret = libxml2mod.xmlXPathNewValueTree(self._o)
|
---|
3750 | if ret is None:raise xpathError('xmlXPathNewValueTree() failed')
|
---|
3751 | return xpathObjectRet(ret)
|
---|
3752 |
|
---|
3753 | def xpathNextAncestor(self, ctxt):
|
---|
3754 | """Traversal function for the "ancestor" direction the
|
---|
3755 | ancestor axis contains the ancestors of the context node;
|
---|
3756 | the ancestors of the context node consist of the parent of
|
---|
3757 | context node and the parent's parent and so on; the nodes
|
---|
3758 | are ordered in reverse document order; thus the parent is
|
---|
3759 | the first node on the axis, and the parent's parent is the
|
---|
3760 | second node on the axis """
|
---|
3761 | if ctxt is None: ctxt__o = None
|
---|
3762 | else: ctxt__o = ctxt._o
|
---|
3763 | ret = libxml2mod.xmlXPathNextAncestor(ctxt__o, self._o)
|
---|
3764 | if ret is None:raise xpathError('xmlXPathNextAncestor() failed')
|
---|
3765 | __tmp = xmlNode(_obj=ret)
|
---|
3766 | return __tmp
|
---|
3767 |
|
---|
3768 | def xpathNextAncestorOrSelf(self, ctxt):
|
---|
3769 | """Traversal function for the "ancestor-or-self" direction he
|
---|
3770 | ancestor-or-self axis contains the context node and
|
---|
3771 | ancestors of the context node in reverse document order;
|
---|
3772 | thus the context node is the first node on the axis, and
|
---|
3773 | the context node's parent the second; parent here is
|
---|
3774 | defined the same as with the parent axis. """
|
---|
3775 | if ctxt is None: ctxt__o = None
|
---|
3776 | else: ctxt__o = ctxt._o
|
---|
3777 | ret = libxml2mod.xmlXPathNextAncestorOrSelf(ctxt__o, self._o)
|
---|
3778 | if ret is None:raise xpathError('xmlXPathNextAncestorOrSelf() failed')
|
---|
3779 | __tmp = xmlNode(_obj=ret)
|
---|
3780 | return __tmp
|
---|
3781 |
|
---|
3782 | def xpathNextAttribute(self, ctxt):
|
---|
3783 | """Traversal function for the "attribute" direction TODO:
|
---|
3784 | support DTD inherited default attributes """
|
---|
3785 | if ctxt is None: ctxt__o = None
|
---|
3786 | else: ctxt__o = ctxt._o
|
---|
3787 | ret = libxml2mod.xmlXPathNextAttribute(ctxt__o, self._o)
|
---|
3788 | if ret is None:raise xpathError('xmlXPathNextAttribute() failed')
|
---|
3789 | __tmp = xmlNode(_obj=ret)
|
---|
3790 | return __tmp
|
---|
3791 |
|
---|
3792 | def xpathNextChild(self, ctxt):
|
---|
3793 | """Traversal function for the "child" direction The child axis
|
---|
3794 | contains the children of the context node in document order. """
|
---|
3795 | if ctxt is None: ctxt__o = None
|
---|
3796 | else: ctxt__o = ctxt._o
|
---|
3797 | ret = libxml2mod.xmlXPathNextChild(ctxt__o, self._o)
|
---|
3798 | if ret is None:raise xpathError('xmlXPathNextChild() failed')
|
---|
3799 | __tmp = xmlNode(_obj=ret)
|
---|
3800 | return __tmp
|
---|
3801 |
|
---|
3802 | def xpathNextDescendant(self, ctxt):
|
---|
3803 | """Traversal function for the "descendant" direction the
|
---|
3804 | descendant axis contains the descendants of the context
|
---|
3805 | node in document order; a descendant is a child or a child
|
---|
3806 | of a child and so on. """
|
---|
3807 | if ctxt is None: ctxt__o = None
|
---|
3808 | else: ctxt__o = ctxt._o
|
---|
3809 | ret = libxml2mod.xmlXPathNextDescendant(ctxt__o, self._o)
|
---|
3810 | if ret is None:raise xpathError('xmlXPathNextDescendant() failed')
|
---|
3811 | __tmp = xmlNode(_obj=ret)
|
---|
3812 | return __tmp
|
---|
3813 |
|
---|
3814 | def xpathNextDescendantOrSelf(self, ctxt):
|
---|
3815 | """Traversal function for the "descendant-or-self" direction
|
---|
3816 | the descendant-or-self axis contains the context node and
|
---|
3817 | the descendants of the context node in document order; thus
|
---|
3818 | the context node is the first node on the axis, and the
|
---|
3819 | first child of the context node is the second node on the
|
---|
3820 | axis """
|
---|
3821 | if ctxt is None: ctxt__o = None
|
---|
3822 | else: ctxt__o = ctxt._o
|
---|
3823 | ret = libxml2mod.xmlXPathNextDescendantOrSelf(ctxt__o, self._o)
|
---|
3824 | if ret is None:raise xpathError('xmlXPathNextDescendantOrSelf() failed')
|
---|
3825 | __tmp = xmlNode(_obj=ret)
|
---|
3826 | return __tmp
|
---|
3827 |
|
---|
3828 | def xpathNextFollowing(self, ctxt):
|
---|
3829 | """Traversal function for the "following" direction The
|
---|
3830 | following axis contains all nodes in the same document as
|
---|
3831 | the context node that are after the context node in
|
---|
3832 | document order, excluding any descendants and excluding
|
---|
3833 | attribute nodes and namespace nodes; the nodes are ordered
|
---|
3834 | in document order """
|
---|
3835 | if ctxt is None: ctxt__o = None
|
---|
3836 | else: ctxt__o = ctxt._o
|
---|
3837 | ret = libxml2mod.xmlXPathNextFollowing(ctxt__o, self._o)
|
---|
3838 | if ret is None:raise xpathError('xmlXPathNextFollowing() failed')
|
---|
3839 | __tmp = xmlNode(_obj=ret)
|
---|
3840 | return __tmp
|
---|
3841 |
|
---|
3842 | def xpathNextFollowingSibling(self, ctxt):
|
---|
3843 | """Traversal function for the "following-sibling" direction
|
---|
3844 | The following-sibling axis contains the following siblings
|
---|
3845 | of the context node in document order. """
|
---|
3846 | if ctxt is None: ctxt__o = None
|
---|
3847 | else: ctxt__o = ctxt._o
|
---|
3848 | ret = libxml2mod.xmlXPathNextFollowingSibling(ctxt__o, self._o)
|
---|
3849 | if ret is None:raise xpathError('xmlXPathNextFollowingSibling() failed')
|
---|
3850 | __tmp = xmlNode(_obj=ret)
|
---|
3851 | return __tmp
|
---|
3852 |
|
---|
3853 | def xpathNextNamespace(self, ctxt):
|
---|
3854 | """Traversal function for the "namespace" direction the
|
---|
3855 | namespace axis contains the namespace nodes of the context
|
---|
3856 | node; the order of nodes on this axis is
|
---|
3857 | implementation-defined; the axis will be empty unless the
|
---|
3858 | context node is an element We keep the XML namespace node
|
---|
3859 | at the end of the list. """
|
---|
3860 | if ctxt is None: ctxt__o = None
|
---|
3861 | else: ctxt__o = ctxt._o
|
---|
3862 | ret = libxml2mod.xmlXPathNextNamespace(ctxt__o, self._o)
|
---|
3863 | if ret is None:raise xpathError('xmlXPathNextNamespace() failed')
|
---|
3864 | __tmp = xmlNode(_obj=ret)
|
---|
3865 | return __tmp
|
---|
3866 |
|
---|
3867 | def xpathNextParent(self, ctxt):
|
---|
3868 | """Traversal function for the "parent" direction The parent
|
---|
3869 | axis contains the parent of the context node, if there is
|
---|
3870 | one. """
|
---|
3871 | if ctxt is None: ctxt__o = None
|
---|
3872 | else: ctxt__o = ctxt._o
|
---|
3873 | ret = libxml2mod.xmlXPathNextParent(ctxt__o, self._o)
|
---|
3874 | if ret is None:raise xpathError('xmlXPathNextParent() failed')
|
---|
3875 | __tmp = xmlNode(_obj=ret)
|
---|
3876 | return __tmp
|
---|
3877 |
|
---|
3878 | def xpathNextPreceding(self, ctxt):
|
---|
3879 | """Traversal function for the "preceding" direction the
|
---|
3880 | preceding axis contains all nodes in the same document as
|
---|
3881 | the context node that are before the context node in
|
---|
3882 | document order, excluding any ancestors and excluding
|
---|
3883 | attribute nodes and namespace nodes; the nodes are ordered
|
---|
3884 | in reverse document order """
|
---|
3885 | if ctxt is None: ctxt__o = None
|
---|
3886 | else: ctxt__o = ctxt._o
|
---|
3887 | ret = libxml2mod.xmlXPathNextPreceding(ctxt__o, self._o)
|
---|
3888 | if ret is None:raise xpathError('xmlXPathNextPreceding() failed')
|
---|
3889 | __tmp = xmlNode(_obj=ret)
|
---|
3890 | return __tmp
|
---|
3891 |
|
---|
3892 | def xpathNextPrecedingSibling(self, ctxt):
|
---|
3893 | """Traversal function for the "preceding-sibling" direction
|
---|
3894 | The preceding-sibling axis contains the preceding siblings
|
---|
3895 | of the context node in reverse document order; the first
|
---|
3896 | preceding sibling is first on the axis; the sibling
|
---|
3897 | preceding that node is the second on the axis and so on. """
|
---|
3898 | if ctxt is None: ctxt__o = None
|
---|
3899 | else: ctxt__o = ctxt._o
|
---|
3900 | ret = libxml2mod.xmlXPathNextPrecedingSibling(ctxt__o, self._o)
|
---|
3901 | if ret is None:raise xpathError('xmlXPathNextPrecedingSibling() failed')
|
---|
3902 | __tmp = xmlNode(_obj=ret)
|
---|
3903 | return __tmp
|
---|
3904 |
|
---|
3905 | def xpathNextSelf(self, ctxt):
|
---|
3906 | """Traversal function for the "self" direction The self axis
|
---|
3907 | contains just the context node itself """
|
---|
3908 | if ctxt is None: ctxt__o = None
|
---|
3909 | else: ctxt__o = ctxt._o
|
---|
3910 | ret = libxml2mod.xmlXPathNextSelf(ctxt__o, self._o)
|
---|
3911 | if ret is None:raise xpathError('xmlXPathNextSelf() failed')
|
---|
3912 | __tmp = xmlNode(_obj=ret)
|
---|
3913 | return __tmp
|
---|
3914 |
|
---|
3915 | #
|
---|
3916 | # xmlNode functions from module xpointer
|
---|
3917 | #
|
---|
3918 |
|
---|
3919 | def xpointerNewCollapsedRange(self):
|
---|
3920 | """Create a new xmlXPathObjectPtr of type range using a single
|
---|
3921 | nodes """
|
---|
3922 | ret = libxml2mod.xmlXPtrNewCollapsedRange(self._o)
|
---|
3923 | if ret is None:raise treeError('xmlXPtrNewCollapsedRange() failed')
|
---|
3924 | return xpathObjectRet(ret)
|
---|
3925 |
|
---|
3926 | def xpointerNewContext(self, doc, origin):
|
---|
3927 | """Create a new XPointer context """
|
---|
3928 | if doc is None: doc__o = None
|
---|
3929 | else: doc__o = doc._o
|
---|
3930 | if origin is None: origin__o = None
|
---|
3931 | else: origin__o = origin._o
|
---|
3932 | ret = libxml2mod.xmlXPtrNewContext(doc__o, self._o, origin__o)
|
---|
3933 | if ret is None:raise treeError('xmlXPtrNewContext() failed')
|
---|
3934 | __tmp = xpathContext(_obj=ret)
|
---|
3935 | return __tmp
|
---|
3936 |
|
---|
3937 | def xpointerNewLocationSetNodes(self, end):
|
---|
3938 | """Create a new xmlXPathObjectPtr of type LocationSet and
|
---|
3939 | initialize it with the single range made of the two nodes
|
---|
3940 | @start and @end """
|
---|
3941 | if end is None: end__o = None
|
---|
3942 | else: end__o = end._o
|
---|
3943 | ret = libxml2mod.xmlXPtrNewLocationSetNodes(self._o, end__o)
|
---|
3944 | if ret is None:raise treeError('xmlXPtrNewLocationSetNodes() failed')
|
---|
3945 | return xpathObjectRet(ret)
|
---|
3946 |
|
---|
3947 | def xpointerNewRange(self, startindex, end, endindex):
|
---|
3948 | """Create a new xmlXPathObjectPtr of type range """
|
---|
3949 | if end is None: end__o = None
|
---|
3950 | else: end__o = end._o
|
---|
3951 | ret = libxml2mod.xmlXPtrNewRange(self._o, startindex, end__o, endindex)
|
---|
3952 | if ret is None:raise treeError('xmlXPtrNewRange() failed')
|
---|
3953 | return xpathObjectRet(ret)
|
---|
3954 |
|
---|
3955 | def xpointerNewRangeNodes(self, end):
|
---|
3956 | """Create a new xmlXPathObjectPtr of type range using 2 nodes """
|
---|
3957 | if end is None: end__o = None
|
---|
3958 | else: end__o = end._o
|
---|
3959 | ret = libxml2mod.xmlXPtrNewRangeNodes(self._o, end__o)
|
---|
3960 | if ret is None:raise treeError('xmlXPtrNewRangeNodes() failed')
|
---|
3961 | return xpathObjectRet(ret)
|
---|
3962 |
|
---|
3963 | class xmlDoc(xmlNode):
|
---|
3964 | def __init__(self, _obj=None):
|
---|
3965 | if checkWrapper(_obj) != 0: raise TypeError('xmlDoc got a wrong wrapper object type')
|
---|
3966 | self._o = _obj
|
---|
3967 | xmlNode.__init__(self, _obj=_obj)
|
---|
3968 |
|
---|
3969 | def __repr__(self):
|
---|
3970 | return "<xmlDoc (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
|
---|
3971 |
|
---|
3972 | #
|
---|
3973 | # xmlDoc functions from module HTMLparser
|
---|
3974 | #
|
---|
3975 |
|
---|
3976 | def htmlAutoCloseTag(self, name, elem):
|
---|
3977 | """The HTML DTD allows a tag to implicitly close other tags.
|
---|
3978 | The list is kept in htmlStartClose array. This function
|
---|
3979 | checks if the element or one of it's children would
|
---|
3980 | autoclose the given tag. """
|
---|
3981 | ret = libxml2mod.htmlAutoCloseTag(self._o, name, elem)
|
---|
3982 | return ret
|
---|
3983 |
|
---|
3984 | def htmlIsAutoClosed(self, elem):
|
---|
3985 | """The HTML DTD allows a tag to implicitly close other tags.
|
---|
3986 | The list is kept in htmlStartClose array. This function
|
---|
3987 | checks if a tag is autoclosed by one of it's child """
|
---|
3988 | ret = libxml2mod.htmlIsAutoClosed(self._o, elem)
|
---|
3989 | return ret
|
---|
3990 |
|
---|
3991 | #
|
---|
3992 | # xmlDoc functions from module HTMLtree
|
---|
3993 | #
|
---|
3994 |
|
---|
3995 | def htmlDocContentDumpFormatOutput(self, buf, encoding, format):
|
---|
3996 | """Dump an HTML document. """
|
---|
3997 | if buf is None: buf__o = None
|
---|
3998 | else: buf__o = buf._o
|
---|
3999 | libxml2mod.htmlDocContentDumpFormatOutput(buf__o, self._o, encoding, format)
|
---|
4000 |
|
---|
4001 | def htmlDocContentDumpOutput(self, buf, encoding):
|
---|
4002 | """Dump an HTML document. Formating return/spaces are added. """
|
---|
4003 | if buf is None: buf__o = None
|
---|
4004 | else: buf__o = buf._o
|
---|
4005 | libxml2mod.htmlDocContentDumpOutput(buf__o, self._o, encoding)
|
---|
4006 |
|
---|
4007 | def htmlDocDump(self, f):
|
---|
4008 | """Dump an HTML document to an open FILE. """
|
---|
4009 | ret = libxml2mod.htmlDocDump(f, self._o)
|
---|
4010 | return ret
|
---|
4011 |
|
---|
4012 | def htmlGetMetaEncoding(self):
|
---|
4013 | """Encoding definition lookup in the Meta tags """
|
---|
4014 | ret = libxml2mod.htmlGetMetaEncoding(self._o)
|
---|
4015 | return ret
|
---|
4016 |
|
---|
4017 | def htmlNodeDumpFile(self, out, cur):
|
---|
4018 | """Dump an HTML node, recursive behaviour,children are printed
|
---|
4019 | too, and formatting returns are added. """
|
---|
4020 | if cur is None: cur__o = None
|
---|
4021 | else: cur__o = cur._o
|
---|
4022 | libxml2mod.htmlNodeDumpFile(out, self._o, cur__o)
|
---|
4023 |
|
---|
4024 | def htmlNodeDumpFileFormat(self, out, cur, encoding, format):
|
---|
4025 | """Dump an HTML node, recursive behaviour,children are printed
|
---|
4026 | too. TODO: if encoding == None try to save in the doc
|
---|
4027 | encoding """
|
---|
4028 | if cur is None: cur__o = None
|
---|
4029 | else: cur__o = cur._o
|
---|
4030 | ret = libxml2mod.htmlNodeDumpFileFormat(out, self._o, cur__o, encoding, format)
|
---|
4031 | return ret
|
---|
4032 |
|
---|
4033 | def htmlNodeDumpFormatOutput(self, buf, cur, encoding, format):
|
---|
4034 | """Dump an HTML node, recursive behaviour,children are printed
|
---|
4035 | too. """
|
---|
4036 | if buf is None: buf__o = None
|
---|
4037 | else: buf__o = buf._o
|
---|
4038 | if cur is None: cur__o = None
|
---|
4039 | else: cur__o = cur._o
|
---|
4040 | libxml2mod.htmlNodeDumpFormatOutput(buf__o, self._o, cur__o, encoding, format)
|
---|
4041 |
|
---|
4042 | def htmlNodeDumpOutput(self, buf, cur, encoding):
|
---|
4043 | """Dump an HTML node, recursive behaviour,children are printed
|
---|
4044 | too, and formatting returns/spaces are added. """
|
---|
4045 | if buf is None: buf__o = None
|
---|
4046 | else: buf__o = buf._o
|
---|
4047 | if cur is None: cur__o = None
|
---|
4048 | else: cur__o = cur._o
|
---|
4049 | libxml2mod.htmlNodeDumpOutput(buf__o, self._o, cur__o, encoding)
|
---|
4050 |
|
---|
4051 | def htmlSaveFile(self, filename):
|
---|
4052 | """Dump an HTML document to a file. If @filename is "-" the
|
---|
4053 | stdout file is used. """
|
---|
4054 | ret = libxml2mod.htmlSaveFile(filename, self._o)
|
---|
4055 | return ret
|
---|
4056 |
|
---|
4057 | def htmlSaveFileEnc(self, filename, encoding):
|
---|
4058 | """Dump an HTML document to a file using a given encoding and
|
---|
4059 | formatting returns/spaces are added. """
|
---|
4060 | ret = libxml2mod.htmlSaveFileEnc(filename, self._o, encoding)
|
---|
4061 | return ret
|
---|
4062 |
|
---|
4063 | def htmlSaveFileFormat(self, filename, encoding, format):
|
---|
4064 | """Dump an HTML document to a file using a given encoding. """
|
---|
4065 | ret = libxml2mod.htmlSaveFileFormat(filename, self._o, encoding, format)
|
---|
4066 | return ret
|
---|
4067 |
|
---|
4068 | def htmlSetMetaEncoding(self, encoding):
|
---|
4069 | """Sets the current encoding in the Meta tags NOTE: this will
|
---|
4070 | not change the document content encoding, just the META
|
---|
4071 | flag associated. """
|
---|
4072 | ret = libxml2mod.htmlSetMetaEncoding(self._o, encoding)
|
---|
4073 | return ret
|
---|
4074 |
|
---|
4075 | #
|
---|
4076 | # xmlDoc functions from module debugXML
|
---|
4077 | #
|
---|
4078 |
|
---|
4079 | def debugCheckDocument(self, output):
|
---|
4080 | """Check the document for potential content problems, and
|
---|
4081 | output the errors to @output """
|
---|
4082 | ret = libxml2mod.xmlDebugCheckDocument(output, self._o)
|
---|
4083 | return ret
|
---|
4084 |
|
---|
4085 | def debugDumpDocument(self, output):
|
---|
4086 | """Dumps debug information for the document, it's recursive """
|
---|
4087 | libxml2mod.xmlDebugDumpDocument(output, self._o)
|
---|
4088 |
|
---|
4089 | def debugDumpDocumentHead(self, output):
|
---|
4090 | """Dumps debug information cncerning the document, not
|
---|
4091 | recursive """
|
---|
4092 | libxml2mod.xmlDebugDumpDocumentHead(output, self._o)
|
---|
4093 |
|
---|
4094 | def debugDumpEntities(self, output):
|
---|
4095 | """Dumps debug information for all the entities in use by the
|
---|
4096 | document """
|
---|
4097 | libxml2mod.xmlDebugDumpEntities(output, self._o)
|
---|
4098 |
|
---|
4099 | #
|
---|
4100 | # xmlDoc functions from module entities
|
---|
4101 | #
|
---|
4102 |
|
---|
4103 | def addDocEntity(self, name, type, ExternalID, SystemID, content):
|
---|
4104 | """Register a new entity for this document. """
|
---|
4105 | ret = libxml2mod.xmlAddDocEntity(self._o, name, type, ExternalID, SystemID, content)
|
---|
4106 | if ret is None:raise treeError('xmlAddDocEntity() failed')
|
---|
4107 | __tmp = xmlEntity(_obj=ret)
|
---|
4108 | return __tmp
|
---|
4109 |
|
---|
4110 | def addDtdEntity(self, name, type, ExternalID, SystemID, content):
|
---|
4111 | """Register a new entity for this document DTD external subset. """
|
---|
4112 | ret = libxml2mod.xmlAddDtdEntity(self._o, name, type, ExternalID, SystemID, content)
|
---|
4113 | if ret is None:raise treeError('xmlAddDtdEntity() failed')
|
---|
4114 | __tmp = xmlEntity(_obj=ret)
|
---|
4115 | return __tmp
|
---|
4116 |
|
---|
4117 | def docEntity(self, name):
|
---|
4118 | """Do an entity lookup in the document entity hash table and """
|
---|
4119 | ret = libxml2mod.xmlGetDocEntity(self._o, name)
|
---|
4120 | if ret is None:raise treeError('xmlGetDocEntity() failed')
|
---|
4121 | __tmp = xmlEntity(_obj=ret)
|
---|
4122 | return __tmp
|
---|
4123 |
|
---|
4124 | def dtdEntity(self, name):
|
---|
4125 | """Do an entity lookup in the DTD entity hash table and """
|
---|
4126 | ret = libxml2mod.xmlGetDtdEntity(self._o, name)
|
---|
4127 | if ret is None:raise treeError('xmlGetDtdEntity() failed')
|
---|
4128 | __tmp = xmlEntity(_obj=ret)
|
---|
4129 | return __tmp
|
---|
4130 |
|
---|
4131 | def encodeEntities(self, input):
|
---|
4132 | """TODO: remove xmlEncodeEntities, once we are not afraid of
|
---|
4133 | breaking binary compatibility People must migrate their
|
---|
4134 | code to xmlEncodeEntitiesReentrant ! This routine will
|
---|
4135 | issue a warning when encountered. """
|
---|
4136 | ret = libxml2mod.xmlEncodeEntities(self._o, input)
|
---|
4137 | return ret
|
---|
4138 |
|
---|
4139 | def encodeEntitiesReentrant(self, input):
|
---|
4140 | """Do a global encoding of a string, replacing the predefined
|
---|
4141 | entities and non ASCII values with their entities and
|
---|
4142 | CharRef counterparts. Contrary to xmlEncodeEntities, this
|
---|
4143 | routine is reentrant, and result must be deallocated. """
|
---|
4144 | ret = libxml2mod.xmlEncodeEntitiesReentrant(self._o, input)
|
---|
4145 | return ret
|
---|
4146 |
|
---|
4147 | def encodeSpecialChars(self, input):
|
---|
4148 | """Do a global encoding of a string, replacing the predefined
|
---|
4149 | entities this routine is reentrant, and result must be
|
---|
4150 | deallocated. """
|
---|
4151 | ret = libxml2mod.xmlEncodeSpecialChars(self._o, input)
|
---|
4152 | return ret
|
---|
4153 |
|
---|
4154 | def newEntity(self, name, type, ExternalID, SystemID, content):
|
---|
4155 | """Create a new entity, this differs from xmlAddDocEntity()
|
---|
4156 | that if the document is None or has no internal subset
|
---|
4157 | defined, then an unlinked entity structure will be
|
---|
4158 | returned, it is then the responsability of the caller to
|
---|
4159 | link it to the document later or free it when not needed
|
---|
4160 | anymore. """
|
---|
4161 | ret = libxml2mod.xmlNewEntity(self._o, name, type, ExternalID, SystemID, content)
|
---|
4162 | if ret is None:raise treeError('xmlNewEntity() failed')
|
---|
4163 | __tmp = xmlEntity(_obj=ret)
|
---|
4164 | return __tmp
|
---|
4165 |
|
---|
4166 | def parameterEntity(self, name):
|
---|
4167 | """Do an entity lookup in the internal and external subsets and """
|
---|
4168 | ret = libxml2mod.xmlGetParameterEntity(self._o, name)
|
---|
4169 | if ret is None:raise treeError('xmlGetParameterEntity() failed')
|
---|
4170 | __tmp = xmlEntity(_obj=ret)
|
---|
4171 | return __tmp
|
---|
4172 |
|
---|
4173 | #
|
---|
4174 | # xmlDoc functions from module relaxng
|
---|
4175 | #
|
---|
4176 |
|
---|
4177 | def relaxNGNewDocParserCtxt(self):
|
---|
4178 | """Create an XML RelaxNGs parser context for that document.
|
---|
4179 | Note: since the process of compiling a RelaxNG schemas
|
---|
4180 | modifies the document, the @doc parameter is duplicated
|
---|
4181 | internally. """
|
---|
4182 | ret = libxml2mod.xmlRelaxNGNewDocParserCtxt(self._o)
|
---|
4183 | if ret is None:raise parserError('xmlRelaxNGNewDocParserCtxt() failed')
|
---|
4184 | __tmp = relaxNgParserCtxt(_obj=ret)
|
---|
4185 | return __tmp
|
---|
4186 |
|
---|
4187 | def relaxNGValidateDoc(self, ctxt):
|
---|
4188 | """Validate a document tree in memory. """
|
---|
4189 | if ctxt is None: ctxt__o = None
|
---|
4190 | else: ctxt__o = ctxt._o
|
---|
4191 | ret = libxml2mod.xmlRelaxNGValidateDoc(ctxt__o, self._o)
|
---|
4192 | return ret
|
---|
4193 |
|
---|
4194 | def relaxNGValidateFullElement(self, ctxt, elem):
|
---|
4195 | """Validate a full subtree when
|
---|
4196 | xmlRelaxNGValidatePushElement() returned 0 and the content
|
---|
4197 | of the node has been expanded. """
|
---|
4198 | if ctxt is None: ctxt__o = None
|
---|
4199 | else: ctxt__o = ctxt._o
|
---|
4200 | if elem is None: elem__o = None
|
---|
4201 | else: elem__o = elem._o
|
---|
4202 | ret = libxml2mod.xmlRelaxNGValidateFullElement(ctxt__o, self._o, elem__o)
|
---|
4203 | return ret
|
---|
4204 |
|
---|
4205 | def relaxNGValidatePopElement(self, ctxt, elem):
|
---|
4206 | """Pop the element end from the RelaxNG validation stack. """
|
---|
4207 | if ctxt is None: ctxt__o = None
|
---|
4208 | else: ctxt__o = ctxt._o
|
---|
4209 | if elem is None: elem__o = None
|
---|
4210 | else: elem__o = elem._o
|
---|
4211 | ret = libxml2mod.xmlRelaxNGValidatePopElement(ctxt__o, self._o, elem__o)
|
---|
4212 | return ret
|
---|
4213 |
|
---|
4214 | def relaxNGValidatePushElement(self, ctxt, elem):
|
---|
4215 | """Push a new element start on the RelaxNG validation stack. """
|
---|
4216 | if ctxt is None: ctxt__o = None
|
---|
4217 | else: ctxt__o = ctxt._o
|
---|
4218 | if elem is None: elem__o = None
|
---|
4219 | else: elem__o = elem._o
|
---|
4220 | ret = libxml2mod.xmlRelaxNGValidatePushElement(ctxt__o, self._o, elem__o)
|
---|
4221 | return ret
|
---|
4222 |
|
---|
4223 | #
|
---|
4224 | # xmlDoc functions from module tree
|
---|
4225 | #
|
---|
4226 |
|
---|
4227 | def copyDoc(self, recursive):
|
---|
4228 | """Do a copy of the document info. If recursive, the content
|
---|
4229 | tree will be copied too as well as DTD, namespaces and
|
---|
4230 | entities. """
|
---|
4231 | ret = libxml2mod.xmlCopyDoc(self._o, recursive)
|
---|
4232 | if ret is None:raise treeError('xmlCopyDoc() failed')
|
---|
4233 | __tmp = xmlDoc(_obj=ret)
|
---|
4234 | return __tmp
|
---|
4235 |
|
---|
4236 | def copyNode(self, node, extended):
|
---|
4237 | """Do a copy of the node to a given document. """
|
---|
4238 | if node is None: node__o = None
|
---|
4239 | else: node__o = node._o
|
---|
4240 | ret = libxml2mod.xmlDocCopyNode(node__o, self._o, extended)
|
---|
4241 | if ret is None:raise treeError('xmlDocCopyNode() failed')
|
---|
4242 | __tmp = xmlNode(_obj=ret)
|
---|
4243 | return __tmp
|
---|
4244 |
|
---|
4245 | def copyNodeList(self, node):
|
---|
4246 | """Do a recursive copy of the node list. """
|
---|
4247 | if node is None: node__o = None
|
---|
4248 | else: node__o = node._o
|
---|
4249 | ret = libxml2mod.xmlDocCopyNodeList(self._o, node__o)
|
---|
4250 | if ret is None:raise treeError('xmlDocCopyNodeList() failed')
|
---|
4251 | __tmp = xmlNode(_obj=ret)
|
---|
4252 | return __tmp
|
---|
4253 |
|
---|
4254 | def createIntSubset(self, name, ExternalID, SystemID):
|
---|
4255 | """Create the internal subset of a document """
|
---|
4256 | ret = libxml2mod.xmlCreateIntSubset(self._o, name, ExternalID, SystemID)
|
---|
4257 | if ret is None:raise treeError('xmlCreateIntSubset() failed')
|
---|
4258 | __tmp = xmlDtd(_obj=ret)
|
---|
4259 | return __tmp
|
---|
4260 |
|
---|
4261 | def docCompressMode(self):
|
---|
4262 | """get the compression ratio for a document, ZLIB based """
|
---|
4263 | ret = libxml2mod.xmlGetDocCompressMode(self._o)
|
---|
4264 | return ret
|
---|
4265 |
|
---|
4266 | def dump(self, f):
|
---|
4267 | """Dump an XML document to an open FILE. """
|
---|
4268 | ret = libxml2mod.xmlDocDump(f, self._o)
|
---|
4269 | return ret
|
---|
4270 |
|
---|
4271 | def elemDump(self, f, cur):
|
---|
4272 | """Dump an XML/HTML node, recursive behaviour, children are
|
---|
4273 | printed too. """
|
---|
4274 | if cur is None: cur__o = None
|
---|
4275 | else: cur__o = cur._o
|
---|
4276 | libxml2mod.xmlElemDump(f, self._o, cur__o)
|
---|
4277 |
|
---|
4278 | def formatDump(self, f, format):
|
---|
4279 | """Dump an XML document to an open FILE. """
|
---|
4280 | ret = libxml2mod.xmlDocFormatDump(f, self._o, format)
|
---|
4281 | return ret
|
---|
4282 |
|
---|
4283 | def freeDoc(self):
|
---|
4284 | """Free up all the structures used by a document, tree
|
---|
4285 | included. """
|
---|
4286 | libxml2mod.xmlFreeDoc(self._o)
|
---|
4287 |
|
---|
4288 | def getRootElement(self):
|
---|
4289 | """Get the root element of the document (doc->children is a
|
---|
4290 | list containing possibly comments, PIs, etc ...). """
|
---|
4291 | ret = libxml2mod.xmlDocGetRootElement(self._o)
|
---|
4292 | if ret is None:raise treeError('xmlDocGetRootElement() failed')
|
---|
4293 | __tmp = xmlNode(_obj=ret)
|
---|
4294 | return __tmp
|
---|
4295 |
|
---|
4296 | def intSubset(self):
|
---|
4297 | """Get the internal subset of a document """
|
---|
4298 | ret = libxml2mod.xmlGetIntSubset(self._o)
|
---|
4299 | if ret is None:raise treeError('xmlGetIntSubset() failed')
|
---|
4300 | __tmp = xmlDtd(_obj=ret)
|
---|
4301 | return __tmp
|
---|
4302 |
|
---|
4303 | def newCDataBlock(self, content, len):
|
---|
4304 | """Creation of a new node containing a CDATA block. """
|
---|
4305 | ret = libxml2mod.xmlNewCDataBlock(self._o, content, len)
|
---|
4306 | if ret is None:raise treeError('xmlNewCDataBlock() failed')
|
---|
4307 | __tmp = xmlNode(_obj=ret)
|
---|
4308 | return __tmp
|
---|
4309 |
|
---|
4310 | def newCharRef(self, name):
|
---|
4311 | """Creation of a new character reference node. """
|
---|
4312 | ret = libxml2mod.xmlNewCharRef(self._o, name)
|
---|
4313 | if ret is None:raise treeError('xmlNewCharRef() failed')
|
---|
4314 | __tmp = xmlNode(_obj=ret)
|
---|
4315 | return __tmp
|
---|
4316 |
|
---|
4317 | def newDocComment(self, content):
|
---|
4318 | """Creation of a new node containing a comment within a
|
---|
4319 | document. """
|
---|
4320 | ret = libxml2mod.xmlNewDocComment(self._o, content)
|
---|
4321 | if ret is None:raise treeError('xmlNewDocComment() failed')
|
---|
4322 | __tmp = xmlNode(_obj=ret)
|
---|
4323 | return __tmp
|
---|
4324 |
|
---|
4325 | def newDocFragment(self):
|
---|
4326 | """Creation of a new Fragment node. """
|
---|
4327 | ret = libxml2mod.xmlNewDocFragment(self._o)
|
---|
4328 | if ret is None:raise treeError('xmlNewDocFragment() failed')
|
---|
4329 | __tmp = xmlNode(_obj=ret)
|
---|
4330 | return __tmp
|
---|
4331 |
|
---|
4332 | def newDocNode(self, ns, name, content):
|
---|
4333 | """Creation of a new node element within a document. @ns and
|
---|
4334 | @content are optional (None). NOTE: @content is supposed to
|
---|
4335 | be a piece of XML CDATA, so it allow entities references,
|
---|
4336 | but XML special chars need to be escaped first by using
|
---|
4337 | xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
|
---|
4338 | don't need entities support. """
|
---|
4339 | if ns is None: ns__o = None
|
---|
4340 | else: ns__o = ns._o
|
---|
4341 | ret = libxml2mod.xmlNewDocNode(self._o, ns__o, name, content)
|
---|
4342 | if ret is None:raise treeError('xmlNewDocNode() failed')
|
---|
4343 | __tmp = xmlNode(_obj=ret)
|
---|
4344 | return __tmp
|
---|
4345 |
|
---|
4346 | def newDocNodeEatName(self, ns, name, content):
|
---|
4347 | """Creation of a new node element within a document. @ns and
|
---|
4348 | @content are optional (None). NOTE: @content is supposed to
|
---|
4349 | be a piece of XML CDATA, so it allow entities references,
|
---|
4350 | but XML special chars need to be escaped first by using
|
---|
4351 | xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
|
---|
4352 | don't need entities support. """
|
---|
4353 | if ns is None: ns__o = None
|
---|
4354 | else: ns__o = ns._o
|
---|
4355 | ret = libxml2mod.xmlNewDocNodeEatName(self._o, ns__o, name, content)
|
---|
4356 | if ret is None:raise treeError('xmlNewDocNodeEatName() failed')
|
---|
4357 | __tmp = xmlNode(_obj=ret)
|
---|
4358 | return __tmp
|
---|
4359 |
|
---|
4360 | def newDocPI(self, name, content):
|
---|
4361 | """Creation of a processing instruction element. """
|
---|
4362 | ret = libxml2mod.xmlNewDocPI(self._o, name, content)
|
---|
4363 | if ret is None:raise treeError('xmlNewDocPI() failed')
|
---|
4364 | __tmp = xmlNode(_obj=ret)
|
---|
4365 | return __tmp
|
---|
4366 |
|
---|
4367 | def newDocProp(self, name, value):
|
---|
4368 | """Create a new property carried by a document. """
|
---|
4369 | ret = libxml2mod.xmlNewDocProp(self._o, name, value)
|
---|
4370 | if ret is None:raise treeError('xmlNewDocProp() failed')
|
---|
4371 | __tmp = xmlAttr(_obj=ret)
|
---|
4372 | return __tmp
|
---|
4373 |
|
---|
4374 | def newDocRawNode(self, ns, name, content):
|
---|
4375 | """Creation of a new node element within a document. @ns and
|
---|
4376 | @content are optional (None). """
|
---|
4377 | if ns is None: ns__o = None
|
---|
4378 | else: ns__o = ns._o
|
---|
4379 | ret = libxml2mod.xmlNewDocRawNode(self._o, ns__o, name, content)
|
---|
4380 | if ret is None:raise treeError('xmlNewDocRawNode() failed')
|
---|
4381 | __tmp = xmlNode(_obj=ret)
|
---|
4382 | return __tmp
|
---|
4383 |
|
---|
4384 | def newDocText(self, content):
|
---|
4385 | """Creation of a new text node within a document. """
|
---|
4386 | ret = libxml2mod.xmlNewDocText(self._o, content)
|
---|
4387 | if ret is None:raise treeError('xmlNewDocText() failed')
|
---|
4388 | __tmp = xmlNode(_obj=ret)
|
---|
4389 | return __tmp
|
---|
4390 |
|
---|
4391 | def newDocTextLen(self, content, len):
|
---|
4392 | """Creation of a new text node with an extra content length
|
---|
4393 | parameter. The text node pertain to a given document. """
|
---|
4394 | ret = libxml2mod.xmlNewDocTextLen(self._o, content, len)
|
---|
4395 | if ret is None:raise treeError('xmlNewDocTextLen() failed')
|
---|
4396 | __tmp = xmlNode(_obj=ret)
|
---|
4397 | return __tmp
|
---|
4398 |
|
---|
4399 | def newDtd(self, name, ExternalID, SystemID):
|
---|
4400 | """Creation of a new DTD for the external subset. To create an
|
---|
4401 | internal subset, use xmlCreateIntSubset(). """
|
---|
4402 | ret = libxml2mod.xmlNewDtd(self._o, name, ExternalID, SystemID)
|
---|
4403 | if ret is None:raise treeError('xmlNewDtd() failed')
|
---|
4404 | __tmp = xmlDtd(_obj=ret)
|
---|
4405 | return __tmp
|
---|
4406 |
|
---|
4407 | def newGlobalNs(self, href, prefix):
|
---|
4408 | """Creation of a Namespace, the old way using PI and without
|
---|
4409 | scoping DEPRECATED !!! """
|
---|
4410 | ret = libxml2mod.xmlNewGlobalNs(self._o, href, prefix)
|
---|
4411 | if ret is None:raise treeError('xmlNewGlobalNs() failed')
|
---|
4412 | __tmp = xmlNs(_obj=ret)
|
---|
4413 | return __tmp
|
---|
4414 |
|
---|
4415 | def newReference(self, name):
|
---|
4416 | """Creation of a new reference node. """
|
---|
4417 | ret = libxml2mod.xmlNewReference(self._o, name)
|
---|
4418 | if ret is None:raise treeError('xmlNewReference() failed')
|
---|
4419 | __tmp = xmlNode(_obj=ret)
|
---|
4420 | return __tmp
|
---|
4421 |
|
---|
4422 | def nodeDumpOutput(self, buf, cur, level, format, encoding):
|
---|
4423 | """Dump an XML node, recursive behaviour, children are printed
|
---|
4424 | too. Note that @format = 1 provide node indenting only if
|
---|
4425 | xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was
|
---|
4426 | called """
|
---|
4427 | if buf is None: buf__o = None
|
---|
4428 | else: buf__o = buf._o
|
---|
4429 | if cur is None: cur__o = None
|
---|
4430 | else: cur__o = cur._o
|
---|
4431 | libxml2mod.xmlNodeDumpOutput(buf__o, self._o, cur__o, level, format, encoding)
|
---|
4432 |
|
---|
4433 | def nodeGetBase(self, cur):
|
---|
4434 | """Searches for the BASE URL. The code should work on both XML
|
---|
4435 | and HTML document even if base mechanisms are completely
|
---|
4436 | different. It returns the base as defined in RFC 2396
|
---|
4437 | sections 5.1.1. Base URI within Document Content and 5.1.2.
|
---|
4438 | Base URI from the Encapsulating Entity However it does not
|
---|
4439 | return the document base (5.1.3), use doc->URL in this case """
|
---|
4440 | if cur is None: cur__o = None
|
---|
4441 | else: cur__o = cur._o
|
---|
4442 | ret = libxml2mod.xmlNodeGetBase(self._o, cur__o)
|
---|
4443 | return ret
|
---|
4444 |
|
---|
4445 | def nodeListGetRawString(self, list, inLine):
|
---|
4446 | """Builds the string equivalent to the text contained in the
|
---|
4447 | Node list made of TEXTs and ENTITY_REFs, contrary to
|
---|
4448 | xmlNodeListGetString() this function doesn't do any
|
---|
4449 | character encoding handling. """
|
---|
4450 | if list is None: list__o = None
|
---|
4451 | else: list__o = list._o
|
---|
4452 | ret = libxml2mod.xmlNodeListGetRawString(self._o, list__o, inLine)
|
---|
4453 | return ret
|
---|
4454 |
|
---|
4455 | def nodeListGetString(self, list, inLine):
|
---|
4456 | """Build the string equivalent to the text contained in the
|
---|
4457 | Node list made of TEXTs and ENTITY_REFs """
|
---|
4458 | if list is None: list__o = None
|
---|
4459 | else: list__o = list._o
|
---|
4460 | ret = libxml2mod.xmlNodeListGetString(self._o, list__o, inLine)
|
---|
4461 | return ret
|
---|
4462 |
|
---|
4463 | def reconciliateNs(self, tree):
|
---|
4464 | """This function checks that all the namespaces declared
|
---|
4465 | within the given tree are properly declared. This is needed
|
---|
4466 | for example after Copy or Cut and then paste operations.
|
---|
4467 | The subtree may still hold pointers to namespace
|
---|
4468 | declarations outside the subtree or invalid/masked. As much
|
---|
4469 | as possible the function try to reuse the existing
|
---|
4470 | namespaces found in the new environment. If not possible
|
---|
4471 | the new namespaces are redeclared on @tree at the top of
|
---|
4472 | the given subtree. """
|
---|
4473 | if tree is None: tree__o = None
|
---|
4474 | else: tree__o = tree._o
|
---|
4475 | ret = libxml2mod.xmlReconciliateNs(self._o, tree__o)
|
---|
4476 | return ret
|
---|
4477 |
|
---|
4478 | def saveFile(self, filename):
|
---|
4479 | """Dump an XML document to a file. Will use compression if
|
---|
4480 | compiled in and enabled. If @filename is "-" the stdout
|
---|
4481 | file is used. """
|
---|
4482 | ret = libxml2mod.xmlSaveFile(filename, self._o)
|
---|
4483 | return ret
|
---|
4484 |
|
---|
4485 | def saveFileEnc(self, filename, encoding):
|
---|
4486 | """Dump an XML document, converting it to the given encoding """
|
---|
4487 | ret = libxml2mod.xmlSaveFileEnc(filename, self._o, encoding)
|
---|
4488 | return ret
|
---|
4489 |
|
---|
4490 | def saveFileTo(self, buf, encoding):
|
---|
4491 | """Dump an XML document to an I/O buffer. Warning ! This call
|
---|
4492 | xmlOutputBufferClose() on buf which is not available after
|
---|
4493 | this call. """
|
---|
4494 | if buf is None: buf__o = None
|
---|
4495 | else: buf__o = buf._o
|
---|
4496 | ret = libxml2mod.xmlSaveFileTo(buf__o, self._o, encoding)
|
---|
4497 | return ret
|
---|
4498 |
|
---|
4499 | def saveFormatFile(self, filename, format):
|
---|
4500 | """Dump an XML document to a file. Will use compression if
|
---|
4501 | compiled in and enabled. If @filename is "-" the stdout
|
---|
4502 | file is used. If @format is set then the document will be
|
---|
4503 | indented on output. Note that @format = 1 provide node
|
---|
4504 | indenting only if xmlIndentTreeOutput = 1 or
|
---|
4505 | xmlKeepBlanksDefault(0) was called """
|
---|
4506 | ret = libxml2mod.xmlSaveFormatFile(filename, self._o, format)
|
---|
4507 | return ret
|
---|
4508 |
|
---|
4509 | def saveFormatFileEnc(self, filename, encoding, format):
|
---|
4510 | """Dump an XML document to a file or an URL. """
|
---|
4511 | ret = libxml2mod.xmlSaveFormatFileEnc(filename, self._o, encoding, format)
|
---|
4512 | return ret
|
---|
4513 |
|
---|
4514 | def saveFormatFileTo(self, buf, encoding, format):
|
---|
4515 | """Dump an XML document to an I/O buffer. Warning ! This call
|
---|
4516 | xmlOutputBufferClose() on buf which is not available after
|
---|
4517 | this call. """
|
---|
4518 | if buf is None: buf__o = None
|
---|
4519 | else: buf__o = buf._o
|
---|
4520 | ret = libxml2mod.xmlSaveFormatFileTo(buf__o, self._o, encoding, format)
|
---|
4521 | return ret
|
---|
4522 |
|
---|
4523 | def searchNs(self, node, nameSpace):
|
---|
4524 | """Search a Ns registered under a given name space for a
|
---|
4525 | document. recurse on the parents until it finds the defined
|
---|
4526 | namespace or return None otherwise. @nameSpace can be None,
|
---|
4527 | this is a search for the default namespace. We don't allow
|
---|
4528 | to cross entities boundaries. If you don't declare the
|
---|
4529 | namespace within those you will be in troubles !!! A
|
---|
4530 | warning is generated to cover this case. """
|
---|
4531 | if node is None: node__o = None
|
---|
4532 | else: node__o = node._o
|
---|
4533 | ret = libxml2mod.xmlSearchNs(self._o, node__o, nameSpace)
|
---|
4534 | if ret is None:raise treeError('xmlSearchNs() failed')
|
---|
4535 | __tmp = xmlNs(_obj=ret)
|
---|
4536 | return __tmp
|
---|
4537 |
|
---|
4538 | def searchNsByHref(self, node, href):
|
---|
4539 | """Search a Ns aliasing a given URI. Recurse on the parents
|
---|
4540 | until it finds the defined namespace or return None
|
---|
4541 | otherwise. """
|
---|
4542 | if node is None: node__o = None
|
---|
4543 | else: node__o = node._o
|
---|
4544 | ret = libxml2mod.xmlSearchNsByHref(self._o, node__o, href)
|
---|
4545 | if ret is None:raise treeError('xmlSearchNsByHref() failed')
|
---|
4546 | __tmp = xmlNs(_obj=ret)
|
---|
4547 | return __tmp
|
---|
4548 |
|
---|
4549 | def setDocCompressMode(self, mode):
|
---|
4550 | """set the compression ratio for a document, ZLIB based
|
---|
4551 | Correct values: 0 (uncompressed) to 9 (max compression) """
|
---|
4552 | libxml2mod.xmlSetDocCompressMode(self._o, mode)
|
---|
4553 |
|
---|
4554 | def setListDoc(self, list):
|
---|
4555 | """update all nodes in the list to point to the right document """
|
---|
4556 | if list is None: list__o = None
|
---|
4557 | else: list__o = list._o
|
---|
4558 | libxml2mod.xmlSetListDoc(list__o, self._o)
|
---|
4559 |
|
---|
4560 | def setRootElement(self, root):
|
---|
4561 | """Set the root element of the document (doc->children is a
|
---|
4562 | list containing possibly comments, PIs, etc ...). """
|
---|
4563 | if root is None: root__o = None
|
---|
4564 | else: root__o = root._o
|
---|
4565 | ret = libxml2mod.xmlDocSetRootElement(self._o, root__o)
|
---|
4566 | if ret is None:return None
|
---|
4567 | __tmp = xmlNode(_obj=ret)
|
---|
4568 | return __tmp
|
---|
4569 |
|
---|
4570 | def setTreeDoc(self, tree):
|
---|
4571 | """update all nodes under the tree to point to the right
|
---|
4572 | document """
|
---|
4573 | if tree is None: tree__o = None
|
---|
4574 | else: tree__o = tree._o
|
---|
4575 | libxml2mod.xmlSetTreeDoc(tree__o, self._o)
|
---|
4576 |
|
---|
4577 | def stringGetNodeList(self, value):
|
---|
4578 | """Parse the value string and build the node list associated.
|
---|
4579 | Should produce a flat tree with only TEXTs and ENTITY_REFs. """
|
---|
4580 | ret = libxml2mod.xmlStringGetNodeList(self._o, value)
|
---|
4581 | if ret is None:raise treeError('xmlStringGetNodeList() failed')
|
---|
4582 | __tmp = xmlNode(_obj=ret)
|
---|
4583 | return __tmp
|
---|
4584 |
|
---|
4585 | def stringLenGetNodeList(self, value, len):
|
---|
4586 | """Parse the value string and build the node list associated.
|
---|
4587 | Should produce a flat tree with only TEXTs and ENTITY_REFs. """
|
---|
4588 | ret = libxml2mod.xmlStringLenGetNodeList(self._o, value, len)
|
---|
4589 | if ret is None:raise treeError('xmlStringLenGetNodeList() failed')
|
---|
4590 | __tmp = xmlNode(_obj=ret)
|
---|
4591 | return __tmp
|
---|
4592 |
|
---|
4593 | #
|
---|
4594 | # xmlDoc functions from module valid
|
---|
4595 | #
|
---|
4596 |
|
---|
4597 | def ID(self, ID):
|
---|
4598 | """Search the attribute declaring the given ID """
|
---|
4599 | ret = libxml2mod.xmlGetID(self._o, ID)
|
---|
4600 | if ret is None:raise treeError('xmlGetID() failed')
|
---|
4601 | __tmp = xmlAttr(_obj=ret)
|
---|
4602 | return __tmp
|
---|
4603 |
|
---|
4604 | def isID(self, elem, attr):
|
---|
4605 | """Determine whether an attribute is of type ID. In case we
|
---|
4606 | have DTD(s) then this is done if DTD loading has been
|
---|
4607 | requested. In the case of HTML documents parsed with the
|
---|
4608 | HTML parser, then ID detection is done systematically. """
|
---|
4609 | if elem is None: elem__o = None
|
---|
4610 | else: elem__o = elem._o
|
---|
4611 | if attr is None: attr__o = None
|
---|
4612 | else: attr__o = attr._o
|
---|
4613 | ret = libxml2mod.xmlIsID(self._o, elem__o, attr__o)
|
---|
4614 | return ret
|
---|
4615 |
|
---|
4616 | def isMixedElement(self, name):
|
---|
4617 | """Search in the DtDs whether an element accept Mixed content
|
---|
4618 | (or ANY) basically if it is supposed to accept text childs """
|
---|
4619 | ret = libxml2mod.xmlIsMixedElement(self._o, name)
|
---|
4620 | return ret
|
---|
4621 |
|
---|
4622 | def isRef(self, elem, attr):
|
---|
4623 | """Determine whether an attribute is of type Ref. In case we
|
---|
4624 | have DTD(s) then this is simple, otherwise we use an
|
---|
4625 | heuristic: name Ref (upper or lowercase). """
|
---|
4626 | if elem is None: elem__o = None
|
---|
4627 | else: elem__o = elem._o
|
---|
4628 | if attr is None: attr__o = None
|
---|
4629 | else: attr__o = attr._o
|
---|
4630 | ret = libxml2mod.xmlIsRef(self._o, elem__o, attr__o)
|
---|
4631 | return ret
|
---|
4632 |
|
---|
4633 | def removeID(self, attr):
|
---|
4634 | """Remove the given attribute from the ID table maintained
|
---|
4635 | internally. """
|
---|
4636 | if attr is None: attr__o = None
|
---|
4637 | else: attr__o = attr._o
|
---|
4638 | ret = libxml2mod.xmlRemoveID(self._o, attr__o)
|
---|
4639 | return ret
|
---|
4640 |
|
---|
4641 | def removeRef(self, attr):
|
---|
4642 | """Remove the given attribute from the Ref table maintained
|
---|
4643 | internally. """
|
---|
4644 | if attr is None: attr__o = None
|
---|
4645 | else: attr__o = attr._o
|
---|
4646 | ret = libxml2mod.xmlRemoveRef(self._o, attr__o)
|
---|
4647 | return ret
|
---|
4648 |
|
---|
4649 | def validCtxtNormalizeAttributeValue(self, ctxt, elem, name, value):
|
---|
4650 | """Does the validation related extra step of the normalization
|
---|
4651 | of attribute values: If the declared value is not CDATA,
|
---|
4652 | then the XML processor must further process the normalized
|
---|
4653 | attribute value by discarding any leading and trailing
|
---|
4654 | space (#x20) characters, and by replacing sequences of
|
---|
4655 | space (#x20) characters by single space (#x20) character.
|
---|
4656 | Also check VC: Standalone Document Declaration in P32, and
|
---|
4657 | update ctxt->valid accordingly """
|
---|
4658 | if ctxt is None: ctxt__o = None
|
---|
4659 | else: ctxt__o = ctxt._o
|
---|
4660 | if elem is None: elem__o = None
|
---|
4661 | else: elem__o = elem._o
|
---|
4662 | ret = libxml2mod.xmlValidCtxtNormalizeAttributeValue(ctxt__o, self._o, elem__o, name, value)
|
---|
4663 | return ret
|
---|
4664 |
|
---|
4665 | def validNormalizeAttributeValue(self, elem, name, value):
|
---|
4666 | """Does the validation related extra step of the normalization
|
---|
4667 | of attribute values: If the declared value is not CDATA,
|
---|
4668 | then the XML processor must further process the normalized
|
---|
4669 | attribute value by discarding any leading and trailing
|
---|
4670 | space (#x20) characters, and by replacing sequences of
|
---|
4671 | space (#x20) characters by single space (#x20) character. """
|
---|
4672 | if elem is None: elem__o = None
|
---|
4673 | else: elem__o = elem._o
|
---|
4674 | ret = libxml2mod.xmlValidNormalizeAttributeValue(self._o, elem__o, name, value)
|
---|
4675 | return ret
|
---|
4676 |
|
---|
4677 | def validateDocument(self, ctxt):
|
---|
4678 | """Try to validate the document instance basically it does
|
---|
4679 | the all the checks described by the XML Rec i.e. validates
|
---|
4680 | the internal and external subset (if present) and validate
|
---|
4681 | the document tree. """
|
---|
4682 | if ctxt is None: ctxt__o = None
|
---|
4683 | else: ctxt__o = ctxt._o
|
---|
4684 | ret = libxml2mod.xmlValidateDocument(ctxt__o, self._o)
|
---|
4685 | return ret
|
---|
4686 |
|
---|
4687 | def validateDocumentFinal(self, ctxt):
|
---|
4688 | """Does the final step for the document validation once all
|
---|
4689 | the incremental validation steps have been completed
|
---|
4690 | basically it does the following checks described by the XML
|
---|
4691 | Rec Check all the IDREF/IDREFS attributes definition for
|
---|
4692 | validity """
|
---|
4693 | if ctxt is None: ctxt__o = None
|
---|
4694 | else: ctxt__o = ctxt._o
|
---|
4695 | ret = libxml2mod.xmlValidateDocumentFinal(ctxt__o, self._o)
|
---|
4696 | return ret
|
---|
4697 |
|
---|
4698 | def validateDtd(self, ctxt, dtd):
|
---|
4699 | """Try to validate the document against the dtd instance
|
---|
4700 | Basically it does check all the definitions in the DtD.
|
---|
4701 | Note the the internal subset (if present) is de-coupled
|
---|
4702 | (i.e. not used), which could give problems if ID or IDREF
|
---|
4703 | is present. """
|
---|
4704 | if ctxt is None: ctxt__o = None
|
---|
4705 | else: ctxt__o = ctxt._o
|
---|
4706 | if dtd is None: dtd__o = None
|
---|
4707 | else: dtd__o = dtd._o
|
---|
4708 | ret = libxml2mod.xmlValidateDtd(ctxt__o, self._o, dtd__o)
|
---|
4709 | return ret
|
---|
4710 |
|
---|
4711 | def validateDtdFinal(self, ctxt):
|
---|
4712 | """Does the final step for the dtds validation once all the
|
---|
4713 | subsets have been parsed basically it does the following
|
---|
4714 | checks described by the XML Rec - check that ENTITY and
|
---|
4715 | ENTITIES type attributes default or possible values matches
|
---|
4716 | one of the defined entities. - check that NOTATION type
|
---|
4717 | attributes default or possible values matches one of the
|
---|
4718 | defined notations. """
|
---|
4719 | if ctxt is None: ctxt__o = None
|
---|
4720 | else: ctxt__o = ctxt._o
|
---|
4721 | ret = libxml2mod.xmlValidateDtdFinal(ctxt__o, self._o)
|
---|
4722 | return ret
|
---|
4723 |
|
---|
4724 | def validateElement(self, ctxt, elem):
|
---|
4725 | """Try to validate the subtree under an element """
|
---|
4726 | if ctxt is None: ctxt__o = None
|
---|
4727 | else: ctxt__o = ctxt._o
|
---|
4728 | if elem is None: elem__o = None
|
---|
4729 | else: elem__o = elem._o
|
---|
4730 | ret = libxml2mod.xmlValidateElement(ctxt__o, self._o, elem__o)
|
---|
4731 | return ret
|
---|
4732 |
|
---|
4733 | def validateNotationUse(self, ctxt, notationName):
|
---|
4734 | """Validate that the given name match a notation declaration.
|
---|
4735 | - [ VC: Notation Declared ] """
|
---|
4736 | if ctxt is None: ctxt__o = None
|
---|
4737 | else: ctxt__o = ctxt._o
|
---|
4738 | ret = libxml2mod.xmlValidateNotationUse(ctxt__o, self._o, notationName)
|
---|
4739 | return ret
|
---|
4740 |
|
---|
4741 | def validateOneAttribute(self, ctxt, elem, attr, value):
|
---|
4742 | """Try to validate a single attribute for an element basically
|
---|
4743 | it does the following checks as described by the XML-1.0
|
---|
4744 | recommendation: - [ VC: Attribute Value Type ] - [ VC:
|
---|
4745 | Fixed Attribute Default ] - [ VC: Entity Name ] - [ VC:
|
---|
4746 | Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC: Entity
|
---|
4747 | Name ] - [ VC: Notation Attributes ] The ID/IDREF
|
---|
4748 | uniqueness and matching are done separately """
|
---|
4749 | if ctxt is None: ctxt__o = None
|
---|
4750 | else: ctxt__o = ctxt._o
|
---|
4751 | if elem is None: elem__o = None
|
---|
4752 | else: elem__o = elem._o
|
---|
4753 | if attr is None: attr__o = None
|
---|
4754 | else: attr__o = attr._o
|
---|
4755 | ret = libxml2mod.xmlValidateOneAttribute(ctxt__o, self._o, elem__o, attr__o, value)
|
---|
4756 | return ret
|
---|
4757 |
|
---|
4758 | def validateOneElement(self, ctxt, elem):
|
---|
4759 | """Try to validate a single element and it's attributes,
|
---|
4760 | basically it does the following checks as described by the
|
---|
4761 | XML-1.0 recommendation: - [ VC: Element Valid ] - [ VC:
|
---|
4762 | Required Attribute ] Then call xmlValidateOneAttribute()
|
---|
4763 | for each attribute present. The ID/IDREF checkings are
|
---|
4764 | done separately """
|
---|
4765 | if ctxt is None: ctxt__o = None
|
---|
4766 | else: ctxt__o = ctxt._o
|
---|
4767 | if elem is None: elem__o = None
|
---|
4768 | else: elem__o = elem._o
|
---|
4769 | ret = libxml2mod.xmlValidateOneElement(ctxt__o, self._o, elem__o)
|
---|
4770 | return ret
|
---|
4771 |
|
---|
4772 | def validateOneNamespace(self, ctxt, elem, prefix, ns, value):
|
---|
4773 | """Try to validate a single namespace declaration for an
|
---|
4774 | element basically it does the following checks as described
|
---|
4775 | by the XML-1.0 recommendation: - [ VC: Attribute Value Type
|
---|
4776 | ] - [ VC: Fixed Attribute Default ] - [ VC: Entity Name ] -
|
---|
4777 | [ VC: Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC:
|
---|
4778 | Entity Name ] - [ VC: Notation Attributes ] The ID/IDREF
|
---|
4779 | uniqueness and matching are done separately """
|
---|
4780 | if ctxt is None: ctxt__o = None
|
---|
4781 | else: ctxt__o = ctxt._o
|
---|
4782 | if elem is None: elem__o = None
|
---|
4783 | else: elem__o = elem._o
|
---|
4784 | if ns is None: ns__o = None
|
---|
4785 | else: ns__o = ns._o
|
---|
4786 | ret = libxml2mod.xmlValidateOneNamespace(ctxt__o, self._o, elem__o, prefix, ns__o, value)
|
---|
4787 | return ret
|
---|
4788 |
|
---|
4789 | def validatePopElement(self, ctxt, elem, qname):
|
---|
4790 | """Pop the element end from the validation stack. """
|
---|
4791 | if ctxt is None: ctxt__o = None
|
---|
4792 | else: ctxt__o = ctxt._o
|
---|
4793 | if elem is None: elem__o = None
|
---|
4794 | else: elem__o = elem._o
|
---|
4795 | ret = libxml2mod.xmlValidatePopElement(ctxt__o, self._o, elem__o, qname)
|
---|
4796 | return ret
|
---|
4797 |
|
---|
4798 | def validatePushElement(self, ctxt, elem, qname):
|
---|
4799 | """Push a new element start on the validation stack. """
|
---|
4800 | if ctxt is None: ctxt__o = None
|
---|
4801 | else: ctxt__o = ctxt._o
|
---|
4802 | if elem is None: elem__o = None
|
---|
4803 | else: elem__o = elem._o
|
---|
4804 | ret = libxml2mod.xmlValidatePushElement(ctxt__o, self._o, elem__o, qname)
|
---|
4805 | return ret
|
---|
4806 |
|
---|
4807 | def validateRoot(self, ctxt):
|
---|
4808 | """Try to validate a the root element basically it does the
|
---|
4809 | following check as described by the XML-1.0 recommendation:
|
---|
4810 | - [ VC: Root Element Type ] it doesn't try to recurse or
|
---|
4811 | apply other check to the element """
|
---|
4812 | if ctxt is None: ctxt__o = None
|
---|
4813 | else: ctxt__o = ctxt._o
|
---|
4814 | ret = libxml2mod.xmlValidateRoot(ctxt__o, self._o)
|
---|
4815 | return ret
|
---|
4816 |
|
---|
4817 | #
|
---|
4818 | # xmlDoc functions from module xinclude
|
---|
4819 | #
|
---|
4820 |
|
---|
4821 | def xincludeProcess(self):
|
---|
4822 | """Implement the XInclude substitution on the XML document @doc """
|
---|
4823 | ret = libxml2mod.xmlXIncludeProcess(self._o)
|
---|
4824 | return ret
|
---|
4825 |
|
---|
4826 | def xincludeProcessFlags(self, flags):
|
---|
4827 | """Implement the XInclude substitution on the XML document @doc """
|
---|
4828 | ret = libxml2mod.xmlXIncludeProcessFlags(self._o, flags)
|
---|
4829 | return ret
|
---|
4830 |
|
---|
4831 | #
|
---|
4832 | # xmlDoc functions from module xmlreader
|
---|
4833 | #
|
---|
4834 |
|
---|
4835 | def NewWalker(self, reader):
|
---|
4836 | """Setup an xmltextReader to parse a preparsed XML document.
|
---|
4837 | This reuses the existing @reader xmlTextReader. """
|
---|
4838 | if reader is None: reader__o = None
|
---|
4839 | else: reader__o = reader._o
|
---|
4840 | ret = libxml2mod.xmlReaderNewWalker(reader__o, self._o)
|
---|
4841 | return ret
|
---|
4842 |
|
---|
4843 | def readerWalker(self):
|
---|
4844 | """Create an xmltextReader for a preparsed document. """
|
---|
4845 | ret = libxml2mod.xmlReaderWalker(self._o)
|
---|
4846 | if ret is None:raise treeError('xmlReaderWalker() failed')
|
---|
4847 | __tmp = xmlTextReader(_obj=ret)
|
---|
4848 | return __tmp
|
---|
4849 |
|
---|
4850 | #
|
---|
4851 | # xmlDoc functions from module xmlschemas
|
---|
4852 | #
|
---|
4853 |
|
---|
4854 | def schemaNewDocParserCtxt(self):
|
---|
4855 | """Create an XML Schemas parse context for that document. NB.
|
---|
4856 | The document may be modified during the parsing process. """
|
---|
4857 | ret = libxml2mod.xmlSchemaNewDocParserCtxt(self._o)
|
---|
4858 | if ret is None:raise parserError('xmlSchemaNewDocParserCtxt() failed')
|
---|
4859 | __tmp = SchemaParserCtxt(_obj=ret)
|
---|
4860 | return __tmp
|
---|
4861 |
|
---|
4862 | def schemaValidateDoc(self, ctxt):
|
---|
4863 | """Validate a document tree in memory. """
|
---|
4864 | if ctxt is None: ctxt__o = None
|
---|
4865 | else: ctxt__o = ctxt._o
|
---|
4866 | ret = libxml2mod.xmlSchemaValidateDoc(ctxt__o, self._o)
|
---|
4867 | return ret
|
---|
4868 |
|
---|
4869 | #
|
---|
4870 | # xmlDoc functions from module xpath
|
---|
4871 | #
|
---|
4872 |
|
---|
4873 | def xpathNewContext(self):
|
---|
4874 | """Create a new xmlXPathContext """
|
---|
4875 | ret = libxml2mod.xmlXPathNewContext(self._o)
|
---|
4876 | if ret is None:raise xpathError('xmlXPathNewContext() failed')
|
---|
4877 | __tmp = xpathContext(_obj=ret)
|
---|
4878 | return __tmp
|
---|
4879 |
|
---|
4880 | def xpathOrderDocElems(self):
|
---|
4881 | """Call this routine to speed up XPath computation on static
|
---|
4882 | documents. This stamps all the element nodes with the
|
---|
4883 | document order Like for line information, the order is kept
|
---|
4884 | in the element->content field, the value stored is actually
|
---|
4885 | - the node number (starting at -1) to be able to
|
---|
4886 | differentiate from line numbers. """
|
---|
4887 | ret = libxml2mod.xmlXPathOrderDocElems(self._o)
|
---|
4888 | return ret
|
---|
4889 |
|
---|
4890 | #
|
---|
4891 | # xmlDoc functions from module xpointer
|
---|
4892 | #
|
---|
4893 |
|
---|
4894 | def xpointerNewContext(self, here, origin):
|
---|
4895 | """Create a new XPointer context """
|
---|
4896 | if here is None: here__o = None
|
---|
4897 | else: here__o = here._o
|
---|
4898 | if origin is None: origin__o = None
|
---|
4899 | else: origin__o = origin._o
|
---|
4900 | ret = libxml2mod.xmlXPtrNewContext(self._o, here__o, origin__o)
|
---|
4901 | if ret is None:raise treeError('xmlXPtrNewContext() failed')
|
---|
4902 | __tmp = xpathContext(_obj=ret)
|
---|
4903 | return __tmp
|
---|
4904 |
|
---|
4905 | class parserCtxt(parserCtxtCore):
|
---|
4906 | def __init__(self, _obj=None):
|
---|
4907 | self._o = _obj
|
---|
4908 | parserCtxtCore.__init__(self, _obj=_obj)
|
---|
4909 |
|
---|
4910 | def __del__(self):
|
---|
4911 | if self._o != None:
|
---|
4912 | libxml2mod.xmlFreeParserCtxt(self._o)
|
---|
4913 | self._o = None
|
---|
4914 |
|
---|
4915 | # accessors for parserCtxt
|
---|
4916 | def doc(self):
|
---|
4917 | """Get the document tree from a parser context. """
|
---|
4918 | ret = libxml2mod.xmlParserGetDoc(self._o)
|
---|
4919 | if ret is None:raise parserError('xmlParserGetDoc() failed')
|
---|
4920 | __tmp = xmlDoc(_obj=ret)
|
---|
4921 | return __tmp
|
---|
4922 |
|
---|
4923 | def isValid(self):
|
---|
4924 | """Get the validity information from a parser context. """
|
---|
4925 | ret = libxml2mod.xmlParserGetIsValid(self._o)
|
---|
4926 | return ret
|
---|
4927 |
|
---|
4928 | def lineNumbers(self, linenumbers):
|
---|
4929 | """Switch on the generation of line number for elements nodes. """
|
---|
4930 | libxml2mod.xmlParserSetLineNumbers(self._o, linenumbers)
|
---|
4931 |
|
---|
4932 | def loadSubset(self, loadsubset):
|
---|
4933 | """Switch the parser to load the DTD without validating. """
|
---|
4934 | libxml2mod.xmlParserSetLoadSubset(self._o, loadsubset)
|
---|
4935 |
|
---|
4936 | def pedantic(self, pedantic):
|
---|
4937 | """Switch the parser to be pedantic. """
|
---|
4938 | libxml2mod.xmlParserSetPedantic(self._o, pedantic)
|
---|
4939 |
|
---|
4940 | def replaceEntities(self, replaceEntities):
|
---|
4941 | """Switch the parser to replace entities. """
|
---|
4942 | libxml2mod.xmlParserSetReplaceEntities(self._o, replaceEntities)
|
---|
4943 |
|
---|
4944 | def validate(self, validate):
|
---|
4945 | """Switch the parser to validation mode. """
|
---|
4946 | libxml2mod.xmlParserSetValidate(self._o, validate)
|
---|
4947 |
|
---|
4948 | def wellFormed(self):
|
---|
4949 | """Get the well formed information from a parser context. """
|
---|
4950 | ret = libxml2mod.xmlParserGetWellFormed(self._o)
|
---|
4951 | return ret
|
---|
4952 |
|
---|
4953 | #
|
---|
4954 | # parserCtxt functions from module HTMLparser
|
---|
4955 | #
|
---|
4956 |
|
---|
4957 | def htmlCtxtReadDoc(self, cur, URL, encoding, options):
|
---|
4958 | """parse an XML in-memory document and build a tree. This
|
---|
4959 | reuses the existing @ctxt parser context """
|
---|
4960 | ret = libxml2mod.htmlCtxtReadDoc(self._o, cur, URL, encoding, options)
|
---|
4961 | if ret is None:raise treeError('htmlCtxtReadDoc() failed')
|
---|
4962 | __tmp = xmlDoc(_obj=ret)
|
---|
4963 | return __tmp
|
---|
4964 |
|
---|
4965 | def htmlCtxtReadFd(self, fd, URL, encoding, options):
|
---|
4966 | """parse an XML from a file descriptor and build a tree. This
|
---|
4967 | reuses the existing @ctxt parser context """
|
---|
4968 | ret = libxml2mod.htmlCtxtReadFd(self._o, fd, URL, encoding, options)
|
---|
4969 | if ret is None:raise treeError('htmlCtxtReadFd() failed')
|
---|
4970 | __tmp = xmlDoc(_obj=ret)
|
---|
4971 | return __tmp
|
---|
4972 |
|
---|
4973 | def htmlCtxtReadFile(self, filename, encoding, options):
|
---|
4974 | """parse an XML file from the filesystem or the network. This
|
---|
4975 | reuses the existing @ctxt parser context """
|
---|
4976 | ret = libxml2mod.htmlCtxtReadFile(self._o, filename, encoding, options)
|
---|
4977 | if ret is None:raise treeError('htmlCtxtReadFile() failed')
|
---|
4978 | __tmp = xmlDoc(_obj=ret)
|
---|
4979 | return __tmp
|
---|
4980 |
|
---|
4981 | def htmlCtxtReadMemory(self, buffer, size, URL, encoding, options):
|
---|
4982 | """parse an XML in-memory document and build a tree. This
|
---|
4983 | reuses the existing @ctxt parser context """
|
---|
4984 | ret = libxml2mod.htmlCtxtReadMemory(self._o, buffer, size, URL, encoding, options)
|
---|
4985 | if ret is None:raise treeError('htmlCtxtReadMemory() failed')
|
---|
4986 | __tmp = xmlDoc(_obj=ret)
|
---|
4987 | return __tmp
|
---|
4988 |
|
---|
4989 | def htmlCtxtReset(self):
|
---|
4990 | """Reset a parser context """
|
---|
4991 | libxml2mod.htmlCtxtReset(self._o)
|
---|
4992 |
|
---|
4993 | def htmlCtxtUseOptions(self, options):
|
---|
4994 | """Applies the options to the parser context """
|
---|
4995 | ret = libxml2mod.htmlCtxtUseOptions(self._o, options)
|
---|
4996 | return ret
|
---|
4997 |
|
---|
4998 | def htmlFreeParserCtxt(self):
|
---|
4999 | """Free all the memory used by a parser context. However the
|
---|
5000 | parsed document in ctxt->myDoc is not freed. """
|
---|
5001 | libxml2mod.htmlFreeParserCtxt(self._o)
|
---|
5002 |
|
---|
5003 | def htmlParseCharRef(self):
|
---|
5004 | """parse Reference declarations [66] CharRef ::= '&#' [0-9]+
|
---|
5005 | ';' | '&#x' [0-9a-fA-F]+ ';' """
|
---|
5006 | ret = libxml2mod.htmlParseCharRef(self._o)
|
---|
5007 | return ret
|
---|
5008 |
|
---|
5009 | def htmlParseChunk(self, chunk, size, terminate):
|
---|
5010 | """Parse a Chunk of memory """
|
---|
5011 | ret = libxml2mod.htmlParseChunk(self._o, chunk, size, terminate)
|
---|
5012 | return ret
|
---|
5013 |
|
---|
5014 | def htmlParseDocument(self):
|
---|
5015 | """parse an HTML document (and build a tree if using the
|
---|
5016 | standard SAX interface). """
|
---|
5017 | ret = libxml2mod.htmlParseDocument(self._o)
|
---|
5018 | return ret
|
---|
5019 |
|
---|
5020 | def htmlParseElement(self):
|
---|
5021 | """parse an HTML element, this is highly recursive this is
|
---|
5022 | kept for compatibility with previous code versions [39]
|
---|
5023 | element ::= EmptyElemTag | STag content ETag [41]
|
---|
5024 | Attribute ::= Name Eq AttValue """
|
---|
5025 | libxml2mod.htmlParseElement(self._o)
|
---|
5026 |
|
---|
5027 | #
|
---|
5028 | # parserCtxt functions from module parser
|
---|
5029 | #
|
---|
5030 |
|
---|
5031 | def byteConsumed(self):
|
---|
5032 | """This function provides the current index of the parser
|
---|
5033 | relative to the start of the current entity. This function
|
---|
5034 | is computed in bytes from the beginning starting at zero
|
---|
5035 | and finishing at the size in byte of the file if parsing a
|
---|
5036 | file. The function is of constant cost if the input is
|
---|
5037 | UTF-8 but can be costly if run on non-UTF-8 input. """
|
---|
5038 | ret = libxml2mod.xmlByteConsumed(self._o)
|
---|
5039 | return ret
|
---|
5040 |
|
---|
5041 | def clearParserCtxt(self):
|
---|
5042 | """Clear (release owned resources) and reinitialize a parser
|
---|
5043 | context """
|
---|
5044 | libxml2mod.xmlClearParserCtxt(self._o)
|
---|
5045 |
|
---|
5046 | def ctxtReadDoc(self, cur, URL, encoding, options):
|
---|
5047 | """parse an XML in-memory document and build a tree. This
|
---|
5048 | reuses the existing @ctxt parser context """
|
---|
5049 | ret = libxml2mod.xmlCtxtReadDoc(self._o, cur, URL, encoding, options)
|
---|
5050 | if ret is None:raise treeError('xmlCtxtReadDoc() failed')
|
---|
5051 | __tmp = xmlDoc(_obj=ret)
|
---|
5052 | return __tmp
|
---|
5053 |
|
---|
5054 | def ctxtReadFd(self, fd, URL, encoding, options):
|
---|
5055 | """parse an XML from a file descriptor and build a tree. This
|
---|
5056 | reuses the existing @ctxt parser context NOTE that the file
|
---|
5057 | descriptor will not be closed when the reader is closed or
|
---|
5058 | reset. """
|
---|
5059 | ret = libxml2mod.xmlCtxtReadFd(self._o, fd, URL, encoding, options)
|
---|
5060 | if ret is None:raise treeError('xmlCtxtReadFd() failed')
|
---|
5061 | __tmp = xmlDoc(_obj=ret)
|
---|
5062 | return __tmp
|
---|
5063 |
|
---|
5064 | def ctxtReadFile(self, filename, encoding, options):
|
---|
5065 | """parse an XML file from the filesystem or the network. This
|
---|
5066 | reuses the existing @ctxt parser context """
|
---|
5067 | ret = libxml2mod.xmlCtxtReadFile(self._o, filename, encoding, options)
|
---|
5068 | if ret is None:raise treeError('xmlCtxtReadFile() failed')
|
---|
5069 | __tmp = xmlDoc(_obj=ret)
|
---|
5070 | return __tmp
|
---|
5071 |
|
---|
5072 | def ctxtReadMemory(self, buffer, size, URL, encoding, options):
|
---|
5073 | """parse an XML in-memory document and build a tree. This
|
---|
5074 | reuses the existing @ctxt parser context """
|
---|
5075 | ret = libxml2mod.xmlCtxtReadMemory(self._o, buffer, size, URL, encoding, options)
|
---|
5076 | if ret is None:raise treeError('xmlCtxtReadMemory() failed')
|
---|
5077 | __tmp = xmlDoc(_obj=ret)
|
---|
5078 | return __tmp
|
---|
5079 |
|
---|
5080 | def ctxtReset(self):
|
---|
5081 | """Reset a parser context """
|
---|
5082 | libxml2mod.xmlCtxtReset(self._o)
|
---|
5083 |
|
---|
5084 | def ctxtResetPush(self, chunk, size, filename, encoding):
|
---|
5085 | """Reset a push parser context """
|
---|
5086 | ret = libxml2mod.xmlCtxtResetPush(self._o, chunk, size, filename, encoding)
|
---|
5087 | return ret
|
---|
5088 |
|
---|
5089 | def ctxtUseOptions(self, options):
|
---|
5090 | """Applies the options to the parser context """
|
---|
5091 | ret = libxml2mod.xmlCtxtUseOptions(self._o, options)
|
---|
5092 | return ret
|
---|
5093 |
|
---|
5094 | def initParserCtxt(self):
|
---|
5095 | """Initialize a parser context """
|
---|
5096 | ret = libxml2mod.xmlInitParserCtxt(self._o)
|
---|
5097 | return ret
|
---|
5098 |
|
---|
5099 | def parseChunk(self, chunk, size, terminate):
|
---|
5100 | """Parse a Chunk of memory """
|
---|
5101 | ret = libxml2mod.xmlParseChunk(self._o, chunk, size, terminate)
|
---|
5102 | return ret
|
---|
5103 |
|
---|
5104 | def parseDocument(self):
|
---|
5105 | """parse an XML document (and build a tree if using the
|
---|
5106 | standard SAX interface). [1] document ::= prolog element
|
---|
5107 | Misc* [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? """
|
---|
5108 | ret = libxml2mod.xmlParseDocument(self._o)
|
---|
5109 | return ret
|
---|
5110 |
|
---|
5111 | def parseExtParsedEnt(self):
|
---|
5112 | """parse a general parsed entity An external general parsed
|
---|
5113 | entity is well-formed if it matches the production labeled
|
---|
5114 | extParsedEnt. [78] extParsedEnt ::= TextDecl? content """
|
---|
5115 | ret = libxml2mod.xmlParseExtParsedEnt(self._o)
|
---|
5116 | return ret
|
---|
5117 |
|
---|
5118 | def setupParserForBuffer(self, buffer, filename):
|
---|
5119 | """Setup the parser context to parse a new buffer; Clears any
|
---|
5120 | prior contents from the parser context. The buffer
|
---|
5121 | parameter must not be None, but the filename parameter can
|
---|
5122 | be """
|
---|
5123 | libxml2mod.xmlSetupParserForBuffer(self._o, buffer, filename)
|
---|
5124 |
|
---|
5125 | def stopParser(self):
|
---|
5126 | """Blocks further parser processing """
|
---|
5127 | libxml2mod.xmlStopParser(self._o)
|
---|
5128 |
|
---|
5129 | #
|
---|
5130 | # parserCtxt functions from module parserInternals
|
---|
5131 | #
|
---|
5132 |
|
---|
5133 | def decodeEntities(self, len, what, end, end2, end3):
|
---|
5134 | """This function is deprecated, we now always process entities
|
---|
5135 | content through xmlStringDecodeEntities TODO: remove it in
|
---|
5136 | next major release. [67] Reference ::= EntityRef | CharRef
|
---|
5137 | [69] PEReference ::= '%' Name ';' """
|
---|
5138 | ret = libxml2mod.xmlDecodeEntities(self._o, len, what, end, end2, end3)
|
---|
5139 | return ret
|
---|
5140 |
|
---|
5141 | def handleEntity(self, entity):
|
---|
5142 | """Default handling of defined entities, when should we define
|
---|
5143 | a new input stream ? When do we just handle that as a set
|
---|
5144 | of chars ? OBSOLETE: to be removed at some point. """
|
---|
5145 | if entity is None: entity__o = None
|
---|
5146 | else: entity__o = entity._o
|
---|
5147 | libxml2mod.xmlHandleEntity(self._o, entity__o)
|
---|
5148 |
|
---|
5149 | def namespaceParseNCName(self):
|
---|
5150 | """parse an XML namespace name. TODO: this seems not in use
|
---|
5151 | anymore, the namespace handling is done on top of the SAX
|
---|
5152 | interfaces, i.e. not on raw input. [NS 3] NCName ::=
|
---|
5153 | (Letter | '_') (NCNameChar)* [NS 4] NCNameChar ::= Letter
|
---|
5154 | | Digit | '.' | '-' | '_' | CombiningChar | Extender """
|
---|
5155 | ret = libxml2mod.xmlNamespaceParseNCName(self._o)
|
---|
5156 | return ret
|
---|
5157 |
|
---|
5158 | def namespaceParseNSDef(self):
|
---|
5159 | """parse a namespace prefix declaration TODO: this seems not
|
---|
5160 | in use anymore, the namespace handling is done on top of
|
---|
5161 | the SAX interfaces, i.e. not on raw input. [NS 1] NSDef
|
---|
5162 | ::= PrefixDef Eq SystemLiteral [NS 2] PrefixDef ::=
|
---|
5163 | 'xmlns' (':' NCName)? """
|
---|
5164 | ret = libxml2mod.xmlNamespaceParseNSDef(self._o)
|
---|
5165 | return ret
|
---|
5166 |
|
---|
5167 | def nextChar(self):
|
---|
5168 | """Skip to the next char input char. """
|
---|
5169 | libxml2mod.xmlNextChar(self._o)
|
---|
5170 |
|
---|
5171 | def parseAttValue(self):
|
---|
5172 | """parse a value for an attribute Note: the parser won't do
|
---|
5173 | substitution of entities here, this will be handled later
|
---|
5174 | in xmlStringGetNodeList [10] AttValue ::= '"' ([^<&"] |
|
---|
5175 | Reference)* '"' | "'" ([^<&'] | Reference)* "'" 3.3.3
|
---|
5176 | Attribute-Value Normalization: Before the value of an
|
---|
5177 | attribute is passed to the application or checked for
|
---|
5178 | validity, the XML processor must normalize it as follows: -
|
---|
5179 | a character reference is processed by appending the
|
---|
5180 | referenced character to the attribute value - an entity
|
---|
5181 | reference is processed by recursively processing the
|
---|
5182 | replacement text of the entity - a whitespace character
|
---|
5183 | (#x20, #xD, #xA, #x9) is processed by appending #x20 to the
|
---|
5184 | normalized value, except that only a single #x20 is
|
---|
5185 | appended for a "#xD#xA" sequence that is part of an
|
---|
5186 | external parsed entity or the literal entity value of an
|
---|
5187 | internal parsed entity - other characters are processed by
|
---|
5188 | appending them to the normalized value If the declared
|
---|
5189 | value is not CDATA, then the XML processor must further
|
---|
5190 | process the normalized attribute value by discarding any
|
---|
5191 | leading and trailing space (#x20) characters, and by
|
---|
5192 | replacing sequences of space (#x20) characters by a single
|
---|
5193 | space (#x20) character. All attributes for which no
|
---|
5194 | declaration has been read should be treated by a
|
---|
5195 | non-validating parser as if declared CDATA. """
|
---|
5196 | ret = libxml2mod.xmlParseAttValue(self._o)
|
---|
5197 | return ret
|
---|
5198 |
|
---|
5199 | def parseAttributeListDecl(self):
|
---|
5200 | """: parse the Attribute list def for an element [52]
|
---|
5201 | AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>' [53]
|
---|
5202 | AttDef ::= S Name S AttType S DefaultDecl """
|
---|
5203 | libxml2mod.xmlParseAttributeListDecl(self._o)
|
---|
5204 |
|
---|
5205 | def parseCDSect(self):
|
---|
5206 | """Parse escaped pure raw content. [18] CDSect ::= CDStart
|
---|
5207 | CData CDEnd [19] CDStart ::= '<![CDATA[' [20] Data ::=
|
---|
5208 | (Char* - (Char* ']]>' Char*)) [21] CDEnd ::= ']]>' """
|
---|
5209 | libxml2mod.xmlParseCDSect(self._o)
|
---|
5210 |
|
---|
5211 | def parseCharData(self, cdata):
|
---|
5212 | """parse a CharData section. if we are within a CDATA section
|
---|
5213 | ']]>' marks an end of section. The right angle bracket (>)
|
---|
5214 | may be represented using the string ">", and must, for
|
---|
5215 | compatibility, be escaped using ">" or a character
|
---|
5216 | reference when it appears in the string "]]>" in content,
|
---|
5217 | when that string is not marking the end of a CDATA section.
|
---|
5218 | [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) """
|
---|
5219 | libxml2mod.xmlParseCharData(self._o, cdata)
|
---|
5220 |
|
---|
5221 | def parseCharRef(self):
|
---|
5222 | """parse Reference declarations [66] CharRef ::= '&#' [0-9]+
|
---|
5223 | ';' | '&#x' [0-9a-fA-F]+ ';' [ WFC: Legal Character ]
|
---|
5224 | Characters referred to using character references must
|
---|
5225 | match the production for Char. """
|
---|
5226 | ret = libxml2mod.xmlParseCharRef(self._o)
|
---|
5227 | return ret
|
---|
5228 |
|
---|
5229 | def parseComment(self):
|
---|
5230 | """Skip an XML (SGML) comment <!-- .... --> The spec says that
|
---|
5231 | "For compatibility, the string "--" (double-hyphen) must
|
---|
5232 | not occur within comments. " [15] Comment ::= '<!--'
|
---|
5233 | ((Char - '-') | ('-' (Char - '-')))* '-->' """
|
---|
5234 | libxml2mod.xmlParseComment(self._o)
|
---|
5235 |
|
---|
5236 | def parseContent(self):
|
---|
5237 | """Parse a content: [43] content ::= (element | CharData |
|
---|
5238 | Reference | CDSect | PI | Comment)* """
|
---|
5239 | libxml2mod.xmlParseContent(self._o)
|
---|
5240 |
|
---|
5241 | def parseDocTypeDecl(self):
|
---|
5242 | """parse a DOCTYPE declaration [28] doctypedecl ::=
|
---|
5243 | '<!DOCTYPE' S Name (S ExternalID)? S? ('[' (markupdecl |
|
---|
5244 | PEReference | S)* ']' S?)? '>' [ VC: Root Element Type ]
|
---|
5245 | The Name in the document type declaration must match the
|
---|
5246 | element type of the root element. """
|
---|
5247 | libxml2mod.xmlParseDocTypeDecl(self._o)
|
---|
5248 |
|
---|
5249 | def parseElement(self):
|
---|
5250 | """parse an XML element, this is highly recursive [39]
|
---|
5251 | element ::= EmptyElemTag | STag content ETag [ WFC:
|
---|
5252 | Element Type Match ] The Name in an element's end-tag must
|
---|
5253 | match the element type in the start-tag. """
|
---|
5254 | libxml2mod.xmlParseElement(self._o)
|
---|
5255 |
|
---|
5256 | def parseElementDecl(self):
|
---|
5257 | """parse an Element declaration. [45] elementdecl ::=
|
---|
5258 | '<!ELEMENT' S Name S contentspec S? '>' [ VC: Unique
|
---|
5259 | Element Type Declaration ] No element type may be declared
|
---|
5260 | more than once """
|
---|
5261 | ret = libxml2mod.xmlParseElementDecl(self._o)
|
---|
5262 | return ret
|
---|
5263 |
|
---|
5264 | def parseEncName(self):
|
---|
5265 | """parse the XML encoding name [81] EncName ::= [A-Za-z]
|
---|
5266 | ([A-Za-z0-9._] | '-')* """
|
---|
5267 | ret = libxml2mod.xmlParseEncName(self._o)
|
---|
5268 | return ret
|
---|
5269 |
|
---|
5270 | def parseEncodingDecl(self):
|
---|
5271 | """parse the XML encoding declaration [80] EncodingDecl ::= S
|
---|
5272 | 'encoding' Eq ('"' EncName '"' | "'" EncName "'") this
|
---|
5273 | setups the conversion filters. """
|
---|
5274 | ret = libxml2mod.xmlParseEncodingDecl(self._o)
|
---|
5275 | return ret
|
---|
5276 |
|
---|
5277 | def parseEndTag(self):
|
---|
5278 | """parse an end of tag [42] ETag ::= '</' Name S? '>' With
|
---|
5279 | namespace [NS 9] ETag ::= '</' QName S? '>' """
|
---|
5280 | libxml2mod.xmlParseEndTag(self._o)
|
---|
5281 |
|
---|
5282 | def parseEntityDecl(self):
|
---|
5283 | """parse <!ENTITY declarations [70] EntityDecl ::= GEDecl |
|
---|
5284 | PEDecl [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S?
|
---|
5285 | '>' [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>'
|
---|
5286 | [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)
|
---|
5287 | [74] PEDef ::= EntityValue | ExternalID [76] NDataDecl ::=
|
---|
5288 | S 'NDATA' S Name [ VC: Notation Declared ] The Name must
|
---|
5289 | match the declared name of a notation. """
|
---|
5290 | libxml2mod.xmlParseEntityDecl(self._o)
|
---|
5291 |
|
---|
5292 | def parseEntityRef(self):
|
---|
5293 | """parse ENTITY references declarations [68] EntityRef ::=
|
---|
5294 | '&' Name ';' [ WFC: Entity Declared ] In a document
|
---|
5295 | without any DTD, a document with only an internal DTD
|
---|
5296 | subset which contains no parameter entity references, or a
|
---|
5297 | document with "standalone='yes'", the Name given in the
|
---|
5298 | entity reference must match that in an entity declaration,
|
---|
5299 | except that well-formed documents need not declare any of
|
---|
5300 | the following entities: amp, lt, gt, apos, quot. The
|
---|
5301 | declaration of a parameter entity must precede any
|
---|
5302 | reference to it. Similarly, the declaration of a general
|
---|
5303 | entity must precede any reference to it which appears in a
|
---|
5304 | default value in an attribute-list declaration. Note that
|
---|
5305 | if entities are declared in the external subset or in
|
---|
5306 | external parameter entities, a non-validating processor is
|
---|
5307 | not obligated to read and process their declarations; for
|
---|
5308 | such documents, the rule that an entity must be declared is
|
---|
5309 | a well-formedness constraint only if standalone='yes'. [
|
---|
5310 | WFC: Parsed Entity ] An entity reference must not contain
|
---|
5311 | the name of an unparsed entity """
|
---|
5312 | ret = libxml2mod.xmlParseEntityRef(self._o)
|
---|
5313 | if ret is None:raise parserError('xmlParseEntityRef() failed')
|
---|
5314 | __tmp = xmlEntity(_obj=ret)
|
---|
5315 | return __tmp
|
---|
5316 |
|
---|
5317 | def parseExternalSubset(self, ExternalID, SystemID):
|
---|
5318 | """parse Markup declarations from an external subset [30]
|
---|
5319 | extSubset ::= textDecl? extSubsetDecl [31] extSubsetDecl
|
---|
5320 | ::= (markupdecl | conditionalSect | PEReference | S) * """
|
---|
5321 | libxml2mod.xmlParseExternalSubset(self._o, ExternalID, SystemID)
|
---|
5322 |
|
---|
5323 | def parseMarkupDecl(self):
|
---|
5324 | """parse Markup declarations [29] markupdecl ::= elementdecl
|
---|
5325 | | AttlistDecl | EntityDecl | NotationDecl | PI | Comment [
|
---|
5326 | VC: Proper Declaration/PE Nesting ] Parameter-entity
|
---|
5327 | replacement text must be properly nested with markup
|
---|
5328 | declarations. That is to say, if either the first character
|
---|
5329 | or the last character of a markup declaration (markupdecl
|
---|
5330 | above) is contained in the replacement text for a
|
---|
5331 | parameter-entity reference, both must be contained in the
|
---|
5332 | same replacement text. [ WFC: PEs in Internal Subset ] In
|
---|
5333 | the internal DTD subset, parameter-entity references can
|
---|
5334 | occur only where markup declarations can occur, not within
|
---|
5335 | markup declarations. (This does not apply to references
|
---|
5336 | that occur in external parameter entities or to the
|
---|
5337 | external subset.) """
|
---|
5338 | libxml2mod.xmlParseMarkupDecl(self._o)
|
---|
5339 |
|
---|
5340 | def parseMisc(self):
|
---|
5341 | """parse an XML Misc* optional field. [27] Misc ::= Comment |
|
---|
5342 | PI | S """
|
---|
5343 | libxml2mod.xmlParseMisc(self._o)
|
---|
5344 |
|
---|
5345 | def parseName(self):
|
---|
5346 | """parse an XML name. [4] NameChar ::= Letter | Digit | '.' |
|
---|
5347 | '-' | '_' | ':' | CombiningChar | Extender [5] Name ::=
|
---|
5348 | (Letter | '_' | ':') (NameChar)* [6] Names ::= Name (#x20
|
---|
5349 | Name)* """
|
---|
5350 | ret = libxml2mod.xmlParseName(self._o)
|
---|
5351 | return ret
|
---|
5352 |
|
---|
5353 | def parseNamespace(self):
|
---|
5354 | """xmlParseNamespace: parse specific PI '<?namespace ...'
|
---|
5355 | constructs. This is what the older xml-name Working Draft
|
---|
5356 | specified, a bunch of other stuff may still rely on it, so
|
---|
5357 | support is still here as if it was declared on the root of
|
---|
5358 | the Tree:-( TODO: remove from library To be removed at
|
---|
5359 | next drop of binary compatibility """
|
---|
5360 | libxml2mod.xmlParseNamespace(self._o)
|
---|
5361 |
|
---|
5362 | def parseNmtoken(self):
|
---|
5363 | """parse an XML Nmtoken. [7] Nmtoken ::= (NameChar)+ [8]
|
---|
5364 | Nmtokens ::= Nmtoken (#x20 Nmtoken)* """
|
---|
5365 | ret = libxml2mod.xmlParseNmtoken(self._o)
|
---|
5366 | return ret
|
---|
5367 |
|
---|
5368 | def parseNotationDecl(self):
|
---|
5369 | """parse a notation declaration [82] NotationDecl ::=
|
---|
5370 | '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'
|
---|
5371 | Hence there is actually 3 choices: 'PUBLIC' S PubidLiteral
|
---|
5372 | 'PUBLIC' S PubidLiteral S SystemLiteral and 'SYSTEM' S
|
---|
5373 | SystemLiteral See the NOTE on xmlParseExternalID(). """
|
---|
5374 | libxml2mod.xmlParseNotationDecl(self._o)
|
---|
5375 |
|
---|
5376 | def parsePEReference(self):
|
---|
5377 | """parse PEReference declarations The entity content is
|
---|
5378 | handled directly by pushing it's content as a new input
|
---|
5379 | stream. [69] PEReference ::= '%' Name ';' [ WFC: No
|
---|
5380 | Recursion ] A parsed entity must not contain a recursive
|
---|
5381 | reference to itself, either directly or indirectly. [ WFC:
|
---|
5382 | Entity Declared ] In a document without any DTD, a document
|
---|
5383 | with only an internal DTD subset which contains no
|
---|
5384 | parameter entity references, or a document with
|
---|
5385 | "standalone='yes'", ... ... The declaration of a parameter
|
---|
5386 | entity must precede any reference to it... [ VC: Entity
|
---|
5387 | Declared ] In a document with an external subset or
|
---|
5388 | external parameter entities with "standalone='no'", ...
|
---|
5389 | ... The declaration of a parameter entity must precede any
|
---|
5390 | reference to it... [ WFC: In DTD ] Parameter-entity
|
---|
5391 | references may only appear in the DTD. NOTE: misleading but
|
---|
5392 | this is handled. """
|
---|
5393 | libxml2mod.xmlParsePEReference(self._o)
|
---|
5394 |
|
---|
5395 | def parsePI(self):
|
---|
5396 | """parse an XML Processing Instruction. [16] PI ::= '<?'
|
---|
5397 | PITarget (S (Char* - (Char* '?>' Char*)))? '?>' The
|
---|
5398 | processing is transfered to SAX once parsed. """
|
---|
5399 | libxml2mod.xmlParsePI(self._o)
|
---|
5400 |
|
---|
5401 | def parsePITarget(self):
|
---|
5402 | """parse the name of a PI [17] PITarget ::= Name - (('X' |
|
---|
5403 | 'x') ('M' | 'm') ('L' | 'l')) """
|
---|
5404 | ret = libxml2mod.xmlParsePITarget(self._o)
|
---|
5405 | return ret
|
---|
5406 |
|
---|
5407 | def parsePubidLiteral(self):
|
---|
5408 | """parse an XML public literal [12] PubidLiteral ::= '"'
|
---|
5409 | PubidChar* '"' | "'" (PubidChar - "'")* "'" """
|
---|
5410 | ret = libxml2mod.xmlParsePubidLiteral(self._o)
|
---|
5411 | return ret
|
---|
5412 |
|
---|
5413 | def parseQuotedString(self):
|
---|
5414 | """Parse and return a string between quotes or doublequotes
|
---|
5415 | TODO: Deprecated, to be removed at next drop of binary
|
---|
5416 | compatibility """
|
---|
5417 | ret = libxml2mod.xmlParseQuotedString(self._o)
|
---|
5418 | return ret
|
---|
5419 |
|
---|
5420 | def parseReference(self):
|
---|
5421 | """parse and handle entity references in content, depending on
|
---|
5422 | the SAX interface, this may end-up in a call to character()
|
---|
5423 | if this is a CharRef, a predefined entity, if there is no
|
---|
5424 | reference() callback. or if the parser was asked to switch
|
---|
5425 | to that mode. [67] Reference ::= EntityRef | CharRef """
|
---|
5426 | libxml2mod.xmlParseReference(self._o)
|
---|
5427 |
|
---|
5428 | def parseSDDecl(self):
|
---|
5429 | """parse the XML standalone declaration [32] SDDecl ::= S
|
---|
5430 | 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' |
|
---|
5431 | 'no')'"')) [ VC: Standalone Document Declaration ] TODO
|
---|
5432 | The standalone document declaration must have the value
|
---|
5433 | "no" if any external markup declarations contain
|
---|
5434 | declarations of: - attributes with default values, if
|
---|
5435 | elements to which these attributes apply appear in the
|
---|
5436 | document without specifications of values for these
|
---|
5437 | attributes, or - entities (other than amp, lt, gt, apos,
|
---|
5438 | quot), if references to those entities appear in the
|
---|
5439 | document, or - attributes with values subject to
|
---|
5440 | normalization, where the attribute appears in the document
|
---|
5441 | with a value which will change as a result of
|
---|
5442 | normalization, or - element types with element content, if
|
---|
5443 | white space occurs directly within any instance of those
|
---|
5444 | types. """
|
---|
5445 | ret = libxml2mod.xmlParseSDDecl(self._o)
|
---|
5446 | return ret
|
---|
5447 |
|
---|
5448 | def parseStartTag(self):
|
---|
5449 | """parse a start of tag either for rule element or
|
---|
5450 | EmptyElement. In both case we don't parse the tag closing
|
---|
5451 | chars. [40] STag ::= '<' Name (S Attribute)* S? '>' [
|
---|
5452 | WFC: Unique Att Spec ] No attribute name may appear more
|
---|
5453 | than once in the same start-tag or empty-element tag. [44]
|
---|
5454 | EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' [ WFC:
|
---|
5455 | Unique Att Spec ] No attribute name may appear more than
|
---|
5456 | once in the same start-tag or empty-element tag. With
|
---|
5457 | namespace: [NS 8] STag ::= '<' QName (S Attribute)* S? '>'
|
---|
5458 | [NS 10] EmptyElement ::= '<' QName (S Attribute)* S? '/>' """
|
---|
5459 | ret = libxml2mod.xmlParseStartTag(self._o)
|
---|
5460 | return ret
|
---|
5461 |
|
---|
5462 | def parseSystemLiteral(self):
|
---|
5463 | """parse an XML Literal [11] SystemLiteral ::= ('"' [^"]*
|
---|
5464 | '"') | ("'" [^']* "'") """
|
---|
5465 | ret = libxml2mod.xmlParseSystemLiteral(self._o)
|
---|
5466 | return ret
|
---|
5467 |
|
---|
5468 | def parseTextDecl(self):
|
---|
5469 | """parse an XML declaration header for external entities [77]
|
---|
5470 | TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' """
|
---|
5471 | libxml2mod.xmlParseTextDecl(self._o)
|
---|
5472 |
|
---|
5473 | def parseVersionInfo(self):
|
---|
5474 | """parse the XML version. [24] VersionInfo ::= S 'version' Eq
|
---|
5475 | (' VersionNum ' | " VersionNum ") [25] Eq ::= S? '=' S? """
|
---|
5476 | ret = libxml2mod.xmlParseVersionInfo(self._o)
|
---|
5477 | return ret
|
---|
5478 |
|
---|
5479 | def parseVersionNum(self):
|
---|
5480 | """parse the XML version value. [26] VersionNum ::= '1.'
|
---|
5481 | [0-9]+ In practice allow [0-9].[0-9]+ at that level """
|
---|
5482 | ret = libxml2mod.xmlParseVersionNum(self._o)
|
---|
5483 | return ret
|
---|
5484 |
|
---|
5485 | def parseXMLDecl(self):
|
---|
5486 | """parse an XML declaration header [23] XMLDecl ::= '<?xml'
|
---|
5487 | VersionInfo EncodingDecl? SDDecl? S? '?>' """
|
---|
5488 | libxml2mod.xmlParseXMLDecl(self._o)
|
---|
5489 |
|
---|
5490 | def parserHandlePEReference(self):
|
---|
5491 | """[69] PEReference ::= '%' Name ';' [ WFC: No Recursion ] A
|
---|
5492 | parsed entity must not contain a recursive reference to
|
---|
5493 | itself, either directly or indirectly. [ WFC: Entity
|
---|
5494 | Declared ] In a document without any DTD, a document with
|
---|
5495 | only an internal DTD subset which contains no parameter
|
---|
5496 | entity references, or a document with "standalone='yes'",
|
---|
5497 | ... ... The declaration of a parameter entity must precede
|
---|
5498 | any reference to it... [ VC: Entity Declared ] In a
|
---|
5499 | document with an external subset or external parameter
|
---|
5500 | entities with "standalone='no'", ... ... The declaration
|
---|
5501 | of a parameter entity must precede any reference to it...
|
---|
5502 | [ WFC: In DTD ] Parameter-entity references may only appear
|
---|
5503 | in the DTD. NOTE: misleading but this is handled. A
|
---|
5504 | PEReference may have been detected in the current input
|
---|
5505 | stream the handling is done accordingly to
|
---|
5506 | http://www.w3.org/TR/REC-xml#entproc i.e. - Included in
|
---|
5507 | literal in entity values - Included as Parameter Entity
|
---|
5508 | reference within DTDs """
|
---|
5509 | libxml2mod.xmlParserHandlePEReference(self._o)
|
---|
5510 |
|
---|
5511 | def parserHandleReference(self):
|
---|
5512 | """TODO: Remove, now deprecated ... the test is done directly
|
---|
5513 | in the content parsing routines. [67] Reference ::=
|
---|
5514 | EntityRef | CharRef [68] EntityRef ::= '&' Name ';' [
|
---|
5515 | WFC: Entity Declared ] the Name given in the entity
|
---|
5516 | reference must match that in an entity declaration, except
|
---|
5517 | that well-formed documents need not declare any of the
|
---|
5518 | following entities: amp, lt, gt, apos, quot. [ WFC: Parsed
|
---|
5519 | Entity ] An entity reference must not contain the name of
|
---|
5520 | an unparsed entity [66] CharRef ::= '&#' [0-9]+ ';' |
|
---|
5521 | '&#x' [0-9a-fA-F]+ ';' A PEReference may have been
|
---|
5522 | detected in the current input stream the handling is done
|
---|
5523 | accordingly to http://www.w3.org/TR/REC-xml#entproc """
|
---|
5524 | libxml2mod.xmlParserHandleReference(self._o)
|
---|
5525 |
|
---|
5526 | def popInput(self):
|
---|
5527 | """xmlPopInput: the current input pointed by ctxt->input came
|
---|
5528 | to an end pop it and return the next char. """
|
---|
5529 | ret = libxml2mod.xmlPopInput(self._o)
|
---|
5530 | return ret
|
---|
5531 |
|
---|
5532 | def scanName(self):
|
---|
5533 | """Trickery: parse an XML name but without consuming the input
|
---|
5534 | flow Needed for rollback cases. Used only when parsing
|
---|
5535 | entities references. TODO: seems deprecated now, only used
|
---|
5536 | in the default part of xmlParserHandleReference [4]
|
---|
5537 | NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' |
|
---|
5538 | CombiningChar | Extender [5] Name ::= (Letter | '_' | ':')
|
---|
5539 | (NameChar)* [6] Names ::= Name (S Name)* """
|
---|
5540 | ret = libxml2mod.xmlScanName(self._o)
|
---|
5541 | return ret
|
---|
5542 |
|
---|
5543 | def skipBlankChars(self):
|
---|
5544 | """skip all blanks character found at that point in the input
|
---|
5545 | streams. It pops up finished entities in the process if
|
---|
5546 | allowable at that point. """
|
---|
5547 | ret = libxml2mod.xmlSkipBlankChars(self._o)
|
---|
5548 | return ret
|
---|
5549 |
|
---|
5550 | def stringDecodeEntities(self, str, what, end, end2, end3):
|
---|
5551 | """Takes a entity string content and process to do the
|
---|
5552 | adequate substitutions. [67] Reference ::= EntityRef |
|
---|
5553 | CharRef [69] PEReference ::= '%' Name ';' """
|
---|
5554 | ret = libxml2mod.xmlStringDecodeEntities(self._o, str, what, end, end2, end3)
|
---|
5555 | return ret
|
---|
5556 |
|
---|
5557 | def stringLenDecodeEntities(self, str, len, what, end, end2, end3):
|
---|
5558 | """Takes a entity string content and process to do the
|
---|
5559 | adequate substitutions. [67] Reference ::= EntityRef |
|
---|
5560 | CharRef [69] PEReference ::= '%' Name ';' """
|
---|
5561 | ret = libxml2mod.xmlStringLenDecodeEntities(self._o, str, len, what, end, end2, end3)
|
---|
5562 | return ret
|
---|
5563 |
|
---|
5564 | class xmlAttr(xmlNode):
|
---|
5565 | def __init__(self, _obj=None):
|
---|
5566 | if checkWrapper(_obj) != 0: raise TypeError('xmlAttr got a wrong wrapper object type')
|
---|
5567 | self._o = _obj
|
---|
5568 | xmlNode.__init__(self, _obj=_obj)
|
---|
5569 |
|
---|
5570 | def __repr__(self):
|
---|
5571 | return "<xmlAttr (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
|
---|
5572 |
|
---|
5573 | #
|
---|
5574 | # xmlAttr functions from module debugXML
|
---|
5575 | #
|
---|
5576 |
|
---|
5577 | def debugDumpAttr(self, output, depth):
|
---|
5578 | """Dumps debug information for the attribute """
|
---|
5579 | libxml2mod.xmlDebugDumpAttr(output, self._o, depth)
|
---|
5580 |
|
---|
5581 | def debugDumpAttrList(self, output, depth):
|
---|
5582 | """Dumps debug information for the attribute list """
|
---|
5583 | libxml2mod.xmlDebugDumpAttrList(output, self._o, depth)
|
---|
5584 |
|
---|
5585 | #
|
---|
5586 | # xmlAttr functions from module tree
|
---|
5587 | #
|
---|
5588 |
|
---|
5589 | def copyProp(self, target):
|
---|
5590 | """Do a copy of the attribute. """
|
---|
5591 | if target is None: target__o = None
|
---|
5592 | else: target__o = target._o
|
---|
5593 | ret = libxml2mod.xmlCopyProp(target__o, self._o)
|
---|
5594 | if ret is None:raise treeError('xmlCopyProp() failed')
|
---|
5595 | __tmp = xmlAttr(_obj=ret)
|
---|
5596 | return __tmp
|
---|
5597 |
|
---|
5598 | def copyPropList(self, target):
|
---|
5599 | """Do a copy of an attribute list. """
|
---|
5600 | if target is None: target__o = None
|
---|
5601 | else: target__o = target._o
|
---|
5602 | ret = libxml2mod.xmlCopyPropList(target__o, self._o)
|
---|
5603 | if ret is None:raise treeError('xmlCopyPropList() failed')
|
---|
5604 | __tmp = xmlAttr(_obj=ret)
|
---|
5605 | return __tmp
|
---|
5606 |
|
---|
5607 | def freeProp(self):
|
---|
5608 | """Free one attribute, all the content is freed too """
|
---|
5609 | libxml2mod.xmlFreeProp(self._o)
|
---|
5610 |
|
---|
5611 | def freePropList(self):
|
---|
5612 | """Free a property and all its siblings, all the children are
|
---|
5613 | freed too. """
|
---|
5614 | libxml2mod.xmlFreePropList(self._o)
|
---|
5615 |
|
---|
5616 | def removeProp(self):
|
---|
5617 | """Unlink and free one attribute, all the content is freed too
|
---|
5618 | Note this doesn't work for namespace definition attributes """
|
---|
5619 | ret = libxml2mod.xmlRemoveProp(self._o)
|
---|
5620 | return ret
|
---|
5621 |
|
---|
5622 | #
|
---|
5623 | # xmlAttr functions from module valid
|
---|
5624 | #
|
---|
5625 |
|
---|
5626 | def removeID(self, doc):
|
---|
5627 | """Remove the given attribute from the ID table maintained
|
---|
5628 | internally. """
|
---|
5629 | if doc is None: doc__o = None
|
---|
5630 | else: doc__o = doc._o
|
---|
5631 | ret = libxml2mod.xmlRemoveID(doc__o, self._o)
|
---|
5632 | return ret
|
---|
5633 |
|
---|
5634 | def removeRef(self, doc):
|
---|
5635 | """Remove the given attribute from the Ref table maintained
|
---|
5636 | internally. """
|
---|
5637 | if doc is None: doc__o = None
|
---|
5638 | else: doc__o = doc._o
|
---|
5639 | ret = libxml2mod.xmlRemoveRef(doc__o, self._o)
|
---|
5640 | return ret
|
---|
5641 |
|
---|
5642 | class xmlAttribute(xmlNode):
|
---|
5643 | def __init__(self, _obj=None):
|
---|
5644 | if checkWrapper(_obj) != 0: raise TypeError('xmlAttribute got a wrong wrapper object type')
|
---|
5645 | self._o = _obj
|
---|
5646 | xmlNode.__init__(self, _obj=_obj)
|
---|
5647 |
|
---|
5648 | def __repr__(self):
|
---|
5649 | return "<xmlAttribute (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
|
---|
5650 |
|
---|
5651 | class catalog:
|
---|
5652 | def __init__(self, _obj=None):
|
---|
5653 | if _obj != None:self._o = _obj;return
|
---|
5654 | self._o = None
|
---|
5655 |
|
---|
5656 | def __del__(self):
|
---|
5657 | if self._o != None:
|
---|
5658 | libxml2mod.xmlFreeCatalog(self._o)
|
---|
5659 | self._o = None
|
---|
5660 |
|
---|
5661 | #
|
---|
5662 | # catalog functions from module catalog
|
---|
5663 | #
|
---|
5664 |
|
---|
5665 | def add(self, type, orig, replace):
|
---|
5666 | """Add an entry in the catalog, it may overwrite existing but
|
---|
5667 | different entries. """
|
---|
5668 | ret = libxml2mod.xmlACatalogAdd(self._o, type, orig, replace)
|
---|
5669 | return ret
|
---|
5670 |
|
---|
5671 | def catalogIsEmpty(self):
|
---|
5672 | """Check is a catalog is empty """
|
---|
5673 | ret = libxml2mod.xmlCatalogIsEmpty(self._o)
|
---|
5674 | return ret
|
---|
5675 |
|
---|
5676 | def convertSGMLCatalog(self):
|
---|
5677 | """Convert all the SGML catalog entries as XML ones """
|
---|
5678 | ret = libxml2mod.xmlConvertSGMLCatalog(self._o)
|
---|
5679 | return ret
|
---|
5680 |
|
---|
5681 | def dump(self, out):
|
---|
5682 | """Dump the given catalog to the given file. """
|
---|
5683 | libxml2mod.xmlACatalogDump(self._o, out)
|
---|
5684 |
|
---|
5685 | def remove(self, value):
|
---|
5686 | """Remove an entry from the catalog """
|
---|
5687 | ret = libxml2mod.xmlACatalogRemove(self._o, value)
|
---|
5688 | return ret
|
---|
5689 |
|
---|
5690 | def resolve(self, pubID, sysID):
|
---|
5691 | """Do a complete resolution lookup of an External Identifier """
|
---|
5692 | ret = libxml2mod.xmlACatalogResolve(self._o, pubID, sysID)
|
---|
5693 | return ret
|
---|
5694 |
|
---|
5695 | def resolvePublic(self, pubID):
|
---|
5696 | """Try to lookup the catalog local reference associated to a
|
---|
5697 | public ID in that catalog """
|
---|
5698 | ret = libxml2mod.xmlACatalogResolvePublic(self._o, pubID)
|
---|
5699 | return ret
|
---|
5700 |
|
---|
5701 | def resolveSystem(self, sysID):
|
---|
5702 | """Try to lookup the catalog resource for a system ID """
|
---|
5703 | ret = libxml2mod.xmlACatalogResolveSystem(self._o, sysID)
|
---|
5704 | return ret
|
---|
5705 |
|
---|
5706 | def resolveURI(self, URI):
|
---|
5707 | """Do a complete resolution lookup of an URI """
|
---|
5708 | ret = libxml2mod.xmlACatalogResolveURI(self._o, URI)
|
---|
5709 | return ret
|
---|
5710 |
|
---|
5711 | class xmlDtd(xmlNode):
|
---|
5712 | def __init__(self, _obj=None):
|
---|
5713 | if checkWrapper(_obj) != 0: raise TypeError('xmlDtd got a wrong wrapper object type')
|
---|
5714 | self._o = _obj
|
---|
5715 | xmlNode.__init__(self, _obj=_obj)
|
---|
5716 |
|
---|
5717 | def __repr__(self):
|
---|
5718 | return "<xmlDtd (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
|
---|
5719 |
|
---|
5720 | #
|
---|
5721 | # xmlDtd functions from module debugXML
|
---|
5722 | #
|
---|
5723 |
|
---|
5724 | def debugDumpDTD(self, output):
|
---|
5725 | """Dumps debug information for the DTD """
|
---|
5726 | libxml2mod.xmlDebugDumpDTD(output, self._o)
|
---|
5727 |
|
---|
5728 | #
|
---|
5729 | # xmlDtd functions from module tree
|
---|
5730 | #
|
---|
5731 |
|
---|
5732 | def copyDtd(self):
|
---|
5733 | """Do a copy of the dtd. """
|
---|
5734 | ret = libxml2mod.xmlCopyDtd(self._o)
|
---|
5735 | if ret is None:raise treeError('xmlCopyDtd() failed')
|
---|
5736 | __tmp = xmlDtd(_obj=ret)
|
---|
5737 | return __tmp
|
---|
5738 |
|
---|
5739 | def freeDtd(self):
|
---|
5740 | """Free a DTD structure. """
|
---|
5741 | libxml2mod.xmlFreeDtd(self._o)
|
---|
5742 |
|
---|
5743 | #
|
---|
5744 | # xmlDtd functions from module valid
|
---|
5745 | #
|
---|
5746 |
|
---|
5747 | def dtdAttrDesc(self, elem, name):
|
---|
5748 | """Search the DTD for the description of this attribute on
|
---|
5749 | this element. """
|
---|
5750 | ret = libxml2mod.xmlGetDtdAttrDesc(self._o, elem, name)
|
---|
5751 | if ret is None:raise treeError('xmlGetDtdAttrDesc() failed')
|
---|
5752 | __tmp = xmlAttribute(_obj=ret)
|
---|
5753 | return __tmp
|
---|
5754 |
|
---|
5755 | def dtdElementDesc(self, name):
|
---|
5756 | """Search the DTD for the description of this element """
|
---|
5757 | ret = libxml2mod.xmlGetDtdElementDesc(self._o, name)
|
---|
5758 | if ret is None:raise treeError('xmlGetDtdElementDesc() failed')
|
---|
5759 | __tmp = xmlElement(_obj=ret)
|
---|
5760 | return __tmp
|
---|
5761 |
|
---|
5762 | def dtdQAttrDesc(self, elem, name, prefix):
|
---|
5763 | """Search the DTD for the description of this qualified
|
---|
5764 | attribute on this element. """
|
---|
5765 | ret = libxml2mod.xmlGetDtdQAttrDesc(self._o, elem, name, prefix)
|
---|
5766 | if ret is None:raise treeError('xmlGetDtdQAttrDesc() failed')
|
---|
5767 | __tmp = xmlAttribute(_obj=ret)
|
---|
5768 | return __tmp
|
---|
5769 |
|
---|
5770 | def dtdQElementDesc(self, name, prefix):
|
---|
5771 | """Search the DTD for the description of this element """
|
---|
5772 | ret = libxml2mod.xmlGetDtdQElementDesc(self._o, name, prefix)
|
---|
5773 | if ret is None:raise treeError('xmlGetDtdQElementDesc() failed')
|
---|
5774 | __tmp = xmlElement(_obj=ret)
|
---|
5775 | return __tmp
|
---|
5776 |
|
---|
5777 | class xmlElement(xmlNode):
|
---|
5778 | def __init__(self, _obj=None):
|
---|
5779 | if checkWrapper(_obj) != 0: raise TypeError('xmlElement got a wrong wrapper object type')
|
---|
5780 | self._o = _obj
|
---|
5781 | xmlNode.__init__(self, _obj=_obj)
|
---|
5782 |
|
---|
5783 | def __repr__(self):
|
---|
5784 | return "<xmlElement (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
|
---|
5785 |
|
---|
5786 | class xmlEntity(xmlNode):
|
---|
5787 | def __init__(self, _obj=None):
|
---|
5788 | if checkWrapper(_obj) != 0: raise TypeError('xmlEntity got a wrong wrapper object type')
|
---|
5789 | self._o = _obj
|
---|
5790 | xmlNode.__init__(self, _obj=_obj)
|
---|
5791 |
|
---|
5792 | def __repr__(self):
|
---|
5793 | return "<xmlEntity (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
|
---|
5794 |
|
---|
5795 | #
|
---|
5796 | # xmlEntity functions from module parserInternals
|
---|
5797 | #
|
---|
5798 |
|
---|
5799 | def handleEntity(self, ctxt):
|
---|
5800 | """Default handling of defined entities, when should we define
|
---|
5801 | a new input stream ? When do we just handle that as a set
|
---|
5802 | of chars ? OBSOLETE: to be removed at some point. """
|
---|
5803 | if ctxt is None: ctxt__o = None
|
---|
5804 | else: ctxt__o = ctxt._o
|
---|
5805 | libxml2mod.xmlHandleEntity(ctxt__o, self._o)
|
---|
5806 |
|
---|
5807 | class Error:
|
---|
5808 | def __init__(self, _obj=None):
|
---|
5809 | if _obj != None:self._o = _obj;return
|
---|
5810 | self._o = None
|
---|
5811 |
|
---|
5812 | # accessors for Error
|
---|
5813 | def code(self):
|
---|
5814 | """The error code, e.g. an xmlParserError """
|
---|
5815 | ret = libxml2mod.xmlErrorGetCode(self._o)
|
---|
5816 | return ret
|
---|
5817 |
|
---|
5818 | def domain(self):
|
---|
5819 | """What part of the library raised this error """
|
---|
5820 | ret = libxml2mod.xmlErrorGetDomain(self._o)
|
---|
5821 | return ret
|
---|
5822 |
|
---|
5823 | def file(self):
|
---|
5824 | """the filename """
|
---|
5825 | ret = libxml2mod.xmlErrorGetFile(self._o)
|
---|
5826 | return ret
|
---|
5827 |
|
---|
5828 | def level(self):
|
---|
5829 | """how consequent is the error """
|
---|
5830 | ret = libxml2mod.xmlErrorGetLevel(self._o)
|
---|
5831 | return ret
|
---|
5832 |
|
---|
5833 | def line(self):
|
---|
5834 | """the line number if available """
|
---|
5835 | ret = libxml2mod.xmlErrorGetLine(self._o)
|
---|
5836 | return ret
|
---|
5837 |
|
---|
5838 | def message(self):
|
---|
5839 | """human-readable informative error message """
|
---|
5840 | ret = libxml2mod.xmlErrorGetMessage(self._o)
|
---|
5841 | return ret
|
---|
5842 |
|
---|
5843 | #
|
---|
5844 | # Error functions from module xmlerror
|
---|
5845 | #
|
---|
5846 |
|
---|
5847 | def copyError(self, to):
|
---|
5848 | """Save the original error to the new place. """
|
---|
5849 | if to is None: to__o = None
|
---|
5850 | else: to__o = to._o
|
---|
5851 | ret = libxml2mod.xmlCopyError(self._o, to__o)
|
---|
5852 | return ret
|
---|
5853 |
|
---|
5854 | def resetError(self):
|
---|
5855 | """Cleanup the error. """
|
---|
5856 | libxml2mod.xmlResetError(self._o)
|
---|
5857 |
|
---|
5858 | class xmlNs(xmlNode):
|
---|
5859 | def __init__(self, _obj=None):
|
---|
5860 | if checkWrapper(_obj) != 0: raise TypeError('xmlNs got a wrong wrapper object type')
|
---|
5861 | self._o = _obj
|
---|
5862 | xmlNode.__init__(self, _obj=_obj)
|
---|
5863 |
|
---|
5864 | def __repr__(self):
|
---|
5865 | return "<xmlNs (%s) object at 0x%x>" % (self.name, int(pos_id (self)))
|
---|
5866 |
|
---|
5867 | #
|
---|
5868 | # xmlNs functions from module tree
|
---|
5869 | #
|
---|
5870 |
|
---|
5871 | def copyNamespace(self):
|
---|
5872 | """Do a copy of the namespace. """
|
---|
5873 | ret = libxml2mod.xmlCopyNamespace(self._o)
|
---|
5874 | if ret is None:raise treeError('xmlCopyNamespace() failed')
|
---|
5875 | __tmp = xmlNs(_obj=ret)
|
---|
5876 | return __tmp
|
---|
5877 |
|
---|
5878 | def copyNamespaceList(self):
|
---|
5879 | """Do a copy of an namespace list. """
|
---|
5880 | ret = libxml2mod.xmlCopyNamespaceList(self._o)
|
---|
5881 | if ret is None:raise treeError('xmlCopyNamespaceList() failed')
|
---|
5882 | __tmp = xmlNs(_obj=ret)
|
---|
5883 | return __tmp
|
---|
5884 |
|
---|
5885 | def freeNs(self):
|
---|
5886 | """Free up the structures associated to a namespace """
|
---|
5887 | libxml2mod.xmlFreeNs(self._o)
|
---|
5888 |
|
---|
5889 | def freeNsList(self):
|
---|
5890 | """Free up all the structures associated to the chained
|
---|
5891 | namespaces. """
|
---|
5892 | libxml2mod.xmlFreeNsList(self._o)
|
---|
5893 |
|
---|
5894 | def newChild(self, parent, name, content):
|
---|
5895 | """Creation of a new child element, added at the end of
|
---|
5896 | @parent children list. @ns and @content parameters are
|
---|
5897 | optional (None). If @ns is None, the newly created element
|
---|
5898 | inherits the namespace of @parent. If @content is non None,
|
---|
5899 | a child list containing the TEXTs and ENTITY_REFs node will
|
---|
5900 | be created. NOTE: @content is supposed to be a piece of XML
|
---|
5901 | CDATA, so it allows entity references. XML special chars
|
---|
5902 | must be escaped first by using
|
---|
5903 | xmlEncodeEntitiesReentrant(), or xmlNewTextChild() should
|
---|
5904 | be used. """
|
---|
5905 | if parent is None: parent__o = None
|
---|
5906 | else: parent__o = parent._o
|
---|
5907 | ret = libxml2mod.xmlNewChild(parent__o, self._o, name, content)
|
---|
5908 | if ret is None:raise treeError('xmlNewChild() failed')
|
---|
5909 | __tmp = xmlNode(_obj=ret)
|
---|
5910 | return __tmp
|
---|
5911 |
|
---|
5912 | def newDocNode(self, doc, name, content):
|
---|
5913 | """Creation of a new node element within a document. @ns and
|
---|
5914 | @content are optional (None). NOTE: @content is supposed to
|
---|
5915 | be a piece of XML CDATA, so it allow entities references,
|
---|
5916 | but XML special chars need to be escaped first by using
|
---|
5917 | xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
|
---|
5918 | don't need entities support. """
|
---|
5919 | if doc is None: doc__o = None
|
---|
5920 | else: doc__o = doc._o
|
---|
5921 | ret = libxml2mod.xmlNewDocNode(doc__o, self._o, name, content)
|
---|
5922 | if ret is None:raise treeError('xmlNewDocNode() failed')
|
---|
5923 | __tmp = xmlNode(_obj=ret)
|
---|
5924 | return __tmp
|
---|
5925 |
|
---|
5926 | def newDocNodeEatName(self, doc, name, content):
|
---|
5927 | """Creation of a new node element within a document. @ns and
|
---|
5928 | @content are optional (None). NOTE: @content is supposed to
|
---|
5929 | be a piece of XML CDATA, so it allow entities references,
|
---|
5930 | but XML special chars need to be escaped first by using
|
---|
5931 | xmlEncodeEntitiesReentrant(). Use xmlNewDocRawNode() if you
|
---|
5932 | don't need entities support. """
|
---|
5933 | if doc is None: doc__o = None
|
---|
5934 | else: doc__o = doc._o
|
---|
5935 | ret = libxml2mod.xmlNewDocNodeEatName(doc__o, self._o, name, content)
|
---|
5936 | if ret is None:raise treeError('xmlNewDocNodeEatName() failed')
|
---|
5937 | __tmp = xmlNode(_obj=ret)
|
---|
5938 | return __tmp
|
---|
5939 |
|
---|
5940 | def newDocRawNode(self, doc, name, content):
|
---|
5941 | """Creation of a new node element within a document. @ns and
|
---|
5942 | @content are optional (None). """
|
---|
5943 | if doc is None: doc__o = None
|
---|
5944 | else: doc__o = doc._o
|
---|
5945 | ret = libxml2mod.xmlNewDocRawNode(doc__o, self._o, name, content)
|
---|
5946 | if ret is None:raise treeError('xmlNewDocRawNode() failed')
|
---|
5947 | __tmp = xmlNode(_obj=ret)
|
---|
5948 | return __tmp
|
---|
5949 |
|
---|
5950 | def newNodeEatName(self, name):
|
---|
5951 | """Creation of a new node element. @ns is optional (None). """
|
---|
5952 | ret = libxml2mod.xmlNewNodeEatName(self._o, name)
|
---|
5953 | if ret is None:raise treeError('xmlNewNodeEatName() failed')
|
---|
5954 | __tmp = xmlNode(_obj=ret)
|
---|
5955 | return __tmp
|
---|
5956 |
|
---|
5957 | def newNsProp(self, node, name, value):
|
---|
5958 | """Create a new property tagged with a namespace and carried
|
---|
5959 | by a node. """
|
---|
5960 | if node is None: node__o = None
|
---|
5961 | else: node__o = node._o
|
---|
5962 | ret = libxml2mod.xmlNewNsProp(node__o, self._o, name, value)
|
---|
5963 | if ret is None:raise treeError('xmlNewNsProp() failed')
|
---|
5964 | __tmp = xmlAttr(_obj=ret)
|
---|
5965 | return __tmp
|
---|
5966 |
|
---|
5967 | def newNsPropEatName(self, node, name, value):
|
---|
5968 | """Create a new property tagged with a namespace and carried
|
---|
5969 | by a node. """
|
---|
5970 | if node is None: node__o = None
|
---|
5971 | else: node__o = node._o
|
---|
5972 | ret = libxml2mod.xmlNewNsPropEatName(node__o, self._o, name, value)
|
---|
5973 | if ret is None:raise treeError('xmlNewNsPropEatName() failed')
|
---|
5974 | __tmp = xmlAttr(_obj=ret)
|
---|
5975 | return __tmp
|
---|
5976 |
|
---|
5977 | def newTextChild(self, parent, name, content):
|
---|
5978 | """Creation of a new child element, added at the end of
|
---|
5979 | @parent children list. @ns and @content parameters are
|
---|
5980 | optional (None). If @ns is None, the newly created element
|
---|
5981 | inherits the namespace of @parent. If @content is non None,
|
---|
5982 | a child TEXT node will be created containing the string
|
---|
5983 | @content. NOTE: Use xmlNewChild() if @content will contain
|
---|
5984 | entities that need to be preserved. Use this function,
|
---|
5985 | xmlNewTextChild(), if you need to ensure that reserved XML
|
---|
5986 | chars that might appear in @content, such as the ampersand,
|
---|
5987 | greater-than or less-than signs, are automatically replaced
|
---|
5988 | by their XML escaped entity representations. """
|
---|
5989 | if parent is None: parent__o = None
|
---|
5990 | else: parent__o = parent._o
|
---|
5991 | ret = libxml2mod.xmlNewTextChild(parent__o, self._o, name, content)
|
---|
5992 | if ret is None:raise treeError('xmlNewTextChild() failed')
|
---|
5993 | __tmp = xmlNode(_obj=ret)
|
---|
5994 | return __tmp
|
---|
5995 |
|
---|
5996 | def setNs(self, node):
|
---|
5997 | """Associate a namespace to a node, a posteriori. """
|
---|
5998 | if node is None: node__o = None
|
---|
5999 | else: node__o = node._o
|
---|
6000 | libxml2mod.xmlSetNs(node__o, self._o)
|
---|
6001 |
|
---|
6002 | def setNsProp(self, node, name, value):
|
---|
6003 | """Set (or reset) an attribute carried by a node. The ns
|
---|
6004 | structure must be in scope, this is not checked """
|
---|
6005 | if node is None: node__o = None
|
---|
6006 | else: node__o = node._o
|
---|
6007 | ret = libxml2mod.xmlSetNsProp(node__o, self._o, name, value)
|
---|
6008 | if ret is None:raise treeError('xmlSetNsProp() failed')
|
---|
6009 | __tmp = xmlAttr(_obj=ret)
|
---|
6010 | return __tmp
|
---|
6011 |
|
---|
6012 | def unsetNsProp(self, node, name):
|
---|
6013 | """Remove an attribute carried by a node. """
|
---|
6014 | if node is None: node__o = None
|
---|
6015 | else: node__o = node._o
|
---|
6016 | ret = libxml2mod.xmlUnsetNsProp(node__o, self._o, name)
|
---|
6017 | return ret
|
---|
6018 |
|
---|
6019 | #
|
---|
6020 | # xmlNs functions from module xpathInternals
|
---|
6021 | #
|
---|
6022 |
|
---|
6023 | def xpathNodeSetFreeNs(self):
|
---|
6024 | """Namespace nodes in libxml don't match the XPath semantic.
|
---|
6025 | In a node set the namespace nodes are duplicated and the
|
---|
6026 | next pointer is set to the parent node in the XPath
|
---|
6027 | semantic. Check if such a node needs to be freed """
|
---|
6028 | libxml2mod.xmlXPathNodeSetFreeNs(self._o)
|
---|
6029 |
|
---|
6030 | class outputBuffer(ioWriteWrapper):
|
---|
6031 | def __init__(self, _obj=None):
|
---|
6032 | self._o = _obj
|
---|
6033 | ioWriteWrapper.__init__(self, _obj=_obj)
|
---|
6034 |
|
---|
6035 | #
|
---|
6036 | # outputBuffer functions from module HTMLtree
|
---|
6037 | #
|
---|
6038 |
|
---|
6039 | def htmlDocContentDumpFormatOutput(self, cur, encoding, format):
|
---|
6040 | """Dump an HTML document. """
|
---|
6041 | if cur is None: cur__o = None
|
---|
6042 | else: cur__o = cur._o
|
---|
6043 | libxml2mod.htmlDocContentDumpFormatOutput(self._o, cur__o, encoding, format)
|
---|
6044 |
|
---|
6045 | def htmlDocContentDumpOutput(self, cur, encoding):
|
---|
6046 | """Dump an HTML document. Formating return/spaces are added. """
|
---|
6047 | if cur is None: cur__o = None
|
---|
6048 | else: cur__o = cur._o
|
---|
6049 | libxml2mod.htmlDocContentDumpOutput(self._o, cur__o, encoding)
|
---|
6050 |
|
---|
6051 | def htmlNodeDumpFormatOutput(self, doc, cur, encoding, format):
|
---|
6052 | """Dump an HTML node, recursive behaviour,children are printed
|
---|
6053 | too. """
|
---|
6054 | if doc is None: doc__o = None
|
---|
6055 | else: doc__o = doc._o
|
---|
6056 | if cur is None: cur__o = None
|
---|
6057 | else: cur__o = cur._o
|
---|
6058 | libxml2mod.htmlNodeDumpFormatOutput(self._o, doc__o, cur__o, encoding, format)
|
---|
6059 |
|
---|
6060 | def htmlNodeDumpOutput(self, doc, cur, encoding):
|
---|
6061 | """Dump an HTML node, recursive behaviour,children are printed
|
---|
6062 | too, and formatting returns/spaces are added. """
|
---|
6063 | if doc is None: doc__o = None
|
---|
6064 | else: doc__o = doc._o
|
---|
6065 | if cur is None: cur__o = None
|
---|
6066 | else: cur__o = cur._o
|
---|
6067 | libxml2mod.htmlNodeDumpOutput(self._o, doc__o, cur__o, encoding)
|
---|
6068 |
|
---|
6069 | #
|
---|
6070 | # outputBuffer functions from module tree
|
---|
6071 | #
|
---|
6072 |
|
---|
6073 | def nodeDumpOutput(self, doc, cur, level, format, encoding):
|
---|
6074 | """Dump an XML node, recursive behaviour, children are printed
|
---|
6075 | too. Note that @format = 1 provide node indenting only if
|
---|
6076 | xmlIndentTreeOutput = 1 or xmlKeepBlanksDefault(0) was
|
---|
6077 | called """
|
---|
6078 | if doc is None: doc__o = None
|
---|
6079 | else: doc__o = doc._o
|
---|
6080 | if cur is None: cur__o = None
|
---|
6081 | else: cur__o = cur._o
|
---|
6082 | libxml2mod.xmlNodeDumpOutput(self._o, doc__o, cur__o, level, format, encoding)
|
---|
6083 |
|
---|
6084 | def saveFileTo(self, cur, encoding):
|
---|
6085 | """Dump an XML document to an I/O buffer. Warning ! This call
|
---|
6086 | xmlOutputBufferClose() on buf which is not available after
|
---|
6087 | this call. """
|
---|
6088 | if cur is None: cur__o = None
|
---|
6089 | else: cur__o = cur._o
|
---|
6090 | ret = libxml2mod.xmlSaveFileTo(self._o, cur__o, encoding)
|
---|
6091 | return ret
|
---|
6092 |
|
---|
6093 | def saveFormatFileTo(self, cur, encoding, format):
|
---|
6094 | """Dump an XML document to an I/O buffer. Warning ! This call
|
---|
6095 | xmlOutputBufferClose() on buf which is not available after
|
---|
6096 | this call. """
|
---|
6097 | if cur is None: cur__o = None
|
---|
6098 | else: cur__o = cur._o
|
---|
6099 | ret = libxml2mod.xmlSaveFormatFileTo(self._o, cur__o, encoding, format)
|
---|
6100 | return ret
|
---|
6101 |
|
---|
6102 | #
|
---|
6103 | # outputBuffer functions from module xmlIO
|
---|
6104 | #
|
---|
6105 |
|
---|
6106 | def getContent(self):
|
---|
6107 | """Gives a pointer to the data currently held in the output
|
---|
6108 | buffer """
|
---|
6109 | ret = libxml2mod.xmlOutputBufferGetContent(self._o)
|
---|
6110 | return ret
|
---|
6111 |
|
---|
6112 | def write(self, len, buf):
|
---|
6113 | """Write the content of the array in the output I/O buffer
|
---|
6114 | This routine handle the I18N transcoding from internal
|
---|
6115 | UTF-8 The buffer is lossless, i.e. will store in case of
|
---|
6116 | partial or delayed writes. """
|
---|
6117 | ret = libxml2mod.xmlOutputBufferWrite(self._o, len, buf)
|
---|
6118 | return ret
|
---|
6119 |
|
---|
6120 | def writeString(self, str):
|
---|
6121 | """Write the content of the string in the output I/O buffer
|
---|
6122 | This routine handle the I18N transcoding from internal
|
---|
6123 | UTF-8 The buffer is lossless, i.e. will store in case of
|
---|
6124 | partial or delayed writes. """
|
---|
6125 | ret = libxml2mod.xmlOutputBufferWriteString(self._o, str)
|
---|
6126 | return ret
|
---|
6127 |
|
---|
6128 | class inputBuffer(ioReadWrapper):
|
---|
6129 | def __init__(self, _obj=None):
|
---|
6130 | self._o = _obj
|
---|
6131 | ioReadWrapper.__init__(self, _obj=_obj)
|
---|
6132 |
|
---|
6133 | def __del__(self):
|
---|
6134 | if self._o != None:
|
---|
6135 | libxml2mod.xmlFreeParserInputBuffer(self._o)
|
---|
6136 | self._o = None
|
---|
6137 |
|
---|
6138 | #
|
---|
6139 | # inputBuffer functions from module xmlIO
|
---|
6140 | #
|
---|
6141 |
|
---|
6142 | def grow(self, len):
|
---|
6143 | """Grow up the content of the input buffer, the old data are
|
---|
6144 | preserved This routine handle the I18N transcoding to
|
---|
6145 | internal UTF-8 This routine is used when operating the
|
---|
6146 | parser in normal (pull) mode TODO: one should be able to
|
---|
6147 | remove one extra copy by copying directly onto in->buffer
|
---|
6148 | or in->raw """
|
---|
6149 | ret = libxml2mod.xmlParserInputBufferGrow(self._o, len)
|
---|
6150 | return ret
|
---|
6151 |
|
---|
6152 | def push(self, len, buf):
|
---|
6153 | """Push the content of the arry in the input buffer This
|
---|
6154 | routine handle the I18N transcoding to internal UTF-8 This
|
---|
6155 | is used when operating the parser in progressive (push)
|
---|
6156 | mode. """
|
---|
6157 | ret = libxml2mod.xmlParserInputBufferPush(self._o, len, buf)
|
---|
6158 | return ret
|
---|
6159 |
|
---|
6160 | def read(self, len):
|
---|
6161 | """Refresh the content of the input buffer, the old data are
|
---|
6162 | considered consumed This routine handle the I18N
|
---|
6163 | transcoding to internal UTF-8 """
|
---|
6164 | ret = libxml2mod.xmlParserInputBufferRead(self._o, len)
|
---|
6165 | return ret
|
---|
6166 |
|
---|
6167 | #
|
---|
6168 | # inputBuffer functions from module xmlreader
|
---|
6169 | #
|
---|
6170 |
|
---|
6171 | def Setup(self, reader, URL, encoding, options):
|
---|
6172 | """Setup an XML reader with new options """
|
---|
6173 | if reader is None: reader__o = None
|
---|
6174 | else: reader__o = reader._o
|
---|
6175 | ret = libxml2mod.xmlTextReaderSetup(reader__o, self._o, URL, encoding, options)
|
---|
6176 | return ret
|
---|
6177 |
|
---|
6178 | def newTextReader(self, URI):
|
---|
6179 | """Create an xmlTextReader structure fed with @input """
|
---|
6180 | ret = libxml2mod.xmlNewTextReader(self._o, URI)
|
---|
6181 | if ret is None:raise treeError('xmlNewTextReader() failed')
|
---|
6182 | __tmp = xmlTextReader(_obj=ret)
|
---|
6183 | __tmp.input = self
|
---|
6184 | return __tmp
|
---|
6185 |
|
---|
6186 | class xmlReg:
|
---|
6187 | def __init__(self, _obj=None):
|
---|
6188 | if _obj != None:self._o = _obj;return
|
---|
6189 | self._o = None
|
---|
6190 |
|
---|
6191 | def __del__(self):
|
---|
6192 | if self._o != None:
|
---|
6193 | libxml2mod.xmlRegFreeRegexp(self._o)
|
---|
6194 | self._o = None
|
---|
6195 |
|
---|
6196 | #
|
---|
6197 | # xmlReg functions from module xmlregexp
|
---|
6198 | #
|
---|
6199 |
|
---|
6200 | def regexpExec(self, content):
|
---|
6201 | """Check if the regular expression generates the value """
|
---|
6202 | ret = libxml2mod.xmlRegexpExec(self._o, content)
|
---|
6203 | return ret
|
---|
6204 |
|
---|
6205 | def regexpIsDeterminist(self):
|
---|
6206 | """Check if the regular expression is determinist """
|
---|
6207 | ret = libxml2mod.xmlRegexpIsDeterminist(self._o)
|
---|
6208 | return ret
|
---|
6209 |
|
---|
6210 | def regexpPrint(self, output):
|
---|
6211 | """Print the content of the compiled regular expression """
|
---|
6212 | libxml2mod.xmlRegexpPrint(output, self._o)
|
---|
6213 |
|
---|
6214 | class relaxNgParserCtxt:
|
---|
6215 | def __init__(self, _obj=None):
|
---|
6216 | if _obj != None:self._o = _obj;return
|
---|
6217 | self._o = None
|
---|
6218 |
|
---|
6219 | def __del__(self):
|
---|
6220 | if self._o != None:
|
---|
6221 | libxml2mod.xmlRelaxNGFreeParserCtxt(self._o)
|
---|
6222 | self._o = None
|
---|
6223 |
|
---|
6224 | #
|
---|
6225 | # relaxNgParserCtxt functions from module relaxng
|
---|
6226 | #
|
---|
6227 |
|
---|
6228 | def relaxNGParse(self):
|
---|
6229 | """parse a schema definition resource and build an internal
|
---|
6230 | XML Shema struture which can be used to validate instances. """
|
---|
6231 | ret = libxml2mod.xmlRelaxNGParse(self._o)
|
---|
6232 | if ret is None:raise parserError('xmlRelaxNGParse() failed')
|
---|
6233 | __tmp = relaxNgSchema(_obj=ret)
|
---|
6234 | return __tmp
|
---|
6235 |
|
---|
6236 | def relaxParserSetFlag(self, flags):
|
---|
6237 | """Semi private function used to pass informations to a parser
|
---|
6238 | context which are a combination of xmlRelaxNGParserFlag . """
|
---|
6239 | ret = libxml2mod.xmlRelaxParserSetFlag(self._o, flags)
|
---|
6240 | return ret
|
---|
6241 |
|
---|
6242 | class relaxNgSchema:
|
---|
6243 | def __init__(self, _obj=None):
|
---|
6244 | if _obj != None:self._o = _obj;return
|
---|
6245 | self._o = None
|
---|
6246 |
|
---|
6247 | def __del__(self):
|
---|
6248 | if self._o != None:
|
---|
6249 | libxml2mod.xmlRelaxNGFree(self._o)
|
---|
6250 | self._o = None
|
---|
6251 |
|
---|
6252 | #
|
---|
6253 | # relaxNgSchema functions from module relaxng
|
---|
6254 | #
|
---|
6255 |
|
---|
6256 | def relaxNGDump(self, output):
|
---|
6257 | """Dump a RelaxNG structure back """
|
---|
6258 | libxml2mod.xmlRelaxNGDump(output, self._o)
|
---|
6259 |
|
---|
6260 | def relaxNGDumpTree(self, output):
|
---|
6261 | """Dump the transformed RelaxNG tree. """
|
---|
6262 | libxml2mod.xmlRelaxNGDumpTree(output, self._o)
|
---|
6263 |
|
---|
6264 | def relaxNGNewValidCtxt(self):
|
---|
6265 | """Create an XML RelaxNGs validation context based on the
|
---|
6266 | given schema """
|
---|
6267 | ret = libxml2mod.xmlRelaxNGNewValidCtxt(self._o)
|
---|
6268 | if ret is None:raise treeError('xmlRelaxNGNewValidCtxt() failed')
|
---|
6269 | __tmp = relaxNgValidCtxt(_obj=ret)
|
---|
6270 | __tmp.schema = self
|
---|
6271 | return __tmp
|
---|
6272 |
|
---|
6273 | #
|
---|
6274 | # relaxNgSchema functions from module xmlreader
|
---|
6275 | #
|
---|
6276 |
|
---|
6277 | def RelaxNGSetSchema(self, reader):
|
---|
6278 | """Use RelaxNG to validate the document as it is processed.
|
---|
6279 | Activation is only possible before the first Read(). if
|
---|
6280 | @schema is None, then RelaxNG validation is desactivated. @
|
---|
6281 | The @schema should not be freed until the reader is
|
---|
6282 | deallocated or its use has been deactivated. """
|
---|
6283 | if reader is None: reader__o = None
|
---|
6284 | else: reader__o = reader._o
|
---|
6285 | ret = libxml2mod.xmlTextReaderRelaxNGSetSchema(reader__o, self._o)
|
---|
6286 | return ret
|
---|
6287 |
|
---|
6288 | class relaxNgValidCtxt(relaxNgValidCtxtCore):
|
---|
6289 | def __init__(self, _obj=None):
|
---|
6290 | self.schema = None
|
---|
6291 | self._o = _obj
|
---|
6292 | relaxNgValidCtxtCore.__init__(self, _obj=_obj)
|
---|
6293 |
|
---|
6294 | def __del__(self):
|
---|
6295 | if self._o != None:
|
---|
6296 | libxml2mod.xmlRelaxNGFreeValidCtxt(self._o)
|
---|
6297 | self._o = None
|
---|
6298 |
|
---|
6299 | #
|
---|
6300 | # relaxNgValidCtxt functions from module relaxng
|
---|
6301 | #
|
---|
6302 |
|
---|
6303 | def relaxNGValidateDoc(self, doc):
|
---|
6304 | """Validate a document tree in memory. """
|
---|
6305 | if doc is None: doc__o = None
|
---|
6306 | else: doc__o = doc._o
|
---|
6307 | ret = libxml2mod.xmlRelaxNGValidateDoc(self._o, doc__o)
|
---|
6308 | return ret
|
---|
6309 |
|
---|
6310 | def relaxNGValidateFullElement(self, doc, elem):
|
---|
6311 | """Validate a full subtree when
|
---|
6312 | xmlRelaxNGValidatePushElement() returned 0 and the content
|
---|
6313 | of the node has been expanded. """
|
---|
6314 | if doc is None: doc__o = None
|
---|
6315 | else: doc__o = doc._o
|
---|
6316 | if elem is None: elem__o = None
|
---|
6317 | else: elem__o = elem._o
|
---|
6318 | ret = libxml2mod.xmlRelaxNGValidateFullElement(self._o, doc__o, elem__o)
|
---|
6319 | return ret
|
---|
6320 |
|
---|
6321 | def relaxNGValidatePopElement(self, doc, elem):
|
---|
6322 | """Pop the element end from the RelaxNG validation stack. """
|
---|
6323 | if doc is None: doc__o = None
|
---|
6324 | else: doc__o = doc._o
|
---|
6325 | if elem is None: elem__o = None
|
---|
6326 | else: elem__o = elem._o
|
---|
6327 | ret = libxml2mod.xmlRelaxNGValidatePopElement(self._o, doc__o, elem__o)
|
---|
6328 | return ret
|
---|
6329 |
|
---|
6330 | def relaxNGValidatePushCData(self, data, len):
|
---|
6331 | """check the CData parsed for validation in the current stack """
|
---|
6332 | ret = libxml2mod.xmlRelaxNGValidatePushCData(self._o, data, len)
|
---|
6333 | return ret
|
---|
6334 |
|
---|
6335 | def relaxNGValidatePushElement(self, doc, elem):
|
---|
6336 | """Push a new element start on the RelaxNG validation stack. """
|
---|
6337 | if doc is None: doc__o = None
|
---|
6338 | else: doc__o = doc._o
|
---|
6339 | if elem is None: elem__o = None
|
---|
6340 | else: elem__o = elem._o
|
---|
6341 | ret = libxml2mod.xmlRelaxNGValidatePushElement(self._o, doc__o, elem__o)
|
---|
6342 | return ret
|
---|
6343 |
|
---|
6344 | #
|
---|
6345 | # relaxNgValidCtxt functions from module xmlreader
|
---|
6346 | #
|
---|
6347 |
|
---|
6348 | def RelaxNGValidateCtxt(self, reader, options):
|
---|
6349 | """Use RelaxNG schema context to validate the document as it
|
---|
6350 | is processed. Activation is only possible before the first
|
---|
6351 | Read(). If @ctxt is None, then RelaxNG schema validation is
|
---|
6352 | deactivated. """
|
---|
6353 | if reader is None: reader__o = None
|
---|
6354 | else: reader__o = reader._o
|
---|
6355 | ret = libxml2mod.xmlTextReaderRelaxNGValidateCtxt(reader__o, self._o, options)
|
---|
6356 | return ret
|
---|
6357 |
|
---|
6358 | class SchemaParserCtxt:
|
---|
6359 | def __init__(self, _obj=None):
|
---|
6360 | if _obj != None:self._o = _obj;return
|
---|
6361 | self._o = None
|
---|
6362 |
|
---|
6363 | def __del__(self):
|
---|
6364 | if self._o != None:
|
---|
6365 | libxml2mod.xmlSchemaFreeParserCtxt(self._o)
|
---|
6366 | self._o = None
|
---|
6367 |
|
---|
6368 | #
|
---|
6369 | # SchemaParserCtxt functions from module xmlschemas
|
---|
6370 | #
|
---|
6371 |
|
---|
6372 | def schemaParse(self):
|
---|
6373 | """parse a schema definition resource and build an internal
|
---|
6374 | XML Shema struture which can be used to validate instances. """
|
---|
6375 | ret = libxml2mod.xmlSchemaParse(self._o)
|
---|
6376 | if ret is None:raise parserError('xmlSchemaParse() failed')
|
---|
6377 | __tmp = Schema(_obj=ret)
|
---|
6378 | return __tmp
|
---|
6379 |
|
---|
6380 | class Schema:
|
---|
6381 | def __init__(self, _obj=None):
|
---|
6382 | if _obj != None:self._o = _obj;return
|
---|
6383 | self._o = None
|
---|
6384 |
|
---|
6385 | def __del__(self):
|
---|
6386 | if self._o != None:
|
---|
6387 | libxml2mod.xmlSchemaFree(self._o)
|
---|
6388 | self._o = None
|
---|
6389 |
|
---|
6390 | #
|
---|
6391 | # Schema functions from module xmlreader
|
---|
6392 | #
|
---|
6393 |
|
---|
6394 | def SetSchema(self, reader):
|
---|
6395 | """Use XSD Schema to validate the document as it is processed.
|
---|
6396 | Activation is only possible before the first Read(). if
|
---|
6397 | @schema is None, then Schema validation is desactivated. @
|
---|
6398 | The @schema should not be freed until the reader is
|
---|
6399 | deallocated or its use has been deactivated. """
|
---|
6400 | if reader is None: reader__o = None
|
---|
6401 | else: reader__o = reader._o
|
---|
6402 | ret = libxml2mod.xmlTextReaderSetSchema(reader__o, self._o)
|
---|
6403 | return ret
|
---|
6404 |
|
---|
6405 | #
|
---|
6406 | # Schema functions from module xmlschemas
|
---|
6407 | #
|
---|
6408 |
|
---|
6409 | def schemaDump(self, output):
|
---|
6410 | """Dump a Schema structure. """
|
---|
6411 | libxml2mod.xmlSchemaDump(output, self._o)
|
---|
6412 |
|
---|
6413 | def schemaNewValidCtxt(self):
|
---|
6414 | """Create an XML Schemas validation context based on the given
|
---|
6415 | schema. """
|
---|
6416 | ret = libxml2mod.xmlSchemaNewValidCtxt(self._o)
|
---|
6417 | if ret is None:raise treeError('xmlSchemaNewValidCtxt() failed')
|
---|
6418 | __tmp = SchemaValidCtxt(_obj=ret)
|
---|
6419 | __tmp.schema = self
|
---|
6420 | return __tmp
|
---|
6421 |
|
---|
6422 | class SchemaValidCtxt(SchemaValidCtxtCore):
|
---|
6423 | def __init__(self, _obj=None):
|
---|
6424 | self.schema = None
|
---|
6425 | self._o = _obj
|
---|
6426 | SchemaValidCtxtCore.__init__(self, _obj=_obj)
|
---|
6427 |
|
---|
6428 | def __del__(self):
|
---|
6429 | if self._o != None:
|
---|
6430 | libxml2mod.xmlSchemaFreeValidCtxt(self._o)
|
---|
6431 | self._o = None
|
---|
6432 |
|
---|
6433 | #
|
---|
6434 | # SchemaValidCtxt functions from module xmlreader
|
---|
6435 | #
|
---|
6436 |
|
---|
6437 | def SchemaValidateCtxt(self, reader, options):
|
---|
6438 | """Use W3C XSD schema context to validate the document as it
|
---|
6439 | is processed. Activation is only possible before the first
|
---|
6440 | Read(). If @ctxt is None, then XML Schema validation is
|
---|
6441 | deactivated. """
|
---|
6442 | if reader is None: reader__o = None
|
---|
6443 | else: reader__o = reader._o
|
---|
6444 | ret = libxml2mod.xmlTextReaderSchemaValidateCtxt(reader__o, self._o, options)
|
---|
6445 | return ret
|
---|
6446 |
|
---|
6447 | #
|
---|
6448 | # SchemaValidCtxt functions from module xmlschemas
|
---|
6449 | #
|
---|
6450 |
|
---|
6451 | def schemaIsValid(self):
|
---|
6452 | """Check if any error was detected during validation. """
|
---|
6453 | ret = libxml2mod.xmlSchemaIsValid(self._o)
|
---|
6454 | return ret
|
---|
6455 |
|
---|
6456 | def schemaSetValidOptions(self, options):
|
---|
6457 | """Sets the options to be used during the validation. """
|
---|
6458 | ret = libxml2mod.xmlSchemaSetValidOptions(self._o, options)
|
---|
6459 | return ret
|
---|
6460 |
|
---|
6461 | def schemaValidCtxtGetOptions(self):
|
---|
6462 | """Get the validation context options. """
|
---|
6463 | ret = libxml2mod.xmlSchemaValidCtxtGetOptions(self._o)
|
---|
6464 | return ret
|
---|
6465 |
|
---|
6466 | def schemaValidCtxtGetParserCtxt(self):
|
---|
6467 | """allow access to the parser context of the schema validation
|
---|
6468 | context """
|
---|
6469 | ret = libxml2mod.xmlSchemaValidCtxtGetParserCtxt(self._o)
|
---|
6470 | if ret is None:raise parserError('xmlSchemaValidCtxtGetParserCtxt() failed')
|
---|
6471 | __tmp = parserCtxt(_obj=ret)
|
---|
6472 | return __tmp
|
---|
6473 |
|
---|
6474 | def schemaValidateDoc(self, doc):
|
---|
6475 | """Validate a document tree in memory. """
|
---|
6476 | if doc is None: doc__o = None
|
---|
6477 | else: doc__o = doc._o
|
---|
6478 | ret = libxml2mod.xmlSchemaValidateDoc(self._o, doc__o)
|
---|
6479 | return ret
|
---|
6480 |
|
---|
6481 | def schemaValidateFile(self, filename, options):
|
---|
6482 | """Do a schemas validation of the given resource, it will use
|
---|
6483 | the SAX streamable validation internally. """
|
---|
6484 | ret = libxml2mod.xmlSchemaValidateFile(self._o, filename, options)
|
---|
6485 | return ret
|
---|
6486 |
|
---|
6487 | def schemaValidateOneElement(self, elem):
|
---|
6488 | """Validate a branch of a tree, starting with the given @elem. """
|
---|
6489 | if elem is None: elem__o = None
|
---|
6490 | else: elem__o = elem._o
|
---|
6491 | ret = libxml2mod.xmlSchemaValidateOneElement(self._o, elem__o)
|
---|
6492 | return ret
|
---|
6493 |
|
---|
6494 | def schemaValidateSetFilename(self, filename):
|
---|
6495 | """Workaround to provide file error reporting information when
|
---|
6496 | this is not provided by current APIs """
|
---|
6497 | libxml2mod.xmlSchemaValidateSetFilename(self._o, filename)
|
---|
6498 |
|
---|
6499 | class xmlTextReaderLocator:
|
---|
6500 | def __init__(self, _obj=None):
|
---|
6501 | if _obj != None:self._o = _obj;return
|
---|
6502 | self._o = None
|
---|
6503 |
|
---|
6504 | #
|
---|
6505 | # xmlTextReaderLocator functions from module xmlreader
|
---|
6506 | #
|
---|
6507 |
|
---|
6508 | def BaseURI(self):
|
---|
6509 | """Obtain the base URI for the given locator. """
|
---|
6510 | ret = libxml2mod.xmlTextReaderLocatorBaseURI(self._o)
|
---|
6511 | return ret
|
---|
6512 |
|
---|
6513 | def LineNumber(self):
|
---|
6514 | """Obtain the line number for the given locator. """
|
---|
6515 | ret = libxml2mod.xmlTextReaderLocatorLineNumber(self._o)
|
---|
6516 | return ret
|
---|
6517 |
|
---|
6518 | class xmlTextReader(xmlTextReaderCore):
|
---|
6519 | def __init__(self, _obj=None):
|
---|
6520 | self.input = None
|
---|
6521 | self._o = _obj
|
---|
6522 | xmlTextReaderCore.__init__(self, _obj=_obj)
|
---|
6523 |
|
---|
6524 | def __del__(self):
|
---|
6525 | if self._o != None:
|
---|
6526 | libxml2mod.xmlFreeTextReader(self._o)
|
---|
6527 | self._o = None
|
---|
6528 |
|
---|
6529 | #
|
---|
6530 | # xmlTextReader functions from module xmlreader
|
---|
6531 | #
|
---|
6532 |
|
---|
6533 | def AttributeCount(self):
|
---|
6534 | """Provides the number of attributes of the current node """
|
---|
6535 | ret = libxml2mod.xmlTextReaderAttributeCount(self._o)
|
---|
6536 | return ret
|
---|
6537 |
|
---|
6538 | def BaseUri(self):
|
---|
6539 | """The base URI of the node. """
|
---|
6540 | ret = libxml2mod.xmlTextReaderConstBaseUri(self._o)
|
---|
6541 | return ret
|
---|
6542 |
|
---|
6543 | def ByteConsumed(self):
|
---|
6544 | """This function provides the current index of the parser used
|
---|
6545 | by the reader, relative to the start of the current entity.
|
---|
6546 | This function actually just wraps a call to
|
---|
6547 | xmlBytesConsumed() for the parser context associated with
|
---|
6548 | the reader. See xmlBytesConsumed() for more information. """
|
---|
6549 | ret = libxml2mod.xmlTextReaderByteConsumed(self._o)
|
---|
6550 | return ret
|
---|
6551 |
|
---|
6552 | def Close(self):
|
---|
6553 | """This method releases any resources allocated by the current
|
---|
6554 | instance changes the state to Closed and close any
|
---|
6555 | underlying input. """
|
---|
6556 | ret = libxml2mod.xmlTextReaderClose(self._o)
|
---|
6557 | return ret
|
---|
6558 |
|
---|
6559 | def CurrentDoc(self):
|
---|
6560 | """Hacking interface allowing to get the xmlDocPtr
|
---|
6561 | correponding to the current document being accessed by the
|
---|
6562 | xmlTextReader. NOTE: as a result of this call, the reader
|
---|
6563 | will not destroy the associated XML document and calling
|
---|
6564 | xmlFreeDoc() on the result is needed once the reader
|
---|
6565 | parsing has finished. """
|
---|
6566 | ret = libxml2mod.xmlTextReaderCurrentDoc(self._o)
|
---|
6567 | if ret is None:raise treeError('xmlTextReaderCurrentDoc() failed')
|
---|
6568 | __tmp = xmlDoc(_obj=ret)
|
---|
6569 | return __tmp
|
---|
6570 |
|
---|
6571 | def CurrentNode(self):
|
---|
6572 | """Hacking interface allowing to get the xmlNodePtr
|
---|
6573 | correponding to the current node being accessed by the
|
---|
6574 | xmlTextReader. This is dangerous because the underlying
|
---|
6575 | node may be destroyed on the next Reads. """
|
---|
6576 | ret = libxml2mod.xmlTextReaderCurrentNode(self._o)
|
---|
6577 | if ret is None:raise treeError('xmlTextReaderCurrentNode() failed')
|
---|
6578 | __tmp = xmlNode(_obj=ret)
|
---|
6579 | return __tmp
|
---|
6580 |
|
---|
6581 | def Depth(self):
|
---|
6582 | """The depth of the node in the tree. """
|
---|
6583 | ret = libxml2mod.xmlTextReaderDepth(self._o)
|
---|
6584 | return ret
|
---|
6585 |
|
---|
6586 | def Encoding(self):
|
---|
6587 | """Determine the encoding of the document being read. """
|
---|
6588 | ret = libxml2mod.xmlTextReaderConstEncoding(self._o)
|
---|
6589 | return ret
|
---|
6590 |
|
---|
6591 | def Expand(self):
|
---|
6592 | """Reads the contents of the current node and the full
|
---|
6593 | subtree. It then makes the subtree available until the next
|
---|
6594 | xmlTextReaderRead() call """
|
---|
6595 | ret = libxml2mod.xmlTextReaderExpand(self._o)
|
---|
6596 | if ret is None:raise treeError('xmlTextReaderExpand() failed')
|
---|
6597 | __tmp = xmlNode(_obj=ret)
|
---|
6598 | return __tmp
|
---|
6599 |
|
---|
6600 | def GetAttribute(self, name):
|
---|
6601 | """Provides the value of the attribute with the specified
|
---|
6602 | qualified name. """
|
---|
6603 | ret = libxml2mod.xmlTextReaderGetAttribute(self._o, name)
|
---|
6604 | return ret
|
---|
6605 |
|
---|
6606 | def GetAttributeNo(self, no):
|
---|
6607 | """Provides the value of the attribute with the specified
|
---|
6608 | index relative to the containing element. """
|
---|
6609 | ret = libxml2mod.xmlTextReaderGetAttributeNo(self._o, no)
|
---|
6610 | return ret
|
---|
6611 |
|
---|
6612 | def GetAttributeNs(self, localName, namespaceURI):
|
---|
6613 | """Provides the value of the specified attribute """
|
---|
6614 | ret = libxml2mod.xmlTextReaderGetAttributeNs(self._o, localName, namespaceURI)
|
---|
6615 | return ret
|
---|
6616 |
|
---|
6617 | def GetParserColumnNumber(self):
|
---|
6618 | """Provide the column number of the current parsing point. """
|
---|
6619 | ret = libxml2mod.xmlTextReaderGetParserColumnNumber(self._o)
|
---|
6620 | return ret
|
---|
6621 |
|
---|
6622 | def GetParserLineNumber(self):
|
---|
6623 | """Provide the line number of the current parsing point. """
|
---|
6624 | ret = libxml2mod.xmlTextReaderGetParserLineNumber(self._o)
|
---|
6625 | return ret
|
---|
6626 |
|
---|
6627 | def GetParserProp(self, prop):
|
---|
6628 | """Read the parser internal property. """
|
---|
6629 | ret = libxml2mod.xmlTextReaderGetParserProp(self._o, prop)
|
---|
6630 | return ret
|
---|
6631 |
|
---|
6632 | def GetRemainder(self):
|
---|
6633 | """Method to get the remainder of the buffered XML. this
|
---|
6634 | method stops the parser, set its state to End Of File and
|
---|
6635 | return the input stream with what is left that the parser
|
---|
6636 | did not use. The implementation is not good, the parser
|
---|
6637 | certainly procgressed past what's left in reader->input,
|
---|
6638 | and there is an allocation problem. Best would be to
|
---|
6639 | rewrite it differently. """
|
---|
6640 | ret = libxml2mod.xmlTextReaderGetRemainder(self._o)
|
---|
6641 | if ret is None:raise treeError('xmlTextReaderGetRemainder() failed')
|
---|
6642 | __tmp = inputBuffer(_obj=ret)
|
---|
6643 | return __tmp
|
---|
6644 |
|
---|
6645 | def HasAttributes(self):
|
---|
6646 | """Whether the node has attributes. """
|
---|
6647 | ret = libxml2mod.xmlTextReaderHasAttributes(self._o)
|
---|
6648 | return ret
|
---|
6649 |
|
---|
6650 | def HasValue(self):
|
---|
6651 | """Whether the node can have a text value. """
|
---|
6652 | ret = libxml2mod.xmlTextReaderHasValue(self._o)
|
---|
6653 | return ret
|
---|
6654 |
|
---|
6655 | def IsDefault(self):
|
---|
6656 | """Whether an Attribute node was generated from the default
|
---|
6657 | value defined in the DTD or schema. """
|
---|
6658 | ret = libxml2mod.xmlTextReaderIsDefault(self._o)
|
---|
6659 | return ret
|
---|
6660 |
|
---|
6661 | def IsEmptyElement(self):
|
---|
6662 | """Check if the current node is empty """
|
---|
6663 | ret = libxml2mod.xmlTextReaderIsEmptyElement(self._o)
|
---|
6664 | return ret
|
---|
6665 |
|
---|
6666 | def IsNamespaceDecl(self):
|
---|
6667 | """Determine whether the current node is a namespace
|
---|
6668 | declaration rather than a regular attribute. """
|
---|
6669 | ret = libxml2mod.xmlTextReaderIsNamespaceDecl(self._o)
|
---|
6670 | return ret
|
---|
6671 |
|
---|
6672 | def IsValid(self):
|
---|
6673 | """Retrieve the validity status from the parser context """
|
---|
6674 | ret = libxml2mod.xmlTextReaderIsValid(self._o)
|
---|
6675 | return ret
|
---|
6676 |
|
---|
6677 | def LocalName(self):
|
---|
6678 | """The local name of the node. """
|
---|
6679 | ret = libxml2mod.xmlTextReaderConstLocalName(self._o)
|
---|
6680 | return ret
|
---|
6681 |
|
---|
6682 | def LookupNamespace(self, prefix):
|
---|
6683 | """Resolves a namespace prefix in the scope of the current
|
---|
6684 | element. """
|
---|
6685 | ret = libxml2mod.xmlTextReaderLookupNamespace(self._o, prefix)
|
---|
6686 | return ret
|
---|
6687 |
|
---|
6688 | def MoveToAttribute(self, name):
|
---|
6689 | """Moves the position of the current instance to the attribute
|
---|
6690 | with the specified qualified name. """
|
---|
6691 | ret = libxml2mod.xmlTextReaderMoveToAttribute(self._o, name)
|
---|
6692 | return ret
|
---|
6693 |
|
---|
6694 | def MoveToAttributeNo(self, no):
|
---|
6695 | """Moves the position of the current instance to the attribute
|
---|
6696 | with the specified index relative to the containing element. """
|
---|
6697 | ret = libxml2mod.xmlTextReaderMoveToAttributeNo(self._o, no)
|
---|
6698 | return ret
|
---|
6699 |
|
---|
6700 | def MoveToAttributeNs(self, localName, namespaceURI):
|
---|
6701 | """Moves the position of the current instance to the attribute
|
---|
6702 | with the specified local name and namespace URI. """
|
---|
6703 | ret = libxml2mod.xmlTextReaderMoveToAttributeNs(self._o, localName, namespaceURI)
|
---|
6704 | return ret
|
---|
6705 |
|
---|
6706 | def MoveToElement(self):
|
---|
6707 | """Moves the position of the current instance to the node that
|
---|
6708 | contains the current Attribute node. """
|
---|
6709 | ret = libxml2mod.xmlTextReaderMoveToElement(self._o)
|
---|
6710 | return ret
|
---|
6711 |
|
---|
6712 | def MoveToFirstAttribute(self):
|
---|
6713 | """Moves the position of the current instance to the first
|
---|
6714 | attribute associated with the current node. """
|
---|
6715 | ret = libxml2mod.xmlTextReaderMoveToFirstAttribute(self._o)
|
---|
6716 | return ret
|
---|
6717 |
|
---|
6718 | def MoveToNextAttribute(self):
|
---|
6719 | """Moves the position of the current instance to the next
|
---|
6720 | attribute associated with the current node. """
|
---|
6721 | ret = libxml2mod.xmlTextReaderMoveToNextAttribute(self._o)
|
---|
6722 | return ret
|
---|
6723 |
|
---|
6724 | def Name(self):
|
---|
6725 | """The qualified name of the node, equal to Prefix :LocalName. """
|
---|
6726 | ret = libxml2mod.xmlTextReaderConstName(self._o)
|
---|
6727 | return ret
|
---|
6728 |
|
---|
6729 | def NamespaceUri(self):
|
---|
6730 | """The URI defining the namespace associated with the node. """
|
---|
6731 | ret = libxml2mod.xmlTextReaderConstNamespaceUri(self._o)
|
---|
6732 | return ret
|
---|
6733 |
|
---|
6734 | def NewDoc(self, cur, URL, encoding, options):
|
---|
6735 | """Setup an xmltextReader to parse an XML in-memory document.
|
---|
6736 | The parsing flags @options are a combination of
|
---|
6737 | xmlParserOption. This reuses the existing @reader
|
---|
6738 | xmlTextReader. """
|
---|
6739 | ret = libxml2mod.xmlReaderNewDoc(self._o, cur, URL, encoding, options)
|
---|
6740 | return ret
|
---|
6741 |
|
---|
6742 | def NewFd(self, fd, URL, encoding, options):
|
---|
6743 | """Setup an xmltextReader to parse an XML from a file
|
---|
6744 | descriptor. NOTE that the file descriptor will not be
|
---|
6745 | closed when the reader is closed or reset. The parsing
|
---|
6746 | flags @options are a combination of xmlParserOption. This
|
---|
6747 | reuses the existing @reader xmlTextReader. """
|
---|
6748 | ret = libxml2mod.xmlReaderNewFd(self._o, fd, URL, encoding, options)
|
---|
6749 | return ret
|
---|
6750 |
|
---|
6751 | def NewFile(self, filename, encoding, options):
|
---|
6752 | """parse an XML file from the filesystem or the network. The
|
---|
6753 | parsing flags @options are a combination of
|
---|
6754 | xmlParserOption. This reuses the existing @reader
|
---|
6755 | xmlTextReader. """
|
---|
6756 | ret = libxml2mod.xmlReaderNewFile(self._o, filename, encoding, options)
|
---|
6757 | return ret
|
---|
6758 |
|
---|
6759 | def NewMemory(self, buffer, size, URL, encoding, options):
|
---|
6760 | """Setup an xmltextReader to parse an XML in-memory document.
|
---|
6761 | The parsing flags @options are a combination of
|
---|
6762 | xmlParserOption. This reuses the existing @reader
|
---|
6763 | xmlTextReader. """
|
---|
6764 | ret = libxml2mod.xmlReaderNewMemory(self._o, buffer, size, URL, encoding, options)
|
---|
6765 | return ret
|
---|
6766 |
|
---|
6767 | def NewWalker(self, doc):
|
---|
6768 | """Setup an xmltextReader to parse a preparsed XML document.
|
---|
6769 | This reuses the existing @reader xmlTextReader. """
|
---|
6770 | if doc is None: doc__o = None
|
---|
6771 | else: doc__o = doc._o
|
---|
6772 | ret = libxml2mod.xmlReaderNewWalker(self._o, doc__o)
|
---|
6773 | return ret
|
---|
6774 |
|
---|
6775 | def Next(self):
|
---|
6776 | """Skip to the node following the current one in document
|
---|
6777 | order while avoiding the subtree if any. """
|
---|
6778 | ret = libxml2mod.xmlTextReaderNext(self._o)
|
---|
6779 | return ret
|
---|
6780 |
|
---|
6781 | def NextSibling(self):
|
---|
6782 | """Skip to the node following the current one in document
|
---|
6783 | order while avoiding the subtree if any. Currently
|
---|
6784 | implemented only for Readers built on a document """
|
---|
6785 | ret = libxml2mod.xmlTextReaderNextSibling(self._o)
|
---|
6786 | return ret
|
---|
6787 |
|
---|
6788 | def NodeType(self):
|
---|
6789 | """Get the node type of the current node Reference:
|
---|
6790 | http://www.gnu.org/software/dotgnu/pnetlib-doc/System/Xml/Xm
|
---|
6791 | lNodeType.html """
|
---|
6792 | ret = libxml2mod.xmlTextReaderNodeType(self._o)
|
---|
6793 | return ret
|
---|
6794 |
|
---|
6795 | def Normalization(self):
|
---|
6796 | """The value indicating whether to normalize white space and
|
---|
6797 | attribute values. Since attribute value and end of line
|
---|
6798 | normalizations are a MUST in the XML specification only the
|
---|
6799 | value true is accepted. The broken bahaviour of accepting
|
---|
6800 | out of range character entities like � is of course not
|
---|
6801 | supported either. """
|
---|
6802 | ret = libxml2mod.xmlTextReaderNormalization(self._o)
|
---|
6803 | return ret
|
---|
6804 |
|
---|
6805 | def Prefix(self):
|
---|
6806 | """A shorthand reference to the namespace associated with the
|
---|
6807 | node. """
|
---|
6808 | ret = libxml2mod.xmlTextReaderConstPrefix(self._o)
|
---|
6809 | return ret
|
---|
6810 |
|
---|
6811 | def Preserve(self):
|
---|
6812 | """This tells the XML Reader to preserve the current node. The
|
---|
6813 | caller must also use xmlTextReaderCurrentDoc() to keep an
|
---|
6814 | handle on the resulting document once parsing has finished """
|
---|
6815 | ret = libxml2mod.xmlTextReaderPreserve(self._o)
|
---|
6816 | if ret is None:raise treeError('xmlTextReaderPreserve() failed')
|
---|
6817 | __tmp = xmlNode(_obj=ret)
|
---|
6818 | return __tmp
|
---|
6819 |
|
---|
6820 | def QuoteChar(self):
|
---|
6821 | """The quotation mark character used to enclose the value of
|
---|
6822 | an attribute. """
|
---|
6823 | ret = libxml2mod.xmlTextReaderQuoteChar(self._o)
|
---|
6824 | return ret
|
---|
6825 |
|
---|
6826 | def Read(self):
|
---|
6827 | """Moves the position of the current instance to the next node
|
---|
6828 | in the stream, exposing its properties. """
|
---|
6829 | ret = libxml2mod.xmlTextReaderRead(self._o)
|
---|
6830 | return ret
|
---|
6831 |
|
---|
6832 | def ReadAttributeValue(self):
|
---|
6833 | """Parses an attribute value into one or more Text and
|
---|
6834 | EntityReference nodes. """
|
---|
6835 | ret = libxml2mod.xmlTextReaderReadAttributeValue(self._o)
|
---|
6836 | return ret
|
---|
6837 |
|
---|
6838 | def ReadInnerXml(self):
|
---|
6839 | """Reads the contents of the current node, including child
|
---|
6840 | nodes and markup. """
|
---|
6841 | ret = libxml2mod.xmlTextReaderReadInnerXml(self._o)
|
---|
6842 | return ret
|
---|
6843 |
|
---|
6844 | def ReadOuterXml(self):
|
---|
6845 | """Reads the contents of the current node, including child
|
---|
6846 | nodes and markup. """
|
---|
6847 | ret = libxml2mod.xmlTextReaderReadOuterXml(self._o)
|
---|
6848 | return ret
|
---|
6849 |
|
---|
6850 | def ReadState(self):
|
---|
6851 | """Gets the read state of the reader. """
|
---|
6852 | ret = libxml2mod.xmlTextReaderReadState(self._o)
|
---|
6853 | return ret
|
---|
6854 |
|
---|
6855 | def ReadString(self):
|
---|
6856 | """Reads the contents of an element or a text node as a string. """
|
---|
6857 | ret = libxml2mod.xmlTextReaderReadString(self._o)
|
---|
6858 | return ret
|
---|
6859 |
|
---|
6860 | def RelaxNGSetSchema(self, schema):
|
---|
6861 | """Use RelaxNG to validate the document as it is processed.
|
---|
6862 | Activation is only possible before the first Read(). if
|
---|
6863 | @schema is None, then RelaxNG validation is desactivated. @
|
---|
6864 | The @schema should not be freed until the reader is
|
---|
6865 | deallocated or its use has been deactivated. """
|
---|
6866 | if schema is None: schema__o = None
|
---|
6867 | else: schema__o = schema._o
|
---|
6868 | ret = libxml2mod.xmlTextReaderRelaxNGSetSchema(self._o, schema__o)
|
---|
6869 | return ret
|
---|
6870 |
|
---|
6871 | def RelaxNGValidate(self, rng):
|
---|
6872 | """Use RelaxNG schema to validate the document as it is
|
---|
6873 | processed. Activation is only possible before the first
|
---|
6874 | Read(). If @rng is None, then RelaxNG schema validation is
|
---|
6875 | deactivated. """
|
---|
6876 | ret = libxml2mod.xmlTextReaderRelaxNGValidate(self._o, rng)
|
---|
6877 | return ret
|
---|
6878 |
|
---|
6879 | def RelaxNGValidateCtxt(self, ctxt, options):
|
---|
6880 | """Use RelaxNG schema context to validate the document as it
|
---|
6881 | is processed. Activation is only possible before the first
|
---|
6882 | Read(). If @ctxt is None, then RelaxNG schema validation is
|
---|
6883 | deactivated. """
|
---|
6884 | if ctxt is None: ctxt__o = None
|
---|
6885 | else: ctxt__o = ctxt._o
|
---|
6886 | ret = libxml2mod.xmlTextReaderRelaxNGValidateCtxt(self._o, ctxt__o, options)
|
---|
6887 | return ret
|
---|
6888 |
|
---|
6889 | def SchemaValidate(self, xsd):
|
---|
6890 | """Use W3C XSD schema to validate the document as it is
|
---|
6891 | processed. Activation is only possible before the first
|
---|
6892 | Read(). If @xsd is None, then XML Schema validation is
|
---|
6893 | deactivated. """
|
---|
6894 | ret = libxml2mod.xmlTextReaderSchemaValidate(self._o, xsd)
|
---|
6895 | return ret
|
---|
6896 |
|
---|
6897 | def SchemaValidateCtxt(self, ctxt, options):
|
---|
6898 | """Use W3C XSD schema context to validate the document as it
|
---|
6899 | is processed. Activation is only possible before the first
|
---|
6900 | Read(). If @ctxt is None, then XML Schema validation is
|
---|
6901 | deactivated. """
|
---|
6902 | if ctxt is None: ctxt__o = None
|
---|
6903 | else: ctxt__o = ctxt._o
|
---|
6904 | ret = libxml2mod.xmlTextReaderSchemaValidateCtxt(self._o, ctxt__o, options)
|
---|
6905 | return ret
|
---|
6906 |
|
---|
6907 | def SetParserProp(self, prop, value):
|
---|
6908 | """Change the parser processing behaviour by changing some of
|
---|
6909 | its internal properties. Note that some properties can only
|
---|
6910 | be changed before any read has been done. """
|
---|
6911 | ret = libxml2mod.xmlTextReaderSetParserProp(self._o, prop, value)
|
---|
6912 | return ret
|
---|
6913 |
|
---|
6914 | def SetSchema(self, schema):
|
---|
6915 | """Use XSD Schema to validate the document as it is processed.
|
---|
6916 | Activation is only possible before the first Read(). if
|
---|
6917 | @schema is None, then Schema validation is desactivated. @
|
---|
6918 | The @schema should not be freed until the reader is
|
---|
6919 | deallocated or its use has been deactivated. """
|
---|
6920 | if schema is None: schema__o = None
|
---|
6921 | else: schema__o = schema._o
|
---|
6922 | ret = libxml2mod.xmlTextReaderSetSchema(self._o, schema__o)
|
---|
6923 | return ret
|
---|
6924 |
|
---|
6925 | def Setup(self, input, URL, encoding, options):
|
---|
6926 | """Setup an XML reader with new options """
|
---|
6927 | if input is None: input__o = None
|
---|
6928 | else: input__o = input._o
|
---|
6929 | ret = libxml2mod.xmlTextReaderSetup(self._o, input__o, URL, encoding, options)
|
---|
6930 | return ret
|
---|
6931 |
|
---|
6932 | def Standalone(self):
|
---|
6933 | """Determine the standalone status of the document being read. """
|
---|
6934 | ret = libxml2mod.xmlTextReaderStandalone(self._o)
|
---|
6935 | return ret
|
---|
6936 |
|
---|
6937 | def String(self, str):
|
---|
6938 | """Get an interned string from the reader, allows for example
|
---|
6939 | to speedup string name comparisons """
|
---|
6940 | ret = libxml2mod.xmlTextReaderConstString(self._o, str)
|
---|
6941 | return ret
|
---|
6942 |
|
---|
6943 | def Value(self):
|
---|
6944 | """Provides the text value of the node if present """
|
---|
6945 | ret = libxml2mod.xmlTextReaderConstValue(self._o)
|
---|
6946 | return ret
|
---|
6947 |
|
---|
6948 | def XmlLang(self):
|
---|
6949 | """The xml:lang scope within which the node resides. """
|
---|
6950 | ret = libxml2mod.xmlTextReaderConstXmlLang(self._o)
|
---|
6951 | return ret
|
---|
6952 |
|
---|
6953 | def XmlVersion(self):
|
---|
6954 | """Determine the XML version of the document being read. """
|
---|
6955 | ret = libxml2mod.xmlTextReaderConstXmlVersion(self._o)
|
---|
6956 | return ret
|
---|
6957 |
|
---|
6958 | class URI:
|
---|
6959 | def __init__(self, _obj=None):
|
---|
6960 | if _obj != None:self._o = _obj;return
|
---|
6961 | self._o = None
|
---|
6962 |
|
---|
6963 | def __del__(self):
|
---|
6964 | if self._o != None:
|
---|
6965 | libxml2mod.xmlFreeURI(self._o)
|
---|
6966 | self._o = None
|
---|
6967 |
|
---|
6968 | # accessors for URI
|
---|
6969 | def authority(self):
|
---|
6970 | """Get the authority part from an URI """
|
---|
6971 | ret = libxml2mod.xmlURIGetAuthority(self._o)
|
---|
6972 | return ret
|
---|
6973 |
|
---|
6974 | def fragment(self):
|
---|
6975 | """Get the fragment part from an URI """
|
---|
6976 | ret = libxml2mod.xmlURIGetFragment(self._o)
|
---|
6977 | return ret
|
---|
6978 |
|
---|
6979 | def opaque(self):
|
---|
6980 | """Get the opaque part from an URI """
|
---|
6981 | ret = libxml2mod.xmlURIGetOpaque(self._o)
|
---|
6982 | return ret
|
---|
6983 |
|
---|
6984 | def path(self):
|
---|
6985 | """Get the path part from an URI """
|
---|
6986 | ret = libxml2mod.xmlURIGetPath(self._o)
|
---|
6987 | return ret
|
---|
6988 |
|
---|
6989 | def port(self):
|
---|
6990 | """Get the port part from an URI """
|
---|
6991 | ret = libxml2mod.xmlURIGetPort(self._o)
|
---|
6992 | return ret
|
---|
6993 |
|
---|
6994 | def query(self):
|
---|
6995 | """Get the query part from an URI """
|
---|
6996 | ret = libxml2mod.xmlURIGetQuery(self._o)
|
---|
6997 | return ret
|
---|
6998 |
|
---|
6999 | def queryRaw(self):
|
---|
7000 | """Get the raw query part from an URI (i.e. the unescaped
|
---|
7001 | form). """
|
---|
7002 | ret = libxml2mod.xmlURIGetQueryRaw(self._o)
|
---|
7003 | return ret
|
---|
7004 |
|
---|
7005 | def scheme(self):
|
---|
7006 | """Get the scheme part from an URI """
|
---|
7007 | ret = libxml2mod.xmlURIGetScheme(self._o)
|
---|
7008 | return ret
|
---|
7009 |
|
---|
7010 | def server(self):
|
---|
7011 | """Get the server part from an URI """
|
---|
7012 | ret = libxml2mod.xmlURIGetServer(self._o)
|
---|
7013 | return ret
|
---|
7014 |
|
---|
7015 | def setAuthority(self, authority):
|
---|
7016 | """Set the authority part of an URI. """
|
---|
7017 | libxml2mod.xmlURISetAuthority(self._o, authority)
|
---|
7018 |
|
---|
7019 | def setFragment(self, fragment):
|
---|
7020 | """Set the fragment part of an URI. """
|
---|
7021 | libxml2mod.xmlURISetFragment(self._o, fragment)
|
---|
7022 |
|
---|
7023 | def setOpaque(self, opaque):
|
---|
7024 | """Set the opaque part of an URI. """
|
---|
7025 | libxml2mod.xmlURISetOpaque(self._o, opaque)
|
---|
7026 |
|
---|
7027 | def setPath(self, path):
|
---|
7028 | """Set the path part of an URI. """
|
---|
7029 | libxml2mod.xmlURISetPath(self._o, path)
|
---|
7030 |
|
---|
7031 | def setPort(self, port):
|
---|
7032 | """Set the port part of an URI. """
|
---|
7033 | libxml2mod.xmlURISetPort(self._o, port)
|
---|
7034 |
|
---|
7035 | def setQuery(self, query):
|
---|
7036 | """Set the query part of an URI. """
|
---|
7037 | libxml2mod.xmlURISetQuery(self._o, query)
|
---|
7038 |
|
---|
7039 | def setQueryRaw(self, query_raw):
|
---|
7040 | """Set the raw query part of an URI (i.e. the unescaped form). """
|
---|
7041 | libxml2mod.xmlURISetQueryRaw(self._o, query_raw)
|
---|
7042 |
|
---|
7043 | def setScheme(self, scheme):
|
---|
7044 | """Set the scheme part of an URI. """
|
---|
7045 | libxml2mod.xmlURISetScheme(self._o, scheme)
|
---|
7046 |
|
---|
7047 | def setServer(self, server):
|
---|
7048 | """Set the server part of an URI. """
|
---|
7049 | libxml2mod.xmlURISetServer(self._o, server)
|
---|
7050 |
|
---|
7051 | def setUser(self, user):
|
---|
7052 | """Set the user part of an URI. """
|
---|
7053 | libxml2mod.xmlURISetUser(self._o, user)
|
---|
7054 |
|
---|
7055 | def user(self):
|
---|
7056 | """Get the user part from an URI """
|
---|
7057 | ret = libxml2mod.xmlURIGetUser(self._o)
|
---|
7058 | return ret
|
---|
7059 |
|
---|
7060 | #
|
---|
7061 | # URI functions from module uri
|
---|
7062 | #
|
---|
7063 |
|
---|
7064 | def parseURIReference(self, str):
|
---|
7065 | """Parse an URI reference string based on RFC 3986 and fills
|
---|
7066 | in the appropriate fields of the @uri structure
|
---|
7067 | URI-reference = URI / relative-ref """
|
---|
7068 | ret = libxml2mod.xmlParseURIReference(self._o, str)
|
---|
7069 | return ret
|
---|
7070 |
|
---|
7071 | def printURI(self, stream):
|
---|
7072 | """Prints the URI in the stream @stream. """
|
---|
7073 | libxml2mod.xmlPrintURI(stream, self._o)
|
---|
7074 |
|
---|
7075 | def saveUri(self):
|
---|
7076 | """Save the URI as an escaped string """
|
---|
7077 | ret = libxml2mod.xmlSaveUri(self._o)
|
---|
7078 | return ret
|
---|
7079 |
|
---|
7080 | class ValidCtxt(ValidCtxtCore):
|
---|
7081 | def __init__(self, _obj=None):
|
---|
7082 | self._o = _obj
|
---|
7083 | ValidCtxtCore.__init__(self, _obj=_obj)
|
---|
7084 |
|
---|
7085 | def __del__(self):
|
---|
7086 | if self._o != None:
|
---|
7087 | libxml2mod.xmlFreeValidCtxt(self._o)
|
---|
7088 | self._o = None
|
---|
7089 |
|
---|
7090 | #
|
---|
7091 | # ValidCtxt functions from module valid
|
---|
7092 | #
|
---|
7093 |
|
---|
7094 | def validCtxtNormalizeAttributeValue(self, doc, elem, name, value):
|
---|
7095 | """Does the validation related extra step of the normalization
|
---|
7096 | of attribute values: If the declared value is not CDATA,
|
---|
7097 | then the XML processor must further process the normalized
|
---|
7098 | attribute value by discarding any leading and trailing
|
---|
7099 | space (#x20) characters, and by replacing sequences of
|
---|
7100 | space (#x20) characters by single space (#x20) character.
|
---|
7101 | Also check VC: Standalone Document Declaration in P32, and
|
---|
7102 | update ctxt->valid accordingly """
|
---|
7103 | if doc is None: doc__o = None
|
---|
7104 | else: doc__o = doc._o
|
---|
7105 | if elem is None: elem__o = None
|
---|
7106 | else: elem__o = elem._o
|
---|
7107 | ret = libxml2mod.xmlValidCtxtNormalizeAttributeValue(self._o, doc__o, elem__o, name, value)
|
---|
7108 | return ret
|
---|
7109 |
|
---|
7110 | def validateDocument(self, doc):
|
---|
7111 | """Try to validate the document instance basically it does
|
---|
7112 | the all the checks described by the XML Rec i.e. validates
|
---|
7113 | the internal and external subset (if present) and validate
|
---|
7114 | the document tree. """
|
---|
7115 | if doc is None: doc__o = None
|
---|
7116 | else: doc__o = doc._o
|
---|
7117 | ret = libxml2mod.xmlValidateDocument(self._o, doc__o)
|
---|
7118 | return ret
|
---|
7119 |
|
---|
7120 | def validateDocumentFinal(self, doc):
|
---|
7121 | """Does the final step for the document validation once all
|
---|
7122 | the incremental validation steps have been completed
|
---|
7123 | basically it does the following checks described by the XML
|
---|
7124 | Rec Check all the IDREF/IDREFS attributes definition for
|
---|
7125 | validity """
|
---|
7126 | if doc is None: doc__o = None
|
---|
7127 | else: doc__o = doc._o
|
---|
7128 | ret = libxml2mod.xmlValidateDocumentFinal(self._o, doc__o)
|
---|
7129 | return ret
|
---|
7130 |
|
---|
7131 | def validateDtd(self, doc, dtd):
|
---|
7132 | """Try to validate the document against the dtd instance
|
---|
7133 | Basically it does check all the definitions in the DtD.
|
---|
7134 | Note the the internal subset (if present) is de-coupled
|
---|
7135 | (i.e. not used), which could give problems if ID or IDREF
|
---|
7136 | is present. """
|
---|
7137 | if doc is None: doc__o = None
|
---|
7138 | else: doc__o = doc._o
|
---|
7139 | if dtd is None: dtd__o = None
|
---|
7140 | else: dtd__o = dtd._o
|
---|
7141 | ret = libxml2mod.xmlValidateDtd(self._o, doc__o, dtd__o)
|
---|
7142 | return ret
|
---|
7143 |
|
---|
7144 | def validateDtdFinal(self, doc):
|
---|
7145 | """Does the final step for the dtds validation once all the
|
---|
7146 | subsets have been parsed basically it does the following
|
---|
7147 | checks described by the XML Rec - check that ENTITY and
|
---|
7148 | ENTITIES type attributes default or possible values matches
|
---|
7149 | one of the defined entities. - check that NOTATION type
|
---|
7150 | attributes default or possible values matches one of the
|
---|
7151 | defined notations. """
|
---|
7152 | if doc is None: doc__o = None
|
---|
7153 | else: doc__o = doc._o
|
---|
7154 | ret = libxml2mod.xmlValidateDtdFinal(self._o, doc__o)
|
---|
7155 | return ret
|
---|
7156 |
|
---|
7157 | def validateElement(self, doc, elem):
|
---|
7158 | """Try to validate the subtree under an element """
|
---|
7159 | if doc is None: doc__o = None
|
---|
7160 | else: doc__o = doc._o
|
---|
7161 | if elem is None: elem__o = None
|
---|
7162 | else: elem__o = elem._o
|
---|
7163 | ret = libxml2mod.xmlValidateElement(self._o, doc__o, elem__o)
|
---|
7164 | return ret
|
---|
7165 |
|
---|
7166 | def validateNotationUse(self, doc, notationName):
|
---|
7167 | """Validate that the given name match a notation declaration.
|
---|
7168 | - [ VC: Notation Declared ] """
|
---|
7169 | if doc is None: doc__o = None
|
---|
7170 | else: doc__o = doc._o
|
---|
7171 | ret = libxml2mod.xmlValidateNotationUse(self._o, doc__o, notationName)
|
---|
7172 | return ret
|
---|
7173 |
|
---|
7174 | def validateOneAttribute(self, doc, elem, attr, value):
|
---|
7175 | """Try to validate a single attribute for an element basically
|
---|
7176 | it does the following checks as described by the XML-1.0
|
---|
7177 | recommendation: - [ VC: Attribute Value Type ] - [ VC:
|
---|
7178 | Fixed Attribute Default ] - [ VC: Entity Name ] - [ VC:
|
---|
7179 | Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC: Entity
|
---|
7180 | Name ] - [ VC: Notation Attributes ] The ID/IDREF
|
---|
7181 | uniqueness and matching are done separately """
|
---|
7182 | if doc is None: doc__o = None
|
---|
7183 | else: doc__o = doc._o
|
---|
7184 | if elem is None: elem__o = None
|
---|
7185 | else: elem__o = elem._o
|
---|
7186 | if attr is None: attr__o = None
|
---|
7187 | else: attr__o = attr._o
|
---|
7188 | ret = libxml2mod.xmlValidateOneAttribute(self._o, doc__o, elem__o, attr__o, value)
|
---|
7189 | return ret
|
---|
7190 |
|
---|
7191 | def validateOneElement(self, doc, elem):
|
---|
7192 | """Try to validate a single element and it's attributes,
|
---|
7193 | basically it does the following checks as described by the
|
---|
7194 | XML-1.0 recommendation: - [ VC: Element Valid ] - [ VC:
|
---|
7195 | Required Attribute ] Then call xmlValidateOneAttribute()
|
---|
7196 | for each attribute present. The ID/IDREF checkings are
|
---|
7197 | done separately """
|
---|
7198 | if doc is None: doc__o = None
|
---|
7199 | else: doc__o = doc._o
|
---|
7200 | if elem is None: elem__o = None
|
---|
7201 | else: elem__o = elem._o
|
---|
7202 | ret = libxml2mod.xmlValidateOneElement(self._o, doc__o, elem__o)
|
---|
7203 | return ret
|
---|
7204 |
|
---|
7205 | def validateOneNamespace(self, doc, elem, prefix, ns, value):
|
---|
7206 | """Try to validate a single namespace declaration for an
|
---|
7207 | element basically it does the following checks as described
|
---|
7208 | by the XML-1.0 recommendation: - [ VC: Attribute Value Type
|
---|
7209 | ] - [ VC: Fixed Attribute Default ] - [ VC: Entity Name ] -
|
---|
7210 | [ VC: Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC:
|
---|
7211 | Entity Name ] - [ VC: Notation Attributes ] The ID/IDREF
|
---|
7212 | uniqueness and matching are done separately """
|
---|
7213 | if doc is None: doc__o = None
|
---|
7214 | else: doc__o = doc._o
|
---|
7215 | if elem is None: elem__o = None
|
---|
7216 | else: elem__o = elem._o
|
---|
7217 | if ns is None: ns__o = None
|
---|
7218 | else: ns__o = ns._o
|
---|
7219 | ret = libxml2mod.xmlValidateOneNamespace(self._o, doc__o, elem__o, prefix, ns__o, value)
|
---|
7220 | return ret
|
---|
7221 |
|
---|
7222 | def validatePopElement(self, doc, elem, qname):
|
---|
7223 | """Pop the element end from the validation stack. """
|
---|
7224 | if doc is None: doc__o = None
|
---|
7225 | else: doc__o = doc._o
|
---|
7226 | if elem is None: elem__o = None
|
---|
7227 | else: elem__o = elem._o
|
---|
7228 | ret = libxml2mod.xmlValidatePopElement(self._o, doc__o, elem__o, qname)
|
---|
7229 | return ret
|
---|
7230 |
|
---|
7231 | def validatePushCData(self, data, len):
|
---|
7232 | """check the CData parsed for validation in the current stack """
|
---|
7233 | ret = libxml2mod.xmlValidatePushCData(self._o, data, len)
|
---|
7234 | return ret
|
---|
7235 |
|
---|
7236 | def validatePushElement(self, doc, elem, qname):
|
---|
7237 | """Push a new element start on the validation stack. """
|
---|
7238 | if doc is None: doc__o = None
|
---|
7239 | else: doc__o = doc._o
|
---|
7240 | if elem is None: elem__o = None
|
---|
7241 | else: elem__o = elem._o
|
---|
7242 | ret = libxml2mod.xmlValidatePushElement(self._o, doc__o, elem__o, qname)
|
---|
7243 | return ret
|
---|
7244 |
|
---|
7245 | def validateRoot(self, doc):
|
---|
7246 | """Try to validate a the root element basically it does the
|
---|
7247 | following check as described by the XML-1.0 recommendation:
|
---|
7248 | - [ VC: Root Element Type ] it doesn't try to recurse or
|
---|
7249 | apply other check to the element """
|
---|
7250 | if doc is None: doc__o = None
|
---|
7251 | else: doc__o = doc._o
|
---|
7252 | ret = libxml2mod.xmlValidateRoot(self._o, doc__o)
|
---|
7253 | return ret
|
---|
7254 |
|
---|
7255 | class xpathContext:
|
---|
7256 | def __init__(self, _obj=None):
|
---|
7257 | if _obj != None:self._o = _obj;return
|
---|
7258 | self._o = None
|
---|
7259 |
|
---|
7260 | # accessors for xpathContext
|
---|
7261 | def contextDoc(self):
|
---|
7262 | """Get the doc from an xpathContext """
|
---|
7263 | ret = libxml2mod.xmlXPathGetContextDoc(self._o)
|
---|
7264 | if ret is None:raise xpathError('xmlXPathGetContextDoc() failed')
|
---|
7265 | __tmp = xmlDoc(_obj=ret)
|
---|
7266 | return __tmp
|
---|
7267 |
|
---|
7268 | def contextNode(self):
|
---|
7269 | """Get the current node from an xpathContext """
|
---|
7270 | ret = libxml2mod.xmlXPathGetContextNode(self._o)
|
---|
7271 | if ret is None:raise xpathError('xmlXPathGetContextNode() failed')
|
---|
7272 | __tmp = xmlNode(_obj=ret)
|
---|
7273 | return __tmp
|
---|
7274 |
|
---|
7275 | def contextPosition(self):
|
---|
7276 | """Get the current node from an xpathContext """
|
---|
7277 | ret = libxml2mod.xmlXPathGetContextPosition(self._o)
|
---|
7278 | return ret
|
---|
7279 |
|
---|
7280 | def contextSize(self):
|
---|
7281 | """Get the current node from an xpathContext """
|
---|
7282 | ret = libxml2mod.xmlXPathGetContextSize(self._o)
|
---|
7283 | return ret
|
---|
7284 |
|
---|
7285 | def function(self):
|
---|
7286 | """Get the current function name xpathContext """
|
---|
7287 | ret = libxml2mod.xmlXPathGetFunction(self._o)
|
---|
7288 | return ret
|
---|
7289 |
|
---|
7290 | def functionURI(self):
|
---|
7291 | """Get the current function name URI xpathContext """
|
---|
7292 | ret = libxml2mod.xmlXPathGetFunctionURI(self._o)
|
---|
7293 | return ret
|
---|
7294 |
|
---|
7295 | def setContextDoc(self, doc):
|
---|
7296 | """Set the doc of an xpathContext """
|
---|
7297 | if doc is None: doc__o = None
|
---|
7298 | else: doc__o = doc._o
|
---|
7299 | libxml2mod.xmlXPathSetContextDoc(self._o, doc__o)
|
---|
7300 |
|
---|
7301 | def setContextNode(self, node):
|
---|
7302 | """Set the current node of an xpathContext """
|
---|
7303 | if node is None: node__o = None
|
---|
7304 | else: node__o = node._o
|
---|
7305 | libxml2mod.xmlXPathSetContextNode(self._o, node__o)
|
---|
7306 |
|
---|
7307 | #
|
---|
7308 | # xpathContext functions from module python
|
---|
7309 | #
|
---|
7310 |
|
---|
7311 | def registerXPathFunction(self, name, ns_uri, f):
|
---|
7312 | """Register a Python written function to the XPath interpreter """
|
---|
7313 | ret = libxml2mod.xmlRegisterXPathFunction(self._o, name, ns_uri, f)
|
---|
7314 | return ret
|
---|
7315 |
|
---|
7316 | def xpathRegisterVariable(self, name, ns_uri, value):
|
---|
7317 | """Register a variable with the XPath context """
|
---|
7318 | ret = libxml2mod.xmlXPathRegisterVariable(self._o, name, ns_uri, value)
|
---|
7319 | return ret
|
---|
7320 |
|
---|
7321 | #
|
---|
7322 | # xpathContext functions from module xpath
|
---|
7323 | #
|
---|
7324 |
|
---|
7325 | def xpathContextSetCache(self, active, value, options):
|
---|
7326 | """Creates/frees an object cache on the XPath context. If
|
---|
7327 | activates XPath objects (xmlXPathObject) will be cached
|
---|
7328 | internally to be reused. @options: 0: This will set the
|
---|
7329 | XPath object caching: @value: This will set the maximum
|
---|
7330 | number of XPath objects to be cached per slot There are 5
|
---|
7331 | slots for: node-set, string, number, boolean, and misc
|
---|
7332 | objects. Use <0 for the default number (100). Other values
|
---|
7333 | for @options have currently no effect. """
|
---|
7334 | ret = libxml2mod.xmlXPathContextSetCache(self._o, active, value, options)
|
---|
7335 | return ret
|
---|
7336 |
|
---|
7337 | def xpathEval(self, str):
|
---|
7338 | """Evaluate the XPath Location Path in the given context. """
|
---|
7339 | ret = libxml2mod.xmlXPathEval(str, self._o)
|
---|
7340 | if ret is None:raise xpathError('xmlXPathEval() failed')
|
---|
7341 | return xpathObjectRet(ret)
|
---|
7342 |
|
---|
7343 | def xpathEvalExpression(self, str):
|
---|
7344 | """Evaluate the XPath expression in the given context. """
|
---|
7345 | ret = libxml2mod.xmlXPathEvalExpression(str, self._o)
|
---|
7346 | if ret is None:raise xpathError('xmlXPathEvalExpression() failed')
|
---|
7347 | return xpathObjectRet(ret)
|
---|
7348 |
|
---|
7349 | def xpathFreeContext(self):
|
---|
7350 | """Free up an xmlXPathContext """
|
---|
7351 | libxml2mod.xmlXPathFreeContext(self._o)
|
---|
7352 |
|
---|
7353 | #
|
---|
7354 | # xpathContext functions from module xpathInternals
|
---|
7355 | #
|
---|
7356 |
|
---|
7357 | def xpathNewParserContext(self, str):
|
---|
7358 | """Create a new xmlXPathParserContext """
|
---|
7359 | ret = libxml2mod.xmlXPathNewParserContext(str, self._o)
|
---|
7360 | if ret is None:raise xpathError('xmlXPathNewParserContext() failed')
|
---|
7361 | __tmp = xpathParserContext(_obj=ret)
|
---|
7362 | return __tmp
|
---|
7363 |
|
---|
7364 | def xpathNsLookup(self, prefix):
|
---|
7365 | """Search in the namespace declaration array of the context
|
---|
7366 | for the given namespace name associated to the given prefix """
|
---|
7367 | ret = libxml2mod.xmlXPathNsLookup(self._o, prefix)
|
---|
7368 | return ret
|
---|
7369 |
|
---|
7370 | def xpathRegisterAllFunctions(self):
|
---|
7371 | """Registers all default XPath functions in this context """
|
---|
7372 | libxml2mod.xmlXPathRegisterAllFunctions(self._o)
|
---|
7373 |
|
---|
7374 | def xpathRegisterNs(self, prefix, ns_uri):
|
---|
7375 | """Register a new namespace. If @ns_uri is None it unregisters
|
---|
7376 | the namespace """
|
---|
7377 | ret = libxml2mod.xmlXPathRegisterNs(self._o, prefix, ns_uri)
|
---|
7378 | return ret
|
---|
7379 |
|
---|
7380 | def xpathRegisteredFuncsCleanup(self):
|
---|
7381 | """Cleanup the XPath context data associated to registered
|
---|
7382 | functions """
|
---|
7383 | libxml2mod.xmlXPathRegisteredFuncsCleanup(self._o)
|
---|
7384 |
|
---|
7385 | def xpathRegisteredNsCleanup(self):
|
---|
7386 | """Cleanup the XPath context data associated to registered
|
---|
7387 | variables """
|
---|
7388 | libxml2mod.xmlXPathRegisteredNsCleanup(self._o)
|
---|
7389 |
|
---|
7390 | def xpathRegisteredVariablesCleanup(self):
|
---|
7391 | """Cleanup the XPath context data associated to registered
|
---|
7392 | variables """
|
---|
7393 | libxml2mod.xmlXPathRegisteredVariablesCleanup(self._o)
|
---|
7394 |
|
---|
7395 | def xpathVariableLookup(self, name):
|
---|
7396 | """Search in the Variable array of the context for the given
|
---|
7397 | variable value. """
|
---|
7398 | ret = libxml2mod.xmlXPathVariableLookup(self._o, name)
|
---|
7399 | if ret is None:raise xpathError('xmlXPathVariableLookup() failed')
|
---|
7400 | return xpathObjectRet(ret)
|
---|
7401 |
|
---|
7402 | def xpathVariableLookupNS(self, name, ns_uri):
|
---|
7403 | """Search in the Variable array of the context for the given
|
---|
7404 | variable value. """
|
---|
7405 | ret = libxml2mod.xmlXPathVariableLookupNS(self._o, name, ns_uri)
|
---|
7406 | if ret is None:raise xpathError('xmlXPathVariableLookupNS() failed')
|
---|
7407 | return xpathObjectRet(ret)
|
---|
7408 |
|
---|
7409 | #
|
---|
7410 | # xpathContext functions from module xpointer
|
---|
7411 | #
|
---|
7412 |
|
---|
7413 | def xpointerEval(self, str):
|
---|
7414 | """Evaluate the XPath Location Path in the given context. """
|
---|
7415 | ret = libxml2mod.xmlXPtrEval(str, self._o)
|
---|
7416 | if ret is None:raise treeError('xmlXPtrEval() failed')
|
---|
7417 | return xpathObjectRet(ret)
|
---|
7418 |
|
---|
7419 | class xpathParserContext:
|
---|
7420 | def __init__(self, _obj=None):
|
---|
7421 | if _obj != None:self._o = _obj;return
|
---|
7422 | self._o = None
|
---|
7423 |
|
---|
7424 | # accessors for xpathParserContext
|
---|
7425 | def context(self):
|
---|
7426 | """Get the xpathContext from an xpathParserContext """
|
---|
7427 | ret = libxml2mod.xmlXPathParserGetContext(self._o)
|
---|
7428 | if ret is None:raise xpathError('xmlXPathParserGetContext() failed')
|
---|
7429 | __tmp = xpathContext(_obj=ret)
|
---|
7430 | return __tmp
|
---|
7431 |
|
---|
7432 | #
|
---|
7433 | # xpathParserContext functions from module xpathInternals
|
---|
7434 | #
|
---|
7435 |
|
---|
7436 | def xpathAddValues(self):
|
---|
7437 | """Implement the add operation on XPath objects: The numeric
|
---|
7438 | operators convert their operands to numbers as if by
|
---|
7439 | calling the number function. """
|
---|
7440 | libxml2mod.xmlXPathAddValues(self._o)
|
---|
7441 |
|
---|
7442 | def xpathBooleanFunction(self, nargs):
|
---|
7443 | """Implement the boolean() XPath function boolean
|
---|
7444 | boolean(object) The boolean function converts its argument
|
---|
7445 | to a boolean as follows: - a number is true if and only if
|
---|
7446 | it is neither positive or negative zero nor NaN - a
|
---|
7447 | node-set is true if and only if it is non-empty - a string
|
---|
7448 | is true if and only if its length is non-zero """
|
---|
7449 | libxml2mod.xmlXPathBooleanFunction(self._o, nargs)
|
---|
7450 |
|
---|
7451 | def xpathCeilingFunction(self, nargs):
|
---|
7452 | """Implement the ceiling() XPath function number
|
---|
7453 | ceiling(number) The ceiling function returns the smallest
|
---|
7454 | (closest to negative infinity) number that is not less than
|
---|
7455 | the argument and that is an integer. """
|
---|
7456 | libxml2mod.xmlXPathCeilingFunction(self._o, nargs)
|
---|
7457 |
|
---|
7458 | def xpathCompareValues(self, inf, strict):
|
---|
7459 | """Implement the compare operation on XPath objects: @arg1 <
|
---|
7460 | @arg2 (1, 1, ... @arg1 <= @arg2 (1, 0, ... @arg1 >
|
---|
7461 | @arg2 (0, 1, ... @arg1 >= @arg2 (0, 0, ... When
|
---|
7462 | neither object to be compared is a node-set and the
|
---|
7463 | operator is <=, <, >=, >, then the objects are compared by
|
---|
7464 | converted both objects to numbers and comparing the numbers
|
---|
7465 | according to IEEE 754. The < comparison will be true if and
|
---|
7466 | only if the first number is less than the second number.
|
---|
7467 | The <= comparison will be true if and only if the first
|
---|
7468 | number is less than or equal to the second number. The >
|
---|
7469 | comparison will be true if and only if the first number is
|
---|
7470 | greater than the second number. The >= comparison will be
|
---|
7471 | true if and only if the first number is greater than or
|
---|
7472 | equal to the second number. """
|
---|
7473 | ret = libxml2mod.xmlXPathCompareValues(self._o, inf, strict)
|
---|
7474 | return ret
|
---|
7475 |
|
---|
7476 | def xpathConcatFunction(self, nargs):
|
---|
7477 | """Implement the concat() XPath function string concat(string,
|
---|
7478 | string, string*) The concat function returns the
|
---|
7479 | concatenation of its arguments. """
|
---|
7480 | libxml2mod.xmlXPathConcatFunction(self._o, nargs)
|
---|
7481 |
|
---|
7482 | def xpathContainsFunction(self, nargs):
|
---|
7483 | """Implement the contains() XPath function boolean
|
---|
7484 | contains(string, string) The contains function returns true
|
---|
7485 | if the first argument string contains the second argument
|
---|
7486 | string, and otherwise returns false. """
|
---|
7487 | libxml2mod.xmlXPathContainsFunction(self._o, nargs)
|
---|
7488 |
|
---|
7489 | def xpathCountFunction(self, nargs):
|
---|
7490 | """Implement the count() XPath function number count(node-set) """
|
---|
7491 | libxml2mod.xmlXPathCountFunction(self._o, nargs)
|
---|
7492 |
|
---|
7493 | def xpathDivValues(self):
|
---|
7494 | """Implement the div operation on XPath objects @arg1 / @arg2:
|
---|
7495 | The numeric operators convert their operands to numbers as
|
---|
7496 | if by calling the number function. """
|
---|
7497 | libxml2mod.xmlXPathDivValues(self._o)
|
---|
7498 |
|
---|
7499 | def xpathEqualValues(self):
|
---|
7500 | """Implement the equal operation on XPath objects content:
|
---|
7501 | @arg1 == @arg2 """
|
---|
7502 | ret = libxml2mod.xmlXPathEqualValues(self._o)
|
---|
7503 | return ret
|
---|
7504 |
|
---|
7505 | def xpathErr(self, error):
|
---|
7506 | """Handle an XPath error """
|
---|
7507 | libxml2mod.xmlXPathErr(self._o, error)
|
---|
7508 |
|
---|
7509 | def xpathEvalExpr(self):
|
---|
7510 | """Parse and evaluate an XPath expression in the given
|
---|
7511 | context, then push the result on the context stack """
|
---|
7512 | libxml2mod.xmlXPathEvalExpr(self._o)
|
---|
7513 |
|
---|
7514 | def xpathFalseFunction(self, nargs):
|
---|
7515 | """Implement the false() XPath function boolean false() """
|
---|
7516 | libxml2mod.xmlXPathFalseFunction(self._o, nargs)
|
---|
7517 |
|
---|
7518 | def xpathFloorFunction(self, nargs):
|
---|
7519 | """Implement the floor() XPath function number floor(number)
|
---|
7520 | The floor function returns the largest (closest to positive
|
---|
7521 | infinity) number that is not greater than the argument and
|
---|
7522 | that is an integer. """
|
---|
7523 | libxml2mod.xmlXPathFloorFunction(self._o, nargs)
|
---|
7524 |
|
---|
7525 | def xpathFreeParserContext(self):
|
---|
7526 | """Free up an xmlXPathParserContext """
|
---|
7527 | libxml2mod.xmlXPathFreeParserContext(self._o)
|
---|
7528 |
|
---|
7529 | def xpathIdFunction(self, nargs):
|
---|
7530 | """Implement the id() XPath function node-set id(object) The
|
---|
7531 | id function selects elements by their unique ID (see [5.2.1
|
---|
7532 | Unique IDs]). When the argument to id is of type node-set,
|
---|
7533 | then the result is the union of the result of applying id
|
---|
7534 | to the string value of each of the nodes in the argument
|
---|
7535 | node-set. When the argument to id is of any other type, the
|
---|
7536 | argument is converted to a string as if by a call to the
|
---|
7537 | string function; the string is split into a
|
---|
7538 | whitespace-separated list of tokens (whitespace is any
|
---|
7539 | sequence of characters matching the production S); the
|
---|
7540 | result is a node-set containing the elements in the same
|
---|
7541 | document as the context node that have a unique ID equal to
|
---|
7542 | any of the tokens in the list. """
|
---|
7543 | libxml2mod.xmlXPathIdFunction(self._o, nargs)
|
---|
7544 |
|
---|
7545 | def xpathLangFunction(self, nargs):
|
---|
7546 | """Implement the lang() XPath function boolean lang(string)
|
---|
7547 | The lang function returns true or false depending on
|
---|
7548 | whether the language of the context node as specified by
|
---|
7549 | xml:lang attributes is the same as or is a sublanguage of
|
---|
7550 | the language specified by the argument string. The language
|
---|
7551 | of the context node is determined by the value of the
|
---|
7552 | xml:lang attribute on the context node, or, if the context
|
---|
7553 | node has no xml:lang attribute, by the value of the
|
---|
7554 | xml:lang attribute on the nearest ancestor of the context
|
---|
7555 | node that has an xml:lang attribute. If there is no such
|
---|
7556 | attribute, then lang """
|
---|
7557 | libxml2mod.xmlXPathLangFunction(self._o, nargs)
|
---|
7558 |
|
---|
7559 | def xpathLastFunction(self, nargs):
|
---|
7560 | """Implement the last() XPath function number last() The last
|
---|
7561 | function returns the number of nodes in the context node
|
---|
7562 | list. """
|
---|
7563 | libxml2mod.xmlXPathLastFunction(self._o, nargs)
|
---|
7564 |
|
---|
7565 | def xpathLocalNameFunction(self, nargs):
|
---|
7566 | """Implement the local-name() XPath function string
|
---|
7567 | local-name(node-set?) The local-name function returns a
|
---|
7568 | string containing the local part of the name of the node in
|
---|
7569 | the argument node-set that is first in document order. If
|
---|
7570 | the node-set is empty or the first node has no name, an
|
---|
7571 | empty string is returned. If the argument is omitted it
|
---|
7572 | defaults to the context node. """
|
---|
7573 | libxml2mod.xmlXPathLocalNameFunction(self._o, nargs)
|
---|
7574 |
|
---|
7575 | def xpathModValues(self):
|
---|
7576 | """Implement the mod operation on XPath objects: @arg1 / @arg2
|
---|
7577 | The numeric operators convert their operands to numbers as
|
---|
7578 | if by calling the number function. """
|
---|
7579 | libxml2mod.xmlXPathModValues(self._o)
|
---|
7580 |
|
---|
7581 | def xpathMultValues(self):
|
---|
7582 | """Implement the multiply operation on XPath objects: The
|
---|
7583 | numeric operators convert their operands to numbers as if
|
---|
7584 | by calling the number function. """
|
---|
7585 | libxml2mod.xmlXPathMultValues(self._o)
|
---|
7586 |
|
---|
7587 | def xpathNamespaceURIFunction(self, nargs):
|
---|
7588 | """Implement the namespace-uri() XPath function string
|
---|
7589 | namespace-uri(node-set?) The namespace-uri function returns
|
---|
7590 | a string containing the namespace URI of the expanded name
|
---|
7591 | of the node in the argument node-set that is first in
|
---|
7592 | document order. If the node-set is empty, the first node
|
---|
7593 | has no name, or the expanded name has no namespace URI, an
|
---|
7594 | empty string is returned. If the argument is omitted it
|
---|
7595 | defaults to the context node. """
|
---|
7596 | libxml2mod.xmlXPathNamespaceURIFunction(self._o, nargs)
|
---|
7597 |
|
---|
7598 | def xpathNextAncestor(self, cur):
|
---|
7599 | """Traversal function for the "ancestor" direction the
|
---|
7600 | ancestor axis contains the ancestors of the context node;
|
---|
7601 | the ancestors of the context node consist of the parent of
|
---|
7602 | context node and the parent's parent and so on; the nodes
|
---|
7603 | are ordered in reverse document order; thus the parent is
|
---|
7604 | the first node on the axis, and the parent's parent is the
|
---|
7605 | second node on the axis """
|
---|
7606 | if cur is None: cur__o = None
|
---|
7607 | else: cur__o = cur._o
|
---|
7608 | ret = libxml2mod.xmlXPathNextAncestor(self._o, cur__o)
|
---|
7609 | if ret is None:raise xpathError('xmlXPathNextAncestor() failed')
|
---|
7610 | __tmp = xmlNode(_obj=ret)
|
---|
7611 | return __tmp
|
---|
7612 |
|
---|
7613 | def xpathNextAncestorOrSelf(self, cur):
|
---|
7614 | """Traversal function for the "ancestor-or-self" direction he
|
---|
7615 | ancestor-or-self axis contains the context node and
|
---|
7616 | ancestors of the context node in reverse document order;
|
---|
7617 | thus the context node is the first node on the axis, and
|
---|
7618 | the context node's parent the second; parent here is
|
---|
7619 | defined the same as with the parent axis. """
|
---|
7620 | if cur is None: cur__o = None
|
---|
7621 | else: cur__o = cur._o
|
---|
7622 | ret = libxml2mod.xmlXPathNextAncestorOrSelf(self._o, cur__o)
|
---|
7623 | if ret is None:raise xpathError('xmlXPathNextAncestorOrSelf() failed')
|
---|
7624 | __tmp = xmlNode(_obj=ret)
|
---|
7625 | return __tmp
|
---|
7626 |
|
---|
7627 | def xpathNextAttribute(self, cur):
|
---|
7628 | """Traversal function for the "attribute" direction TODO:
|
---|
7629 | support DTD inherited default attributes """
|
---|
7630 | if cur is None: cur__o = None
|
---|
7631 | else: cur__o = cur._o
|
---|
7632 | ret = libxml2mod.xmlXPathNextAttribute(self._o, cur__o)
|
---|
7633 | if ret is None:raise xpathError('xmlXPathNextAttribute() failed')
|
---|
7634 | __tmp = xmlNode(_obj=ret)
|
---|
7635 | return __tmp
|
---|
7636 |
|
---|
7637 | def xpathNextChild(self, cur):
|
---|
7638 | """Traversal function for the "child" direction The child axis
|
---|
7639 | contains the children of the context node in document order. """
|
---|
7640 | if cur is None: cur__o = None
|
---|
7641 | else: cur__o = cur._o
|
---|
7642 | ret = libxml2mod.xmlXPathNextChild(self._o, cur__o)
|
---|
7643 | if ret is None:raise xpathError('xmlXPathNextChild() failed')
|
---|
7644 | __tmp = xmlNode(_obj=ret)
|
---|
7645 | return __tmp
|
---|
7646 |
|
---|
7647 | def xpathNextDescendant(self, cur):
|
---|
7648 | """Traversal function for the "descendant" direction the
|
---|
7649 | descendant axis contains the descendants of the context
|
---|
7650 | node in document order; a descendant is a child or a child
|
---|
7651 | of a child and so on. """
|
---|
7652 | if cur is None: cur__o = None
|
---|
7653 | else: cur__o = cur._o
|
---|
7654 | ret = libxml2mod.xmlXPathNextDescendant(self._o, cur__o)
|
---|
7655 | if ret is None:raise xpathError('xmlXPathNextDescendant() failed')
|
---|
7656 | __tmp = xmlNode(_obj=ret)
|
---|
7657 | return __tmp
|
---|
7658 |
|
---|
7659 | def xpathNextDescendantOrSelf(self, cur):
|
---|
7660 | """Traversal function for the "descendant-or-self" direction
|
---|
7661 | the descendant-or-self axis contains the context node and
|
---|
7662 | the descendants of the context node in document order; thus
|
---|
7663 | the context node is the first node on the axis, and the
|
---|
7664 | first child of the context node is the second node on the
|
---|
7665 | axis """
|
---|
7666 | if cur is None: cur__o = None
|
---|
7667 | else: cur__o = cur._o
|
---|
7668 | ret = libxml2mod.xmlXPathNextDescendantOrSelf(self._o, cur__o)
|
---|
7669 | if ret is None:raise xpathError('xmlXPathNextDescendantOrSelf() failed')
|
---|
7670 | __tmp = xmlNode(_obj=ret)
|
---|
7671 | return __tmp
|
---|
7672 |
|
---|
7673 | def xpathNextFollowing(self, cur):
|
---|
7674 | """Traversal function for the "following" direction The
|
---|
7675 | following axis contains all nodes in the same document as
|
---|
7676 | the context node that are after the context node in
|
---|
7677 | document order, excluding any descendants and excluding
|
---|
7678 | attribute nodes and namespace nodes; the nodes are ordered
|
---|
7679 | in document order """
|
---|
7680 | if cur is None: cur__o = None
|
---|
7681 | else: cur__o = cur._o
|
---|
7682 | ret = libxml2mod.xmlXPathNextFollowing(self._o, cur__o)
|
---|
7683 | if ret is None:raise xpathError('xmlXPathNextFollowing() failed')
|
---|
7684 | __tmp = xmlNode(_obj=ret)
|
---|
7685 | return __tmp
|
---|
7686 |
|
---|
7687 | def xpathNextFollowingSibling(self, cur):
|
---|
7688 | """Traversal function for the "following-sibling" direction
|
---|
7689 | The following-sibling axis contains the following siblings
|
---|
7690 | of the context node in document order. """
|
---|
7691 | if cur is None: cur__o = None
|
---|
7692 | else: cur__o = cur._o
|
---|
7693 | ret = libxml2mod.xmlXPathNextFollowingSibling(self._o, cur__o)
|
---|
7694 | if ret is None:raise xpathError('xmlXPathNextFollowingSibling() failed')
|
---|
7695 | __tmp = xmlNode(_obj=ret)
|
---|
7696 | return __tmp
|
---|
7697 |
|
---|
7698 | def xpathNextNamespace(self, cur):
|
---|
7699 | """Traversal function for the "namespace" direction the
|
---|
7700 | namespace axis contains the namespace nodes of the context
|
---|
7701 | node; the order of nodes on this axis is
|
---|
7702 | implementation-defined; the axis will be empty unless the
|
---|
7703 | context node is an element We keep the XML namespace node
|
---|
7704 | at the end of the list. """
|
---|
7705 | if cur is None: cur__o = None
|
---|
7706 | else: cur__o = cur._o
|
---|
7707 | ret = libxml2mod.xmlXPathNextNamespace(self._o, cur__o)
|
---|
7708 | if ret is None:raise xpathError('xmlXPathNextNamespace() failed')
|
---|
7709 | __tmp = xmlNode(_obj=ret)
|
---|
7710 | return __tmp
|
---|
7711 |
|
---|
7712 | def xpathNextParent(self, cur):
|
---|
7713 | """Traversal function for the "parent" direction The parent
|
---|
7714 | axis contains the parent of the context node, if there is
|
---|
7715 | one. """
|
---|
7716 | if cur is None: cur__o = None
|
---|
7717 | else: cur__o = cur._o
|
---|
7718 | ret = libxml2mod.xmlXPathNextParent(self._o, cur__o)
|
---|
7719 | if ret is None:raise xpathError('xmlXPathNextParent() failed')
|
---|
7720 | __tmp = xmlNode(_obj=ret)
|
---|
7721 | return __tmp
|
---|
7722 |
|
---|
7723 | def xpathNextPreceding(self, cur):
|
---|
7724 | """Traversal function for the "preceding" direction the
|
---|
7725 | preceding axis contains all nodes in the same document as
|
---|
7726 | the context node that are before the context node in
|
---|
7727 | document order, excluding any ancestors and excluding
|
---|
7728 | attribute nodes and namespace nodes; the nodes are ordered
|
---|
7729 | in reverse document order """
|
---|
7730 | if cur is None: cur__o = None
|
---|
7731 | else: cur__o = cur._o
|
---|
7732 | ret = libxml2mod.xmlXPathNextPreceding(self._o, cur__o)
|
---|
7733 | if ret is None:raise xpathError('xmlXPathNextPreceding() failed')
|
---|
7734 | __tmp = xmlNode(_obj=ret)
|
---|
7735 | return __tmp
|
---|
7736 |
|
---|
7737 | def xpathNextPrecedingSibling(self, cur):
|
---|
7738 | """Traversal function for the "preceding-sibling" direction
|
---|
7739 | The preceding-sibling axis contains the preceding siblings
|
---|
7740 | of the context node in reverse document order; the first
|
---|
7741 | preceding sibling is first on the axis; the sibling
|
---|
7742 | preceding that node is the second on the axis and so on. """
|
---|
7743 | if cur is None: cur__o = None
|
---|
7744 | else: cur__o = cur._o
|
---|
7745 | ret = libxml2mod.xmlXPathNextPrecedingSibling(self._o, cur__o)
|
---|
7746 | if ret is None:raise xpathError('xmlXPathNextPrecedingSibling() failed')
|
---|
7747 | __tmp = xmlNode(_obj=ret)
|
---|
7748 | return __tmp
|
---|
7749 |
|
---|
7750 | def xpathNextSelf(self, cur):
|
---|
7751 | """Traversal function for the "self" direction The self axis
|
---|
7752 | contains just the context node itself """
|
---|
7753 | if cur is None: cur__o = None
|
---|
7754 | else: cur__o = cur._o
|
---|
7755 | ret = libxml2mod.xmlXPathNextSelf(self._o, cur__o)
|
---|
7756 | if ret is None:raise xpathError('xmlXPathNextSelf() failed')
|
---|
7757 | __tmp = xmlNode(_obj=ret)
|
---|
7758 | return __tmp
|
---|
7759 |
|
---|
7760 | def xpathNormalizeFunction(self, nargs):
|
---|
7761 | """Implement the normalize-space() XPath function string
|
---|
7762 | normalize-space(string?) The normalize-space function
|
---|
7763 | returns the argument string with white space normalized by
|
---|
7764 | stripping leading and trailing whitespace and replacing
|
---|
7765 | sequences of whitespace characters by a single space.
|
---|
7766 | Whitespace characters are the same allowed by the S
|
---|
7767 | production in XML. If the argument is omitted, it defaults
|
---|
7768 | to the context node converted to a string, in other words
|
---|
7769 | the value of the context node. """
|
---|
7770 | libxml2mod.xmlXPathNormalizeFunction(self._o, nargs)
|
---|
7771 |
|
---|
7772 | def xpathNotEqualValues(self):
|
---|
7773 | """Implement the equal operation on XPath objects content:
|
---|
7774 | @arg1 == @arg2 """
|
---|
7775 | ret = libxml2mod.xmlXPathNotEqualValues(self._o)
|
---|
7776 | return ret
|
---|
7777 |
|
---|
7778 | def xpathNotFunction(self, nargs):
|
---|
7779 | """Implement the not() XPath function boolean not(boolean) The
|
---|
7780 | not function returns true if its argument is false, and
|
---|
7781 | false otherwise. """
|
---|
7782 | libxml2mod.xmlXPathNotFunction(self._o, nargs)
|
---|
7783 |
|
---|
7784 | def xpathNumberFunction(self, nargs):
|
---|
7785 | """Implement the number() XPath function number number(object?) """
|
---|
7786 | libxml2mod.xmlXPathNumberFunction(self._o, nargs)
|
---|
7787 |
|
---|
7788 | def xpathParseNCName(self):
|
---|
7789 | """parse an XML namespace non qualified name. [NS 3] NCName
|
---|
7790 | ::= (Letter | '_') (NCNameChar)* [NS 4] NCNameChar ::=
|
---|
7791 | Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender """
|
---|
7792 | ret = libxml2mod.xmlXPathParseNCName(self._o)
|
---|
7793 | return ret
|
---|
7794 |
|
---|
7795 | def xpathParseName(self):
|
---|
7796 | """parse an XML name [4] NameChar ::= Letter | Digit | '.' |
|
---|
7797 | '-' | '_' | ':' | CombiningChar | Extender [5] Name ::=
|
---|
7798 | (Letter | '_' | ':') (NameChar)* """
|
---|
7799 | ret = libxml2mod.xmlXPathParseName(self._o)
|
---|
7800 | return ret
|
---|
7801 |
|
---|
7802 | def xpathPopBoolean(self):
|
---|
7803 | """Pops a boolean from the stack, handling conversion if
|
---|
7804 | needed. Check error with #xmlXPathCheckError. """
|
---|
7805 | ret = libxml2mod.xmlXPathPopBoolean(self._o)
|
---|
7806 | return ret
|
---|
7807 |
|
---|
7808 | def xpathPopNumber(self):
|
---|
7809 | """Pops a number from the stack, handling conversion if
|
---|
7810 | needed. Check error with #xmlXPathCheckError. """
|
---|
7811 | ret = libxml2mod.xmlXPathPopNumber(self._o)
|
---|
7812 | return ret
|
---|
7813 |
|
---|
7814 | def xpathPopString(self):
|
---|
7815 | """Pops a string from the stack, handling conversion if
|
---|
7816 | needed. Check error with #xmlXPathCheckError. """
|
---|
7817 | ret = libxml2mod.xmlXPathPopString(self._o)
|
---|
7818 | return ret
|
---|
7819 |
|
---|
7820 | def xpathPositionFunction(self, nargs):
|
---|
7821 | """Implement the position() XPath function number position()
|
---|
7822 | The position function returns the position of the context
|
---|
7823 | node in the context node list. The first position is 1, and
|
---|
7824 | so the last position will be equal to last(). """
|
---|
7825 | libxml2mod.xmlXPathPositionFunction(self._o, nargs)
|
---|
7826 |
|
---|
7827 | def xpathRoot(self):
|
---|
7828 | """Initialize the context to the root of the document """
|
---|
7829 | libxml2mod.xmlXPathRoot(self._o)
|
---|
7830 |
|
---|
7831 | def xpathRoundFunction(self, nargs):
|
---|
7832 | """Implement the round() XPath function number round(number)
|
---|
7833 | The round function returns the number that is closest to
|
---|
7834 | the argument and that is an integer. If there are two such
|
---|
7835 | numbers, then the one that is even is returned. """
|
---|
7836 | libxml2mod.xmlXPathRoundFunction(self._o, nargs)
|
---|
7837 |
|
---|
7838 | def xpathStartsWithFunction(self, nargs):
|
---|
7839 | """Implement the starts-with() XPath function boolean
|
---|
7840 | starts-with(string, string) The starts-with function
|
---|
7841 | returns true if the first argument string starts with the
|
---|
7842 | second argument string, and otherwise returns false. """
|
---|
7843 | libxml2mod.xmlXPathStartsWithFunction(self._o, nargs)
|
---|
7844 |
|
---|
7845 | def xpathStringFunction(self, nargs):
|
---|
7846 | """Implement the string() XPath function string
|
---|
7847 | string(object?) The string function converts an object to a
|
---|
7848 | string as follows: - A node-set is converted to a string by
|
---|
7849 | returning the value of the node in the node-set that is
|
---|
7850 | first in document order. If the node-set is empty, an empty
|
---|
7851 | string is returned. - A number is converted to a string as
|
---|
7852 | follows + NaN is converted to the string NaN + positive
|
---|
7853 | zero is converted to the string 0 + negative zero is
|
---|
7854 | converted to the string 0 + positive infinity is converted
|
---|
7855 | to the string Infinity + negative infinity is converted to
|
---|
7856 | the string -Infinity + if the number is an integer, the
|
---|
7857 | number is represented in decimal form as a Number with no
|
---|
7858 | decimal point and no leading zeros, preceded by a minus
|
---|
7859 | sign (-) if the number is negative + otherwise, the number
|
---|
7860 | is represented in decimal form as a Number including a
|
---|
7861 | decimal point with at least one digit before the decimal
|
---|
7862 | point and at least one digit after the decimal point,
|
---|
7863 | preceded by a minus sign (-) if the number is negative;
|
---|
7864 | there must be no leading zeros before the decimal point
|
---|
7865 | apart possibly from the one required digit immediately
|
---|
7866 | before the decimal point; beyond the one required digit
|
---|
7867 | after the decimal point there must be as many, but only as
|
---|
7868 | many, more digits as are needed to uniquely distinguish the
|
---|
7869 | number from all other IEEE 754 numeric values. - The
|
---|
7870 | boolean false value is converted to the string false. The
|
---|
7871 | boolean true value is converted to the string true. If the
|
---|
7872 | argument is omitted, it defaults to a node-set with the
|
---|
7873 | context node as its only member. """
|
---|
7874 | libxml2mod.xmlXPathStringFunction(self._o, nargs)
|
---|
7875 |
|
---|
7876 | def xpathStringLengthFunction(self, nargs):
|
---|
7877 | """Implement the string-length() XPath function number
|
---|
7878 | string-length(string?) The string-length returns the number
|
---|
7879 | of characters in the string (see [3.6 Strings]). If the
|
---|
7880 | argument is omitted, it defaults to the context node
|
---|
7881 | converted to a string, in other words the value of the
|
---|
7882 | context node. """
|
---|
7883 | libxml2mod.xmlXPathStringLengthFunction(self._o, nargs)
|
---|
7884 |
|
---|
7885 | def xpathSubValues(self):
|
---|
7886 | """Implement the subtraction operation on XPath objects: The
|
---|
7887 | numeric operators convert their operands to numbers as if
|
---|
7888 | by calling the number function. """
|
---|
7889 | libxml2mod.xmlXPathSubValues(self._o)
|
---|
7890 |
|
---|
7891 | def xpathSubstringAfterFunction(self, nargs):
|
---|
7892 | """Implement the substring-after() XPath function string
|
---|
7893 | substring-after(string, string) The substring-after
|
---|
7894 | function returns the substring of the first argument string
|
---|
7895 | that follows the first occurrence of the second argument
|
---|
7896 | string in the first argument string, or the empty stringi
|
---|
7897 | if the first argument string does not contain the second
|
---|
7898 | argument string. For example,
|
---|
7899 | substring-after("1999/04/01","/") returns 04/01, and
|
---|
7900 | substring-after("1999/04/01","19") returns 99/04/01. """
|
---|
7901 | libxml2mod.xmlXPathSubstringAfterFunction(self._o, nargs)
|
---|
7902 |
|
---|
7903 | def xpathSubstringBeforeFunction(self, nargs):
|
---|
7904 | """Implement the substring-before() XPath function string
|
---|
7905 | substring-before(string, string) The substring-before
|
---|
7906 | function returns the substring of the first argument string
|
---|
7907 | that precedes the first occurrence of the second argument
|
---|
7908 | string in the first argument string, or the empty string if
|
---|
7909 | the first argument string does not contain the second
|
---|
7910 | argument string. For example,
|
---|
7911 | substring-before("1999/04/01","/") returns 1999. """
|
---|
7912 | libxml2mod.xmlXPathSubstringBeforeFunction(self._o, nargs)
|
---|
7913 |
|
---|
7914 | def xpathSubstringFunction(self, nargs):
|
---|
7915 | """Implement the substring() XPath function string
|
---|
7916 | substring(string, number, number?) The substring function
|
---|
7917 | returns the substring of the first argument starting at the
|
---|
7918 | position specified in the second argument with length
|
---|
7919 | specified in the third argument. For example,
|
---|
7920 | substring("12345",2,3) returns "234". If the third argument
|
---|
7921 | is not specified, it returns the substring starting at the
|
---|
7922 | position specified in the second argument and continuing to
|
---|
7923 | the end of the string. For example, substring("12345",2)
|
---|
7924 | returns "2345". More precisely, each character in the
|
---|
7925 | string (see [3.6 Strings]) is considered to have a numeric
|
---|
7926 | position: the position of the first character is 1, the
|
---|
7927 | position of the second character is 2 and so on. The
|
---|
7928 | returned substring contains those characters for which the
|
---|
7929 | position of the character is greater than or equal to the
|
---|
7930 | second argument and, if the third argument is specified,
|
---|
7931 | less than the sum of the second and third arguments; the
|
---|
7932 | comparisons and addition used for the above follow the
|
---|
7933 | standard IEEE 754 rules. Thus: - substring("12345", 1.5,
|
---|
7934 | 2.6) returns "234" - substring("12345", 0, 3) returns "12"
|
---|
7935 | - substring("12345", 0 div 0, 3) returns "" -
|
---|
7936 | substring("12345", 1, 0 div 0) returns "" -
|
---|
7937 | substring("12345", -42, 1 div 0) returns "12345" -
|
---|
7938 | substring("12345", -1 div 0, 1 div 0) returns "" """
|
---|
7939 | libxml2mod.xmlXPathSubstringFunction(self._o, nargs)
|
---|
7940 |
|
---|
7941 | def xpathSumFunction(self, nargs):
|
---|
7942 | """Implement the sum() XPath function number sum(node-set) The
|
---|
7943 | sum function returns the sum of the values of the nodes in
|
---|
7944 | the argument node-set. """
|
---|
7945 | libxml2mod.xmlXPathSumFunction(self._o, nargs)
|
---|
7946 |
|
---|
7947 | def xpathTranslateFunction(self, nargs):
|
---|
7948 | """Implement the translate() XPath function string
|
---|
7949 | translate(string, string, string) The translate function
|
---|
7950 | returns the first argument string with occurrences of
|
---|
7951 | characters in the second argument string replaced by the
|
---|
7952 | character at the corresponding position in the third
|
---|
7953 | argument string. For example, translate("bar","abc","ABC")
|
---|
7954 | returns the string BAr. If there is a character in the
|
---|
7955 | second argument string with no character at a corresponding
|
---|
7956 | position in the third argument string (because the second
|
---|
7957 | argument string is longer than the third argument string),
|
---|
7958 | then occurrences of that character in the first argument
|
---|
7959 | string are removed. For example,
|
---|
7960 | translate("--aaa--","abc-","ABC") """
|
---|
7961 | libxml2mod.xmlXPathTranslateFunction(self._o, nargs)
|
---|
7962 |
|
---|
7963 | def xpathTrueFunction(self, nargs):
|
---|
7964 | """Implement the true() XPath function boolean true() """
|
---|
7965 | libxml2mod.xmlXPathTrueFunction(self._o, nargs)
|
---|
7966 |
|
---|
7967 | def xpathValueFlipSign(self):
|
---|
7968 | """Implement the unary - operation on an XPath object The
|
---|
7969 | numeric operators convert their operands to numbers as if
|
---|
7970 | by calling the number function. """
|
---|
7971 | libxml2mod.xmlXPathValueFlipSign(self._o)
|
---|
7972 |
|
---|
7973 | def xpatherror(self, file, line, no):
|
---|
7974 | """Formats an error message. """
|
---|
7975 | libxml2mod.xmlXPatherror(self._o, file, line, no)
|
---|
7976 |
|
---|
7977 | #
|
---|
7978 | # xpathParserContext functions from module xpointer
|
---|
7979 | #
|
---|
7980 |
|
---|
7981 | def xpointerEvalRangePredicate(self):
|
---|
7982 | """[8] Predicate ::= '[' PredicateExpr ']' [9]
|
---|
7983 | PredicateExpr ::= Expr Evaluate a predicate as in
|
---|
7984 | xmlXPathEvalPredicate() but for a Location Set instead of a
|
---|
7985 | node set """
|
---|
7986 | libxml2mod.xmlXPtrEvalRangePredicate(self._o)
|
---|
7987 |
|
---|
7988 | def xpointerRangeToFunction(self, nargs):
|
---|
7989 | """Implement the range-to() XPointer function """
|
---|
7990 | libxml2mod.xmlXPtrRangeToFunction(self._o, nargs)
|
---|
7991 |
|
---|
7992 | # xlinkShow
|
---|
7993 | XLINK_SHOW_NONE = 0
|
---|
7994 | XLINK_SHOW_NEW = 1
|
---|
7995 | XLINK_SHOW_EMBED = 2
|
---|
7996 | XLINK_SHOW_REPLACE = 3
|
---|
7997 |
|
---|
7998 | # xmlRelaxNGParserFlag
|
---|
7999 | XML_RELAXNGP_NONE = 0
|
---|
8000 | XML_RELAXNGP_FREE_DOC = 1
|
---|
8001 | XML_RELAXNGP_CRNG = 2
|
---|
8002 |
|
---|
8003 | # xmlBufferAllocationScheme
|
---|
8004 | XML_BUFFER_ALLOC_DOUBLEIT = 1
|
---|
8005 | XML_BUFFER_ALLOC_EXACT = 2
|
---|
8006 | XML_BUFFER_ALLOC_IMMUTABLE = 3
|
---|
8007 | XML_BUFFER_ALLOC_IO = 4
|
---|
8008 | XML_BUFFER_ALLOC_HYBRID = 5
|
---|
8009 |
|
---|
8010 | # xmlParserSeverities
|
---|
8011 | XML_PARSER_SEVERITY_VALIDITY_WARNING = 1
|
---|
8012 | XML_PARSER_SEVERITY_VALIDITY_ERROR = 2
|
---|
8013 | XML_PARSER_SEVERITY_WARNING = 3
|
---|
8014 | XML_PARSER_SEVERITY_ERROR = 4
|
---|
8015 |
|
---|
8016 | # xmlAttributeDefault
|
---|
8017 | XML_ATTRIBUTE_NONE = 1
|
---|
8018 | XML_ATTRIBUTE_REQUIRED = 2
|
---|
8019 | XML_ATTRIBUTE_IMPLIED = 3
|
---|
8020 | XML_ATTRIBUTE_FIXED = 4
|
---|
8021 |
|
---|
8022 | # xmlSchemaValType
|
---|
8023 | XML_SCHEMAS_UNKNOWN = 0
|
---|
8024 | XML_SCHEMAS_STRING = 1
|
---|
8025 | XML_SCHEMAS_NORMSTRING = 2
|
---|
8026 | XML_SCHEMAS_DECIMAL = 3
|
---|
8027 | XML_SCHEMAS_TIME = 4
|
---|
8028 | XML_SCHEMAS_GDAY = 5
|
---|
8029 | XML_SCHEMAS_GMONTH = 6
|
---|
8030 | XML_SCHEMAS_GMONTHDAY = 7
|
---|
8031 | XML_SCHEMAS_GYEAR = 8
|
---|
8032 | XML_SCHEMAS_GYEARMONTH = 9
|
---|
8033 | XML_SCHEMAS_DATE = 10
|
---|
8034 | XML_SCHEMAS_DATETIME = 11
|
---|
8035 | XML_SCHEMAS_DURATION = 12
|
---|
8036 | XML_SCHEMAS_FLOAT = 13
|
---|
8037 | XML_SCHEMAS_DOUBLE = 14
|
---|
8038 | XML_SCHEMAS_BOOLEAN = 15
|
---|
8039 | XML_SCHEMAS_TOKEN = 16
|
---|
8040 | XML_SCHEMAS_LANGUAGE = 17
|
---|
8041 | XML_SCHEMAS_NMTOKEN = 18
|
---|
8042 | XML_SCHEMAS_NMTOKENS = 19
|
---|
8043 | XML_SCHEMAS_NAME = 20
|
---|
8044 | XML_SCHEMAS_QNAME = 21
|
---|
8045 | XML_SCHEMAS_NCNAME = 22
|
---|
8046 | XML_SCHEMAS_ID = 23
|
---|
8047 | XML_SCHEMAS_IDREF = 24
|
---|
8048 | XML_SCHEMAS_IDREFS = 25
|
---|
8049 | XML_SCHEMAS_ENTITY = 26
|
---|
8050 | XML_SCHEMAS_ENTITIES = 27
|
---|
8051 | XML_SCHEMAS_NOTATION = 28
|
---|
8052 | XML_SCHEMAS_ANYURI = 29
|
---|
8053 | XML_SCHEMAS_INTEGER = 30
|
---|
8054 | XML_SCHEMAS_NPINTEGER = 31
|
---|
8055 | XML_SCHEMAS_NINTEGER = 32
|
---|
8056 | XML_SCHEMAS_NNINTEGER = 33
|
---|
8057 | XML_SCHEMAS_PINTEGER = 34
|
---|
8058 | XML_SCHEMAS_INT = 35
|
---|
8059 | XML_SCHEMAS_UINT = 36
|
---|
8060 | XML_SCHEMAS_LONG = 37
|
---|
8061 | XML_SCHEMAS_ULONG = 38
|
---|
8062 | XML_SCHEMAS_SHORT = 39
|
---|
8063 | XML_SCHEMAS_USHORT = 40
|
---|
8064 | XML_SCHEMAS_BYTE = 41
|
---|
8065 | XML_SCHEMAS_UBYTE = 42
|
---|
8066 | XML_SCHEMAS_HEXBINARY = 43
|
---|
8067 | XML_SCHEMAS_BASE64BINARY = 44
|
---|
8068 | XML_SCHEMAS_ANYTYPE = 45
|
---|
8069 | XML_SCHEMAS_ANYSIMPLETYPE = 46
|
---|
8070 |
|
---|
8071 | # xmlParserInputState
|
---|
8072 | XML_PARSER_EOF = -1
|
---|
8073 | XML_PARSER_START = 0
|
---|
8074 | XML_PARSER_MISC = 1
|
---|
8075 | XML_PARSER_PI = 2
|
---|
8076 | XML_PARSER_DTD = 3
|
---|
8077 | XML_PARSER_PROLOG = 4
|
---|
8078 | XML_PARSER_COMMENT = 5
|
---|
8079 | XML_PARSER_START_TAG = 6
|
---|
8080 | XML_PARSER_CONTENT = 7
|
---|
8081 | XML_PARSER_CDATA_SECTION = 8
|
---|
8082 | XML_PARSER_END_TAG = 9
|
---|
8083 | XML_PARSER_ENTITY_DECL = 10
|
---|
8084 | XML_PARSER_ENTITY_VALUE = 11
|
---|
8085 | XML_PARSER_ATTRIBUTE_VALUE = 12
|
---|
8086 | XML_PARSER_SYSTEM_LITERAL = 13
|
---|
8087 | XML_PARSER_EPILOG = 14
|
---|
8088 | XML_PARSER_IGNORE = 15
|
---|
8089 | XML_PARSER_PUBLIC_LITERAL = 16
|
---|
8090 |
|
---|
8091 | # xmlEntityType
|
---|
8092 | XML_INTERNAL_GENERAL_ENTITY = 1
|
---|
8093 | XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2
|
---|
8094 | XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3
|
---|
8095 | XML_INTERNAL_PARAMETER_ENTITY = 4
|
---|
8096 | XML_EXTERNAL_PARAMETER_ENTITY = 5
|
---|
8097 | XML_INTERNAL_PREDEFINED_ENTITY = 6
|
---|
8098 |
|
---|
8099 | # xmlSaveOption
|
---|
8100 | XML_SAVE_FORMAT = 1
|
---|
8101 | XML_SAVE_NO_DECL = 2
|
---|
8102 | XML_SAVE_NO_EMPTY = 4
|
---|
8103 | XML_SAVE_NO_XHTML = 8
|
---|
8104 | XML_SAVE_XHTML = 16
|
---|
8105 | XML_SAVE_AS_XML = 32
|
---|
8106 | XML_SAVE_AS_HTML = 64
|
---|
8107 | XML_SAVE_WSNONSIG = 128
|
---|
8108 |
|
---|
8109 | # xmlPatternFlags
|
---|
8110 | XML_PATTERN_DEFAULT = 0
|
---|
8111 | XML_PATTERN_XPATH = 1
|
---|
8112 | XML_PATTERN_XSSEL = 2
|
---|
8113 | XML_PATTERN_XSFIELD = 4
|
---|
8114 |
|
---|
8115 | # xmlParserErrors
|
---|
8116 | XML_ERR_OK = 0
|
---|
8117 | XML_ERR_INTERNAL_ERROR = 1
|
---|
8118 | XML_ERR_NO_MEMORY = 2
|
---|
8119 | XML_ERR_DOCUMENT_START = 3
|
---|
8120 | XML_ERR_DOCUMENT_EMPTY = 4
|
---|
8121 | XML_ERR_DOCUMENT_END = 5
|
---|
8122 | XML_ERR_INVALID_HEX_CHARREF = 6
|
---|
8123 | XML_ERR_INVALID_DEC_CHARREF = 7
|
---|
8124 | XML_ERR_INVALID_CHARREF = 8
|
---|
8125 | XML_ERR_INVALID_CHAR = 9
|
---|
8126 | XML_ERR_CHARREF_AT_EOF = 10
|
---|
8127 | XML_ERR_CHARREF_IN_PROLOG = 11
|
---|
8128 | XML_ERR_CHARREF_IN_EPILOG = 12
|
---|
8129 | XML_ERR_CHARREF_IN_DTD = 13
|
---|
8130 | XML_ERR_ENTITYREF_AT_EOF = 14
|
---|
8131 | XML_ERR_ENTITYREF_IN_PROLOG = 15
|
---|
8132 | XML_ERR_ENTITYREF_IN_EPILOG = 16
|
---|
8133 | XML_ERR_ENTITYREF_IN_DTD = 17
|
---|
8134 | XML_ERR_PEREF_AT_EOF = 18
|
---|
8135 | XML_ERR_PEREF_IN_PROLOG = 19
|
---|
8136 | XML_ERR_PEREF_IN_EPILOG = 20
|
---|
8137 | XML_ERR_PEREF_IN_INT_SUBSET = 21
|
---|
8138 | XML_ERR_ENTITYREF_NO_NAME = 22
|
---|
8139 | XML_ERR_ENTITYREF_SEMICOL_MISSING = 23
|
---|
8140 | XML_ERR_PEREF_NO_NAME = 24
|
---|
8141 | XML_ERR_PEREF_SEMICOL_MISSING = 25
|
---|
8142 | XML_ERR_UNDECLARED_ENTITY = 26
|
---|
8143 | XML_WAR_UNDECLARED_ENTITY = 27
|
---|
8144 | XML_ERR_UNPARSED_ENTITY = 28
|
---|
8145 | XML_ERR_ENTITY_IS_EXTERNAL = 29
|
---|
8146 | XML_ERR_ENTITY_IS_PARAMETER = 30
|
---|
8147 | XML_ERR_UNKNOWN_ENCODING = 31
|
---|
8148 | XML_ERR_UNSUPPORTED_ENCODING = 32
|
---|
8149 | XML_ERR_STRING_NOT_STARTED = 33
|
---|
8150 | XML_ERR_STRING_NOT_CLOSED = 34
|
---|
8151 | XML_ERR_NS_DECL_ERROR = 35
|
---|
8152 | XML_ERR_ENTITY_NOT_STARTED = 36
|
---|
8153 | XML_ERR_ENTITY_NOT_FINISHED = 37
|
---|
8154 | XML_ERR_LT_IN_ATTRIBUTE = 38
|
---|
8155 | XML_ERR_ATTRIBUTE_NOT_STARTED = 39
|
---|
8156 | XML_ERR_ATTRIBUTE_NOT_FINISHED = 40
|
---|
8157 | XML_ERR_ATTRIBUTE_WITHOUT_VALUE = 41
|
---|
8158 | XML_ERR_ATTRIBUTE_REDEFINED = 42
|
---|
8159 | XML_ERR_LITERAL_NOT_STARTED = 43
|
---|
8160 | XML_ERR_LITERAL_NOT_FINISHED = 44
|
---|
8161 | XML_ERR_COMMENT_NOT_FINISHED = 45
|
---|
8162 | XML_ERR_PI_NOT_STARTED = 46
|
---|
8163 | XML_ERR_PI_NOT_FINISHED = 47
|
---|
8164 | XML_ERR_NOTATION_NOT_STARTED = 48
|
---|
8165 | XML_ERR_NOTATION_NOT_FINISHED = 49
|
---|
8166 | XML_ERR_ATTLIST_NOT_STARTED = 50
|
---|
8167 | XML_ERR_ATTLIST_NOT_FINISHED = 51
|
---|
8168 | XML_ERR_MIXED_NOT_STARTED = 52
|
---|
8169 | XML_ERR_MIXED_NOT_FINISHED = 53
|
---|
8170 | XML_ERR_ELEMCONTENT_NOT_STARTED = 54
|
---|
8171 | XML_ERR_ELEMCONTENT_NOT_FINISHED = 55
|
---|
8172 | XML_ERR_XMLDECL_NOT_STARTED = 56
|
---|
8173 | XML_ERR_XMLDECL_NOT_FINISHED = 57
|
---|
8174 | XML_ERR_CONDSEC_NOT_STARTED = 58
|
---|
8175 | XML_ERR_CONDSEC_NOT_FINISHED = 59
|
---|
8176 | XML_ERR_EXT_SUBSET_NOT_FINISHED = 60
|
---|
8177 | XML_ERR_DOCTYPE_NOT_FINISHED = 61
|
---|
8178 | XML_ERR_MISPLACED_CDATA_END = 62
|
---|
8179 | XML_ERR_CDATA_NOT_FINISHED = 63
|
---|
8180 | XML_ERR_RESERVED_XML_NAME = 64
|
---|
8181 | XML_ERR_SPACE_REQUIRED = 65
|
---|
8182 | XML_ERR_SEPARATOR_REQUIRED = 66
|
---|
8183 | XML_ERR_NMTOKEN_REQUIRED = 67
|
---|
8184 | XML_ERR_NAME_REQUIRED = 68
|
---|
8185 | XML_ERR_PCDATA_REQUIRED = 69
|
---|
8186 | XML_ERR_URI_REQUIRED = 70
|
---|
8187 | XML_ERR_PUBID_REQUIRED = 71
|
---|
8188 | XML_ERR_LT_REQUIRED = 72
|
---|
8189 | XML_ERR_GT_REQUIRED = 73
|
---|
8190 | XML_ERR_LTSLASH_REQUIRED = 74
|
---|
8191 | XML_ERR_EQUAL_REQUIRED = 75
|
---|
8192 | XML_ERR_TAG_NAME_MISMATCH = 76
|
---|
8193 | XML_ERR_TAG_NOT_FINISHED = 77
|
---|
8194 | XML_ERR_STANDALONE_VALUE = 78
|
---|
8195 | XML_ERR_ENCODING_NAME = 79
|
---|
8196 | XML_ERR_HYPHEN_IN_COMMENT = 80
|
---|
8197 | XML_ERR_INVALID_ENCODING = 81
|
---|
8198 | XML_ERR_EXT_ENTITY_STANDALONE = 82
|
---|
8199 | XML_ERR_CONDSEC_INVALID = 83
|
---|
8200 | XML_ERR_VALUE_REQUIRED = 84
|
---|
8201 | XML_ERR_NOT_WELL_BALANCED = 85
|
---|
8202 | XML_ERR_EXTRA_CONTENT = 86
|
---|
8203 | XML_ERR_ENTITY_CHAR_ERROR = 87
|
---|
8204 | XML_ERR_ENTITY_PE_INTERNAL = 88
|
---|
8205 | XML_ERR_ENTITY_LOOP = 89
|
---|
8206 | XML_ERR_ENTITY_BOUNDARY = 90
|
---|
8207 | XML_ERR_INVALID_URI = 91
|
---|
8208 | XML_ERR_URI_FRAGMENT = 92
|
---|
8209 | XML_WAR_CATALOG_PI = 93
|
---|
8210 | XML_ERR_NO_DTD = 94
|
---|
8211 | XML_ERR_CONDSEC_INVALID_KEYWORD = 95
|
---|
8212 | XML_ERR_VERSION_MISSING = 96
|
---|
8213 | XML_WAR_UNKNOWN_VERSION = 97
|
---|
8214 | XML_WAR_LANG_VALUE = 98
|
---|
8215 | XML_WAR_NS_URI = 99
|
---|
8216 | XML_WAR_NS_URI_RELATIVE = 100
|
---|
8217 | XML_ERR_MISSING_ENCODING = 101
|
---|
8218 | XML_WAR_SPACE_VALUE = 102
|
---|
8219 | XML_ERR_NOT_STANDALONE = 103
|
---|
8220 | XML_ERR_ENTITY_PROCESSING = 104
|
---|
8221 | XML_ERR_NOTATION_PROCESSING = 105
|
---|
8222 | XML_WAR_NS_COLUMN = 106
|
---|
8223 | XML_WAR_ENTITY_REDEFINED = 107
|
---|
8224 | XML_ERR_UNKNOWN_VERSION = 108
|
---|
8225 | XML_ERR_VERSION_MISMATCH = 109
|
---|
8226 | XML_ERR_NAME_TOO_LONG = 110
|
---|
8227 | XML_ERR_USER_STOP = 111
|
---|
8228 | XML_NS_ERR_XML_NAMESPACE = 200
|
---|
8229 | XML_NS_ERR_UNDEFINED_NAMESPACE = 201
|
---|
8230 | XML_NS_ERR_QNAME = 202
|
---|
8231 | XML_NS_ERR_ATTRIBUTE_REDEFINED = 203
|
---|
8232 | XML_NS_ERR_EMPTY = 204
|
---|
8233 | XML_NS_ERR_COLON = 205
|
---|
8234 | XML_DTD_ATTRIBUTE_DEFAULT = 500
|
---|
8235 | XML_DTD_ATTRIBUTE_REDEFINED = 501
|
---|
8236 | XML_DTD_ATTRIBUTE_VALUE = 502
|
---|
8237 | XML_DTD_CONTENT_ERROR = 503
|
---|
8238 | XML_DTD_CONTENT_MODEL = 504
|
---|
8239 | XML_DTD_CONTENT_NOT_DETERMINIST = 505
|
---|
8240 | XML_DTD_DIFFERENT_PREFIX = 506
|
---|
8241 | XML_DTD_ELEM_DEFAULT_NAMESPACE = 507
|
---|
8242 | XML_DTD_ELEM_NAMESPACE = 508
|
---|
8243 | XML_DTD_ELEM_REDEFINED = 509
|
---|
8244 | XML_DTD_EMPTY_NOTATION = 510
|
---|
8245 | XML_DTD_ENTITY_TYPE = 511
|
---|
8246 | XML_DTD_ID_FIXED = 512
|
---|
8247 | XML_DTD_ID_REDEFINED = 513
|
---|
8248 | XML_DTD_ID_SUBSET = 514
|
---|
8249 | XML_DTD_INVALID_CHILD = 515
|
---|
8250 | XML_DTD_INVALID_DEFAULT = 516
|
---|
8251 | XML_DTD_LOAD_ERROR = 517
|
---|
8252 | XML_DTD_MISSING_ATTRIBUTE = 518
|
---|
8253 | XML_DTD_MIXED_CORRUPT = 519
|
---|
8254 | XML_DTD_MULTIPLE_ID = 520
|
---|
8255 | XML_DTD_NO_DOC = 521
|
---|
8256 | XML_DTD_NO_DTD = 522
|
---|
8257 | XML_DTD_NO_ELEM_NAME = 523
|
---|
8258 | XML_DTD_NO_PREFIX = 524
|
---|
8259 | XML_DTD_NO_ROOT = 525
|
---|
8260 | XML_DTD_NOTATION_REDEFINED = 526
|
---|
8261 | XML_DTD_NOTATION_VALUE = 527
|
---|
8262 | XML_DTD_NOT_EMPTY = 528
|
---|
8263 | XML_DTD_NOT_PCDATA = 529
|
---|
8264 | XML_DTD_NOT_STANDALONE = 530
|
---|
8265 | XML_DTD_ROOT_NAME = 531
|
---|
8266 | XML_DTD_STANDALONE_WHITE_SPACE = 532
|
---|
8267 | XML_DTD_UNKNOWN_ATTRIBUTE = 533
|
---|
8268 | XML_DTD_UNKNOWN_ELEM = 534
|
---|
8269 | XML_DTD_UNKNOWN_ENTITY = 535
|
---|
8270 | XML_DTD_UNKNOWN_ID = 536
|
---|
8271 | XML_DTD_UNKNOWN_NOTATION = 537
|
---|
8272 | XML_DTD_STANDALONE_DEFAULTED = 538
|
---|
8273 | XML_DTD_XMLID_VALUE = 539
|
---|
8274 | XML_DTD_XMLID_TYPE = 540
|
---|
8275 | XML_DTD_DUP_TOKEN = 541
|
---|
8276 | XML_HTML_STRUCURE_ERROR = 800
|
---|
8277 | XML_HTML_UNKNOWN_TAG = 801
|
---|
8278 | XML_RNGP_ANYNAME_ATTR_ANCESTOR = 1000
|
---|
8279 | XML_RNGP_ATTR_CONFLICT = 1001
|
---|
8280 | XML_RNGP_ATTRIBUTE_CHILDREN = 1002
|
---|
8281 | XML_RNGP_ATTRIBUTE_CONTENT = 1003
|
---|
8282 | XML_RNGP_ATTRIBUTE_EMPTY = 1004
|
---|
8283 | XML_RNGP_ATTRIBUTE_NOOP = 1005
|
---|
8284 | XML_RNGP_CHOICE_CONTENT = 1006
|
---|
8285 | XML_RNGP_CHOICE_EMPTY = 1007
|
---|
8286 | XML_RNGP_CREATE_FAILURE = 1008
|
---|
8287 | XML_RNGP_DATA_CONTENT = 1009
|
---|
8288 | XML_RNGP_DEF_CHOICE_AND_INTERLEAVE = 1010
|
---|
8289 | XML_RNGP_DEFINE_CREATE_FAILED = 1011
|
---|
8290 | XML_RNGP_DEFINE_EMPTY = 1012
|
---|
8291 | XML_RNGP_DEFINE_MISSING = 1013
|
---|
8292 | XML_RNGP_DEFINE_NAME_MISSING = 1014
|
---|
8293 | XML_RNGP_ELEM_CONTENT_EMPTY = 1015
|
---|
8294 | XML_RNGP_ELEM_CONTENT_ERROR = 1016
|
---|
8295 | XML_RNGP_ELEMENT_EMPTY = 1017
|
---|
8296 | XML_RNGP_ELEMENT_CONTENT = 1018
|
---|
8297 | XML_RNGP_ELEMENT_NAME = 1019
|
---|
8298 | XML_RNGP_ELEMENT_NO_CONTENT = 1020
|
---|
8299 | XML_RNGP_ELEM_TEXT_CONFLICT = 1021
|
---|
8300 | XML_RNGP_EMPTY = 1022
|
---|
8301 | XML_RNGP_EMPTY_CONSTRUCT = 1023
|
---|
8302 | XML_RNGP_EMPTY_CONTENT = 1024
|
---|
8303 | XML_RNGP_EMPTY_NOT_EMPTY = 1025
|
---|
8304 | XML_RNGP_ERROR_TYPE_LIB = 1026
|
---|
8305 | XML_RNGP_EXCEPT_EMPTY = 1027
|
---|
8306 | XML_RNGP_EXCEPT_MISSING = 1028
|
---|
8307 | XML_RNGP_EXCEPT_MULTIPLE = 1029
|
---|
8308 | XML_RNGP_EXCEPT_NO_CONTENT = 1030
|
---|
8309 | XML_RNGP_EXTERNALREF_EMTPY = 1031
|
---|
8310 | XML_RNGP_EXTERNAL_REF_FAILURE = 1032
|
---|
8311 | XML_RNGP_EXTERNALREF_RECURSE = 1033
|
---|
8312 | XML_RNGP_FORBIDDEN_ATTRIBUTE = 1034
|
---|
8313 | XML_RNGP_FOREIGN_ELEMENT = 1035
|
---|
8314 | XML_RNGP_GRAMMAR_CONTENT = 1036
|
---|
8315 | XML_RNGP_GRAMMAR_EMPTY = 1037
|
---|
8316 | XML_RNGP_GRAMMAR_MISSING = 1038
|
---|
8317 | XML_RNGP_GRAMMAR_NO_START = 1039
|
---|
8318 | XML_RNGP_GROUP_ATTR_CONFLICT = 1040
|
---|
8319 | XML_RNGP_HREF_ERROR = 1041
|
---|
8320 | XML_RNGP_INCLUDE_EMPTY = 1042
|
---|
8321 | XML_RNGP_INCLUDE_FAILURE = 1043
|
---|
8322 | XML_RNGP_INCLUDE_RECURSE = 1044
|
---|
8323 | XML_RNGP_INTERLEAVE_ADD = 1045
|
---|
8324 | XML_RNGP_INTERLEAVE_CREATE_FAILED = 1046
|
---|
8325 | XML_RNGP_INTERLEAVE_EMPTY = 1047
|
---|
8326 | XML_RNGP_INTERLEAVE_NO_CONTENT = 1048
|
---|
8327 | XML_RNGP_INVALID_DEFINE_NAME = 1049
|
---|
8328 | XML_RNGP_INVALID_URI = 1050
|
---|
8329 | XML_RNGP_INVALID_VALUE = 1051
|
---|
8330 | XML_RNGP_MISSING_HREF = 1052
|
---|
8331 | XML_RNGP_NAME_MISSING = 1053
|
---|
8332 | XML_RNGP_NEED_COMBINE = 1054
|
---|
8333 | XML_RNGP_NOTALLOWED_NOT_EMPTY = 1055
|
---|
8334 | XML_RNGP_NSNAME_ATTR_ANCESTOR = 1056
|
---|
8335 | XML_RNGP_NSNAME_NO_NS = 1057
|
---|
8336 | XML_RNGP_PARAM_FORBIDDEN = 1058
|
---|
8337 | XML_RNGP_PARAM_NAME_MISSING = 1059
|
---|
8338 | XML_RNGP_PARENTREF_CREATE_FAILED = 1060
|
---|
8339 | XML_RNGP_PARENTREF_NAME_INVALID = 1061
|
---|
8340 | XML_RNGP_PARENTREF_NO_NAME = 1062
|
---|
8341 | XML_RNGP_PARENTREF_NO_PARENT = 1063
|
---|
8342 | XML_RNGP_PARENTREF_NOT_EMPTY = 1064
|
---|
8343 | XML_RNGP_PARSE_ERROR = 1065
|
---|
8344 | XML_RNGP_PAT_ANYNAME_EXCEPT_ANYNAME = 1066
|
---|
8345 | XML_RNGP_PAT_ATTR_ATTR = 1067
|
---|
8346 | XML_RNGP_PAT_ATTR_ELEM = 1068
|
---|
8347 | XML_RNGP_PAT_DATA_EXCEPT_ATTR = 1069
|
---|
8348 | XML_RNGP_PAT_DATA_EXCEPT_ELEM = 1070
|
---|
8349 | XML_RNGP_PAT_DATA_EXCEPT_EMPTY = 1071
|
---|
8350 | XML_RNGP_PAT_DATA_EXCEPT_GROUP = 1072
|
---|
8351 | XML_RNGP_PAT_DATA_EXCEPT_INTERLEAVE = 1073
|
---|
8352 | XML_RNGP_PAT_DATA_EXCEPT_LIST = 1074
|
---|
8353 | XML_RNGP_PAT_DATA_EXCEPT_ONEMORE = 1075
|
---|
8354 | XML_RNGP_PAT_DATA_EXCEPT_REF = 1076
|
---|
8355 | XML_RNGP_PAT_DATA_EXCEPT_TEXT = 1077
|
---|
8356 | XML_RNGP_PAT_LIST_ATTR = 1078
|
---|
8357 | XML_RNGP_PAT_LIST_ELEM = 1079
|
---|
8358 | XML_RNGP_PAT_LIST_INTERLEAVE = 1080
|
---|
8359 | XML_RNGP_PAT_LIST_LIST = 1081
|
---|
8360 | XML_RNGP_PAT_LIST_REF = 1082
|
---|
8361 | XML_RNGP_PAT_LIST_TEXT = 1083
|
---|
8362 | XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME = 1084
|
---|
8363 | XML_RNGP_PAT_NSNAME_EXCEPT_NSNAME = 1085
|
---|
8364 | XML_RNGP_PAT_ONEMORE_GROUP_ATTR = 1086
|
---|
8365 | XML_RNGP_PAT_ONEMORE_INTERLEAVE_ATTR = 1087
|
---|
8366 | XML_RNGP_PAT_START_ATTR = 1088
|
---|
8367 | XML_RNGP_PAT_START_DATA = 1089
|
---|
8368 | XML_RNGP_PAT_START_EMPTY = 1090
|
---|
8369 | XML_RNGP_PAT_START_GROUP = 1091
|
---|
8370 | XML_RNGP_PAT_START_INTERLEAVE = 1092
|
---|
8371 | XML_RNGP_PAT_START_LIST = 1093
|
---|
8372 | XML_RNGP_PAT_START_ONEMORE = 1094
|
---|
8373 | XML_RNGP_PAT_START_TEXT = 1095
|
---|
8374 | XML_RNGP_PAT_START_VALUE = 1096
|
---|
8375 | XML_RNGP_PREFIX_UNDEFINED = 1097
|
---|
8376 | XML_RNGP_REF_CREATE_FAILED = 1098
|
---|
8377 | XML_RNGP_REF_CYCLE = 1099
|
---|
8378 | XML_RNGP_REF_NAME_INVALID = 1100
|
---|
8379 | XML_RNGP_REF_NO_DEF = 1101
|
---|
8380 | XML_RNGP_REF_NO_NAME = 1102
|
---|
8381 | XML_RNGP_REF_NOT_EMPTY = 1103
|
---|
8382 | XML_RNGP_START_CHOICE_AND_INTERLEAVE = 1104
|
---|
8383 | XML_RNGP_START_CONTENT = 1105
|
---|
8384 | XML_RNGP_START_EMPTY = 1106
|
---|
8385 | XML_RNGP_START_MISSING = 1107
|
---|
8386 | XML_RNGP_TEXT_EXPECTED = 1108
|
---|
8387 | XML_RNGP_TEXT_HAS_CHILD = 1109
|
---|
8388 | XML_RNGP_TYPE_MISSING = 1110
|
---|
8389 | XML_RNGP_TYPE_NOT_FOUND = 1111
|
---|
8390 | XML_RNGP_TYPE_VALUE = 1112
|
---|
8391 | XML_RNGP_UNKNOWN_ATTRIBUTE = 1113
|
---|
8392 | XML_RNGP_UNKNOWN_COMBINE = 1114
|
---|
8393 | XML_RNGP_UNKNOWN_CONSTRUCT = 1115
|
---|
8394 | XML_RNGP_UNKNOWN_TYPE_LIB = 1116
|
---|
8395 | XML_RNGP_URI_FRAGMENT = 1117
|
---|
8396 | XML_RNGP_URI_NOT_ABSOLUTE = 1118
|
---|
8397 | XML_RNGP_VALUE_EMPTY = 1119
|
---|
8398 | XML_RNGP_VALUE_NO_CONTENT = 1120
|
---|
8399 | XML_RNGP_XMLNS_NAME = 1121
|
---|
8400 | XML_RNGP_XML_NS = 1122
|
---|
8401 | XML_XPATH_EXPRESSION_OK = 1200
|
---|
8402 | XML_XPATH_NUMBER_ERROR = 1201
|
---|
8403 | XML_XPATH_UNFINISHED_LITERAL_ERROR = 1202
|
---|
8404 | XML_XPATH_START_LITERAL_ERROR = 1203
|
---|
8405 | XML_XPATH_VARIABLE_REF_ERROR = 1204
|
---|
8406 | XML_XPATH_UNDEF_VARIABLE_ERROR = 1205
|
---|
8407 | XML_XPATH_INVALID_PREDICATE_ERROR = 1206
|
---|
8408 | XML_XPATH_EXPR_ERROR = 1207
|
---|
8409 | XML_XPATH_UNCLOSED_ERROR = 1208
|
---|
8410 | XML_XPATH_UNKNOWN_FUNC_ERROR = 1209
|
---|
8411 | XML_XPATH_INVALID_OPERAND = 1210
|
---|
8412 | XML_XPATH_INVALID_TYPE = 1211
|
---|
8413 | XML_XPATH_INVALID_ARITY = 1212
|
---|
8414 | XML_XPATH_INVALID_CTXT_SIZE = 1213
|
---|
8415 | XML_XPATH_INVALID_CTXT_POSITION = 1214
|
---|
8416 | XML_XPATH_MEMORY_ERROR = 1215
|
---|
8417 | XML_XPTR_SYNTAX_ERROR = 1216
|
---|
8418 | XML_XPTR_RESOURCE_ERROR = 1217
|
---|
8419 | XML_XPTR_SUB_RESOURCE_ERROR = 1218
|
---|
8420 | XML_XPATH_UNDEF_PREFIX_ERROR = 1219
|
---|
8421 | XML_XPATH_ENCODING_ERROR = 1220
|
---|
8422 | XML_XPATH_INVALID_CHAR_ERROR = 1221
|
---|
8423 | XML_TREE_INVALID_HEX = 1300
|
---|
8424 | XML_TREE_INVALID_DEC = 1301
|
---|
8425 | XML_TREE_UNTERMINATED_ENTITY = 1302
|
---|
8426 | XML_TREE_NOT_UTF8 = 1303
|
---|
8427 | XML_SAVE_NOT_UTF8 = 1400
|
---|
8428 | XML_SAVE_CHAR_INVALID = 1401
|
---|
8429 | XML_SAVE_NO_DOCTYPE = 1402
|
---|
8430 | XML_SAVE_UNKNOWN_ENCODING = 1403
|
---|
8431 | XML_REGEXP_COMPILE_ERROR = 1450
|
---|
8432 | XML_IO_UNKNOWN = 1500
|
---|
8433 | XML_IO_EACCES = 1501
|
---|
8434 | XML_IO_EAGAIN = 1502
|
---|
8435 | XML_IO_EBADF = 1503
|
---|
8436 | XML_IO_EBADMSG = 1504
|
---|
8437 | XML_IO_EBUSY = 1505
|
---|
8438 | XML_IO_ECANCELED = 1506
|
---|
8439 | XML_IO_ECHILD = 1507
|
---|
8440 | XML_IO_EDEADLK = 1508
|
---|
8441 | XML_IO_EDOM = 1509
|
---|
8442 | XML_IO_EEXIST = 1510
|
---|
8443 | XML_IO_EFAULT = 1511
|
---|
8444 | XML_IO_EFBIG = 1512
|
---|
8445 | XML_IO_EINPROGRESS = 1513
|
---|
8446 | XML_IO_EINTR = 1514
|
---|
8447 | XML_IO_EINVAL = 1515
|
---|
8448 | XML_IO_EIO = 1516
|
---|
8449 | XML_IO_EISDIR = 1517
|
---|
8450 | XML_IO_EMFILE = 1518
|
---|
8451 | XML_IO_EMLINK = 1519
|
---|
8452 | XML_IO_EMSGSIZE = 1520
|
---|
8453 | XML_IO_ENAMETOOLONG = 1521
|
---|
8454 | XML_IO_ENFILE = 1522
|
---|
8455 | XML_IO_ENODEV = 1523
|
---|
8456 | XML_IO_ENOENT = 1524
|
---|
8457 | XML_IO_ENOEXEC = 1525
|
---|
8458 | XML_IO_ENOLCK = 1526
|
---|
8459 | XML_IO_ENOMEM = 1527
|
---|
8460 | XML_IO_ENOSPC = 1528
|
---|
8461 | XML_IO_ENOSYS = 1529
|
---|
8462 | XML_IO_ENOTDIR = 1530
|
---|
8463 | XML_IO_ENOTEMPTY = 1531
|
---|
8464 | XML_IO_ENOTSUP = 1532
|
---|
8465 | XML_IO_ENOTTY = 1533
|
---|
8466 | XML_IO_ENXIO = 1534
|
---|
8467 | XML_IO_EPERM = 1535
|
---|
8468 | XML_IO_EPIPE = 1536
|
---|
8469 | XML_IO_ERANGE = 1537
|
---|
8470 | XML_IO_EROFS = 1538
|
---|
8471 | XML_IO_ESPIPE = 1539
|
---|
8472 | XML_IO_ESRCH = 1540
|
---|
8473 | XML_IO_ETIMEDOUT = 1541
|
---|
8474 | XML_IO_EXDEV = 1542
|
---|
8475 | XML_IO_NETWORK_ATTEMPT = 1543
|
---|
8476 | XML_IO_ENCODER = 1544
|
---|
8477 | XML_IO_FLUSH = 1545
|
---|
8478 | XML_IO_WRITE = 1546
|
---|
8479 | XML_IO_NO_INPUT = 1547
|
---|
8480 | XML_IO_BUFFER_FULL = 1548
|
---|
8481 | XML_IO_LOAD_ERROR = 1549
|
---|
8482 | XML_IO_ENOTSOCK = 1550
|
---|
8483 | XML_IO_EISCONN = 1551
|
---|
8484 | XML_IO_ECONNREFUSED = 1552
|
---|
8485 | XML_IO_ENETUNREACH = 1553
|
---|
8486 | XML_IO_EADDRINUSE = 1554
|
---|
8487 | XML_IO_EALREADY = 1555
|
---|
8488 | XML_IO_EAFNOSUPPORT = 1556
|
---|
8489 | XML_XINCLUDE_RECURSION = 1600
|
---|
8490 | XML_XINCLUDE_PARSE_VALUE = 1601
|
---|
8491 | XML_XINCLUDE_ENTITY_DEF_MISMATCH = 1602
|
---|
8492 | XML_XINCLUDE_NO_HREF = 1603
|
---|
8493 | XML_XINCLUDE_NO_FALLBACK = 1604
|
---|
8494 | XML_XINCLUDE_HREF_URI = 1605
|
---|
8495 | XML_XINCLUDE_TEXT_FRAGMENT = 1606
|
---|
8496 | XML_XINCLUDE_TEXT_DOCUMENT = 1607
|
---|
8497 | XML_XINCLUDE_INVALID_CHAR = 1608
|
---|
8498 | XML_XINCLUDE_BUILD_FAILED = 1609
|
---|
8499 | XML_XINCLUDE_UNKNOWN_ENCODING = 1610
|
---|
8500 | XML_XINCLUDE_MULTIPLE_ROOT = 1611
|
---|
8501 | XML_XINCLUDE_XPTR_FAILED = 1612
|
---|
8502 | XML_XINCLUDE_XPTR_RESULT = 1613
|
---|
8503 | XML_XINCLUDE_INCLUDE_IN_INCLUDE = 1614
|
---|
8504 | XML_XINCLUDE_FALLBACKS_IN_INCLUDE = 1615
|
---|
8505 | XML_XINCLUDE_FALLBACK_NOT_IN_INCLUDE = 1616
|
---|
8506 | XML_XINCLUDE_DEPRECATED_NS = 1617
|
---|
8507 | XML_XINCLUDE_FRAGMENT_ID = 1618
|
---|
8508 | XML_CATALOG_MISSING_ATTR = 1650
|
---|
8509 | XML_CATALOG_ENTRY_BROKEN = 1651
|
---|
8510 | XML_CATALOG_PREFER_VALUE = 1652
|
---|
8511 | XML_CATALOG_NOT_CATALOG = 1653
|
---|
8512 | XML_CATALOG_RECURSION = 1654
|
---|
8513 | XML_SCHEMAP_PREFIX_UNDEFINED = 1700
|
---|
8514 | XML_SCHEMAP_ATTRFORMDEFAULT_VALUE = 1701
|
---|
8515 | XML_SCHEMAP_ATTRGRP_NONAME_NOREF = 1702
|
---|
8516 | XML_SCHEMAP_ATTR_NONAME_NOREF = 1703
|
---|
8517 | XML_SCHEMAP_COMPLEXTYPE_NONAME_NOREF = 1704
|
---|
8518 | XML_SCHEMAP_ELEMFORMDEFAULT_VALUE = 1705
|
---|
8519 | XML_SCHEMAP_ELEM_NONAME_NOREF = 1706
|
---|
8520 | XML_SCHEMAP_EXTENSION_NO_BASE = 1707
|
---|
8521 | XML_SCHEMAP_FACET_NO_VALUE = 1708
|
---|
8522 | XML_SCHEMAP_FAILED_BUILD_IMPORT = 1709
|
---|
8523 | XML_SCHEMAP_GROUP_NONAME_NOREF = 1710
|
---|
8524 | XML_SCHEMAP_IMPORT_NAMESPACE_NOT_URI = 1711
|
---|
8525 | XML_SCHEMAP_IMPORT_REDEFINE_NSNAME = 1712
|
---|
8526 | XML_SCHEMAP_IMPORT_SCHEMA_NOT_URI = 1713
|
---|
8527 | XML_SCHEMAP_INVALID_BOOLEAN = 1714
|
---|
8528 | XML_SCHEMAP_INVALID_ENUM = 1715
|
---|
8529 | XML_SCHEMAP_INVALID_FACET = 1716
|
---|
8530 | XML_SCHEMAP_INVALID_FACET_VALUE = 1717
|
---|
8531 | XML_SCHEMAP_INVALID_MAXOCCURS = 1718
|
---|
8532 | XML_SCHEMAP_INVALID_MINOCCURS = 1719
|
---|
8533 | XML_SCHEMAP_INVALID_REF_AND_SUBTYPE = 1720
|
---|
8534 | XML_SCHEMAP_INVALID_WHITE_SPACE = 1721
|
---|
8535 | XML_SCHEMAP_NOATTR_NOREF = 1722
|
---|
8536 | XML_SCHEMAP_NOTATION_NO_NAME = 1723
|
---|
8537 | XML_SCHEMAP_NOTYPE_NOREF = 1724
|
---|
8538 | XML_SCHEMAP_REF_AND_SUBTYPE = 1725
|
---|
8539 | XML_SCHEMAP_RESTRICTION_NONAME_NOREF = 1726
|
---|
8540 | XML_SCHEMAP_SIMPLETYPE_NONAME = 1727
|
---|
8541 | XML_SCHEMAP_TYPE_AND_SUBTYPE = 1728
|
---|
8542 | XML_SCHEMAP_UNKNOWN_ALL_CHILD = 1729
|
---|
8543 | XML_SCHEMAP_UNKNOWN_ANYATTRIBUTE_CHILD = 1730
|
---|
8544 | XML_SCHEMAP_UNKNOWN_ATTR_CHILD = 1731
|
---|
8545 | XML_SCHEMAP_UNKNOWN_ATTRGRP_CHILD = 1732
|
---|
8546 | XML_SCHEMAP_UNKNOWN_ATTRIBUTE_GROUP = 1733
|
---|
8547 | XML_SCHEMAP_UNKNOWN_BASE_TYPE = 1734
|
---|
8548 | XML_SCHEMAP_UNKNOWN_CHOICE_CHILD = 1735
|
---|
8549 | XML_SCHEMAP_UNKNOWN_COMPLEXCONTENT_CHILD = 1736
|
---|
8550 | XML_SCHEMAP_UNKNOWN_COMPLEXTYPE_CHILD = 1737
|
---|
8551 | XML_SCHEMAP_UNKNOWN_ELEM_CHILD = 1738
|
---|
8552 | XML_SCHEMAP_UNKNOWN_EXTENSION_CHILD = 1739
|
---|
8553 | XML_SCHEMAP_UNKNOWN_FACET_CHILD = 1740
|
---|
8554 | XML_SCHEMAP_UNKNOWN_FACET_TYPE = 1741
|
---|
8555 | XML_SCHEMAP_UNKNOWN_GROUP_CHILD = 1742
|
---|
8556 | XML_SCHEMAP_UNKNOWN_IMPORT_CHILD = 1743
|
---|
8557 | XML_SCHEMAP_UNKNOWN_LIST_CHILD = 1744
|
---|
8558 | XML_SCHEMAP_UNKNOWN_NOTATION_CHILD = 1745
|
---|
8559 | XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD = 1746
|
---|
8560 | XML_SCHEMAP_UNKNOWN_REF = 1747
|
---|
8561 | XML_SCHEMAP_UNKNOWN_RESTRICTION_CHILD = 1748
|
---|
8562 | XML_SCHEMAP_UNKNOWN_SCHEMAS_CHILD = 1749
|
---|
8563 | XML_SCHEMAP_UNKNOWN_SEQUENCE_CHILD = 1750
|
---|
8564 | XML_SCHEMAP_UNKNOWN_SIMPLECONTENT_CHILD = 1751
|
---|
8565 | XML_SCHEMAP_UNKNOWN_SIMPLETYPE_CHILD = 1752
|
---|
8566 | XML_SCHEMAP_UNKNOWN_TYPE = 1753
|
---|
8567 | XML_SCHEMAP_UNKNOWN_UNION_CHILD = 1754
|
---|
8568 | XML_SCHEMAP_ELEM_DEFAULT_FIXED = 1755
|
---|
8569 | XML_SCHEMAP_REGEXP_INVALID = 1756
|
---|
8570 | XML_SCHEMAP_FAILED_LOAD = 1757
|
---|
8571 | XML_SCHEMAP_NOTHING_TO_PARSE = 1758
|
---|
8572 | XML_SCHEMAP_NOROOT = 1759
|
---|
8573 | XML_SCHEMAP_REDEFINED_GROUP = 1760
|
---|
8574 | XML_SCHEMAP_REDEFINED_TYPE = 1761
|
---|
8575 | XML_SCHEMAP_REDEFINED_ELEMENT = 1762
|
---|
8576 | XML_SCHEMAP_REDEFINED_ATTRGROUP = 1763
|
---|
8577 | XML_SCHEMAP_REDEFINED_ATTR = 1764
|
---|
8578 | XML_SCHEMAP_REDEFINED_NOTATION = 1765
|
---|
8579 | XML_SCHEMAP_FAILED_PARSE = 1766
|
---|
8580 | XML_SCHEMAP_UNKNOWN_PREFIX = 1767
|
---|
8581 | XML_SCHEMAP_DEF_AND_PREFIX = 1768
|
---|
8582 | XML_SCHEMAP_UNKNOWN_INCLUDE_CHILD = 1769
|
---|
8583 | XML_SCHEMAP_INCLUDE_SCHEMA_NOT_URI = 1770
|
---|
8584 | XML_SCHEMAP_INCLUDE_SCHEMA_NO_URI = 1771
|
---|
8585 | XML_SCHEMAP_NOT_SCHEMA = 1772
|
---|
8586 | XML_SCHEMAP_UNKNOWN_MEMBER_TYPE = 1773
|
---|
8587 | XML_SCHEMAP_INVALID_ATTR_USE = 1774
|
---|
8588 | XML_SCHEMAP_RECURSIVE = 1775
|
---|
8589 | XML_SCHEMAP_SUPERNUMEROUS_LIST_ITEM_TYPE = 1776
|
---|
8590 | XML_SCHEMAP_INVALID_ATTR_COMBINATION = 1777
|
---|
8591 | XML_SCHEMAP_INVALID_ATTR_INLINE_COMBINATION = 1778
|
---|
8592 | XML_SCHEMAP_MISSING_SIMPLETYPE_CHILD = 1779
|
---|
8593 | XML_SCHEMAP_INVALID_ATTR_NAME = 1780
|
---|
8594 | XML_SCHEMAP_REF_AND_CONTENT = 1781
|
---|
8595 | XML_SCHEMAP_CT_PROPS_CORRECT_1 = 1782
|
---|
8596 | XML_SCHEMAP_CT_PROPS_CORRECT_2 = 1783
|
---|
8597 | XML_SCHEMAP_CT_PROPS_CORRECT_3 = 1784
|
---|
8598 | XML_SCHEMAP_CT_PROPS_CORRECT_4 = 1785
|
---|
8599 | XML_SCHEMAP_CT_PROPS_CORRECT_5 = 1786
|
---|
8600 | XML_SCHEMAP_DERIVATION_OK_RESTRICTION_1 = 1787
|
---|
8601 | XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_1 = 1788
|
---|
8602 | XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_2 = 1789
|
---|
8603 | XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_2 = 1790
|
---|
8604 | XML_SCHEMAP_DERIVATION_OK_RESTRICTION_3 = 1791
|
---|
8605 | XML_SCHEMAP_WILDCARD_INVALID_NS_MEMBER = 1792
|
---|
8606 | XML_SCHEMAP_INTERSECTION_NOT_EXPRESSIBLE = 1793
|
---|
8607 | XML_SCHEMAP_UNION_NOT_EXPRESSIBLE = 1794
|
---|
8608 | XML_SCHEMAP_SRC_IMPORT_3_1 = 1795
|
---|
8609 | XML_SCHEMAP_SRC_IMPORT_3_2 = 1796
|
---|
8610 | XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_1 = 1797
|
---|
8611 | XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_2 = 1798
|
---|
8612 | XML_SCHEMAP_DERIVATION_OK_RESTRICTION_4_3 = 1799
|
---|
8613 | XML_SCHEMAP_COS_CT_EXTENDS_1_3 = 1800
|
---|
8614 | XML_SCHEMAV_NOROOT = 1801
|
---|
8615 | XML_SCHEMAV_UNDECLAREDELEM = 1802
|
---|
8616 | XML_SCHEMAV_NOTTOPLEVEL = 1803
|
---|
8617 | XML_SCHEMAV_MISSING = 1804
|
---|
8618 | XML_SCHEMAV_WRONGELEM = 1805
|
---|
8619 | XML_SCHEMAV_NOTYPE = 1806
|
---|
8620 | XML_SCHEMAV_NOROLLBACK = 1807
|
---|
8621 | XML_SCHEMAV_ISABSTRACT = 1808
|
---|
8622 | XML_SCHEMAV_NOTEMPTY = 1809
|
---|
8623 | XML_SCHEMAV_ELEMCONT = 1810
|
---|
8624 | XML_SCHEMAV_HAVEDEFAULT = 1811
|
---|
8625 | XML_SCHEMAV_NOTNILLABLE = 1812
|
---|
8626 | XML_SCHEMAV_EXTRACONTENT = 1813
|
---|
8627 | XML_SCHEMAV_INVALIDATTR = 1814
|
---|
8628 | XML_SCHEMAV_INVALIDELEM = 1815
|
---|
8629 | XML_SCHEMAV_NOTDETERMINIST = 1816
|
---|
8630 | XML_SCHEMAV_CONSTRUCT = 1817
|
---|
8631 | XML_SCHEMAV_INTERNAL = 1818
|
---|
8632 | XML_SCHEMAV_NOTSIMPLE = 1819
|
---|
8633 | XML_SCHEMAV_ATTRUNKNOWN = 1820
|
---|
8634 | XML_SCHEMAV_ATTRINVALID = 1821
|
---|
8635 | XML_SCHEMAV_VALUE = 1822
|
---|
8636 | XML_SCHEMAV_FACET = 1823
|
---|
8637 | XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_1 = 1824
|
---|
8638 | XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_2 = 1825
|
---|
8639 | XML_SCHEMAV_CVC_DATATYPE_VALID_1_2_3 = 1826
|
---|
8640 | XML_SCHEMAV_CVC_TYPE_3_1_1 = 1827
|
---|
8641 | XML_SCHEMAV_CVC_TYPE_3_1_2 = 1828
|
---|
8642 | XML_SCHEMAV_CVC_FACET_VALID = 1829
|
---|
8643 | XML_SCHEMAV_CVC_LENGTH_VALID = 1830
|
---|
8644 | XML_SCHEMAV_CVC_MINLENGTH_VALID = 1831
|
---|
8645 | XML_SCHEMAV_CVC_MAXLENGTH_VALID = 1832
|
---|
8646 | XML_SCHEMAV_CVC_MININCLUSIVE_VALID = 1833
|
---|
8647 | XML_SCHEMAV_CVC_MAXINCLUSIVE_VALID = 1834
|
---|
8648 | XML_SCHEMAV_CVC_MINEXCLUSIVE_VALID = 1835
|
---|
8649 | XML_SCHEMAV_CVC_MAXEXCLUSIVE_VALID = 1836
|
---|
8650 | XML_SCHEMAV_CVC_TOTALDIGITS_VALID = 1837
|
---|
8651 | XML_SCHEMAV_CVC_FRACTIONDIGITS_VALID = 1838
|
---|
8652 | XML_SCHEMAV_CVC_PATTERN_VALID = 1839
|
---|
8653 | XML_SCHEMAV_CVC_ENUMERATION_VALID = 1840
|
---|
8654 | XML_SCHEMAV_CVC_COMPLEX_TYPE_2_1 = 1841
|
---|
8655 | XML_SCHEMAV_CVC_COMPLEX_TYPE_2_2 = 1842
|
---|
8656 | XML_SCHEMAV_CVC_COMPLEX_TYPE_2_3 = 1843
|
---|
8657 | XML_SCHEMAV_CVC_COMPLEX_TYPE_2_4 = 1844
|
---|
8658 | XML_SCHEMAV_CVC_ELT_1 = 1845
|
---|
8659 | XML_SCHEMAV_CVC_ELT_2 = 1846
|
---|
8660 | XML_SCHEMAV_CVC_ELT_3_1 = 1847
|
---|
8661 | XML_SCHEMAV_CVC_ELT_3_2_1 = 1848
|
---|
8662 | XML_SCHEMAV_CVC_ELT_3_2_2 = 1849
|
---|
8663 | XML_SCHEMAV_CVC_ELT_4_1 = 1850
|
---|
8664 | XML_SCHEMAV_CVC_ELT_4_2 = 1851
|
---|
8665 | XML_SCHEMAV_CVC_ELT_4_3 = 1852
|
---|
8666 | XML_SCHEMAV_CVC_ELT_5_1_1 = 1853
|
---|
8667 | XML_SCHEMAV_CVC_ELT_5_1_2 = 1854
|
---|
8668 | XML_SCHEMAV_CVC_ELT_5_2_1 = 1855
|
---|
8669 | XML_SCHEMAV_CVC_ELT_5_2_2_1 = 1856
|
---|
8670 | XML_SCHEMAV_CVC_ELT_5_2_2_2_1 = 1857
|
---|
8671 | XML_SCHEMAV_CVC_ELT_5_2_2_2_2 = 1858
|
---|
8672 | XML_SCHEMAV_CVC_ELT_6 = 1859
|
---|
8673 | XML_SCHEMAV_CVC_ELT_7 = 1860
|
---|
8674 | XML_SCHEMAV_CVC_ATTRIBUTE_1 = 1861
|
---|
8675 | XML_SCHEMAV_CVC_ATTRIBUTE_2 = 1862
|
---|
8676 | XML_SCHEMAV_CVC_ATTRIBUTE_3 = 1863
|
---|
8677 | XML_SCHEMAV_CVC_ATTRIBUTE_4 = 1864
|
---|
8678 | XML_SCHEMAV_CVC_COMPLEX_TYPE_3_1 = 1865
|
---|
8679 | XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_1 = 1866
|
---|
8680 | XML_SCHEMAV_CVC_COMPLEX_TYPE_3_2_2 = 1867
|
---|
8681 | XML_SCHEMAV_CVC_COMPLEX_TYPE_4 = 1868
|
---|
8682 | XML_SCHEMAV_CVC_COMPLEX_TYPE_5_1 = 1869
|
---|
8683 | XML_SCHEMAV_CVC_COMPLEX_TYPE_5_2 = 1870
|
---|
8684 | XML_SCHEMAV_ELEMENT_CONTENT = 1871
|
---|
8685 | XML_SCHEMAV_DOCUMENT_ELEMENT_MISSING = 1872
|
---|
8686 | XML_SCHEMAV_CVC_COMPLEX_TYPE_1 = 1873
|
---|
8687 | XML_SCHEMAV_CVC_AU = 1874
|
---|
8688 | XML_SCHEMAV_CVC_TYPE_1 = 1875
|
---|
8689 | XML_SCHEMAV_CVC_TYPE_2 = 1876
|
---|
8690 | XML_SCHEMAV_CVC_IDC = 1877
|
---|
8691 | XML_SCHEMAV_CVC_WILDCARD = 1878
|
---|
8692 | XML_SCHEMAV_MISC = 1879
|
---|
8693 | XML_XPTR_UNKNOWN_SCHEME = 1900
|
---|
8694 | XML_XPTR_CHILDSEQ_START = 1901
|
---|
8695 | XML_XPTR_EVAL_FAILED = 1902
|
---|
8696 | XML_XPTR_EXTRA_OBJECTS = 1903
|
---|
8697 | XML_C14N_CREATE_CTXT = 1950
|
---|
8698 | XML_C14N_REQUIRES_UTF8 = 1951
|
---|
8699 | XML_C14N_CREATE_STACK = 1952
|
---|
8700 | XML_C14N_INVALID_NODE = 1953
|
---|
8701 | XML_C14N_UNKNOW_NODE = 1954
|
---|
8702 | XML_C14N_RELATIVE_NAMESPACE = 1955
|
---|
8703 | XML_FTP_PASV_ANSWER = 2000
|
---|
8704 | XML_FTP_EPSV_ANSWER = 2001
|
---|
8705 | XML_FTP_ACCNT = 2002
|
---|
8706 | XML_FTP_URL_SYNTAX = 2003
|
---|
8707 | XML_HTTP_URL_SYNTAX = 2020
|
---|
8708 | XML_HTTP_USE_IP = 2021
|
---|
8709 | XML_HTTP_UNKNOWN_HOST = 2022
|
---|
8710 | XML_SCHEMAP_SRC_SIMPLE_TYPE_1 = 3000
|
---|
8711 | XML_SCHEMAP_SRC_SIMPLE_TYPE_2 = 3001
|
---|
8712 | XML_SCHEMAP_SRC_SIMPLE_TYPE_3 = 3002
|
---|
8713 | XML_SCHEMAP_SRC_SIMPLE_TYPE_4 = 3003
|
---|
8714 | XML_SCHEMAP_SRC_RESOLVE = 3004
|
---|
8715 | XML_SCHEMAP_SRC_RESTRICTION_BASE_OR_SIMPLETYPE = 3005
|
---|
8716 | XML_SCHEMAP_SRC_LIST_ITEMTYPE_OR_SIMPLETYPE = 3006
|
---|
8717 | XML_SCHEMAP_SRC_UNION_MEMBERTYPES_OR_SIMPLETYPES = 3007
|
---|
8718 | XML_SCHEMAP_ST_PROPS_CORRECT_1 = 3008
|
---|
8719 | XML_SCHEMAP_ST_PROPS_CORRECT_2 = 3009
|
---|
8720 | XML_SCHEMAP_ST_PROPS_CORRECT_3 = 3010
|
---|
8721 | XML_SCHEMAP_COS_ST_RESTRICTS_1_1 = 3011
|
---|
8722 | XML_SCHEMAP_COS_ST_RESTRICTS_1_2 = 3012
|
---|
8723 | XML_SCHEMAP_COS_ST_RESTRICTS_1_3_1 = 3013
|
---|
8724 | XML_SCHEMAP_COS_ST_RESTRICTS_1_3_2 = 3014
|
---|
8725 | XML_SCHEMAP_COS_ST_RESTRICTS_2_1 = 3015
|
---|
8726 | XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_1 = 3016
|
---|
8727 | XML_SCHEMAP_COS_ST_RESTRICTS_2_3_1_2 = 3017
|
---|
8728 | XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_1 = 3018
|
---|
8729 | XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_2 = 3019
|
---|
8730 | XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_3 = 3020
|
---|
8731 | XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_4 = 3021
|
---|
8732 | XML_SCHEMAP_COS_ST_RESTRICTS_2_3_2_5 = 3022
|
---|
8733 | XML_SCHEMAP_COS_ST_RESTRICTS_3_1 = 3023
|
---|
8734 | XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1 = 3024
|
---|
8735 | XML_SCHEMAP_COS_ST_RESTRICTS_3_3_1_2 = 3025
|
---|
8736 | XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_2 = 3026
|
---|
8737 | XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_1 = 3027
|
---|
8738 | XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_3 = 3028
|
---|
8739 | XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_4 = 3029
|
---|
8740 | XML_SCHEMAP_COS_ST_RESTRICTS_3_3_2_5 = 3030
|
---|
8741 | XML_SCHEMAP_COS_ST_DERIVED_OK_2_1 = 3031
|
---|
8742 | XML_SCHEMAP_COS_ST_DERIVED_OK_2_2 = 3032
|
---|
8743 | XML_SCHEMAP_S4S_ELEM_NOT_ALLOWED = 3033
|
---|
8744 | XML_SCHEMAP_S4S_ELEM_MISSING = 3034
|
---|
8745 | XML_SCHEMAP_S4S_ATTR_NOT_ALLOWED = 3035
|
---|
8746 | XML_SCHEMAP_S4S_ATTR_MISSING = 3036
|
---|
8747 | XML_SCHEMAP_S4S_ATTR_INVALID_VALUE = 3037
|
---|
8748 | XML_SCHEMAP_SRC_ELEMENT_1 = 3038
|
---|
8749 | XML_SCHEMAP_SRC_ELEMENT_2_1 = 3039
|
---|
8750 | XML_SCHEMAP_SRC_ELEMENT_2_2 = 3040
|
---|
8751 | XML_SCHEMAP_SRC_ELEMENT_3 = 3041
|
---|
8752 | XML_SCHEMAP_P_PROPS_CORRECT_1 = 3042
|
---|
8753 | XML_SCHEMAP_P_PROPS_CORRECT_2_1 = 3043
|
---|
8754 | XML_SCHEMAP_P_PROPS_CORRECT_2_2 = 3044
|
---|
8755 | XML_SCHEMAP_E_PROPS_CORRECT_2 = 3045
|
---|
8756 | XML_SCHEMAP_E_PROPS_CORRECT_3 = 3046
|
---|
8757 | XML_SCHEMAP_E_PROPS_CORRECT_4 = 3047
|
---|
8758 | XML_SCHEMAP_E_PROPS_CORRECT_5 = 3048
|
---|
8759 | XML_SCHEMAP_E_PROPS_CORRECT_6 = 3049
|
---|
8760 | XML_SCHEMAP_SRC_INCLUDE = 3050
|
---|
8761 | XML_SCHEMAP_SRC_ATTRIBUTE_1 = 3051
|
---|
8762 | XML_SCHEMAP_SRC_ATTRIBUTE_2 = 3052
|
---|
8763 | XML_SCHEMAP_SRC_ATTRIBUTE_3_1 = 3053
|
---|
8764 | XML_SCHEMAP_SRC_ATTRIBUTE_3_2 = 3054
|
---|
8765 | XML_SCHEMAP_SRC_ATTRIBUTE_4 = 3055
|
---|
8766 | XML_SCHEMAP_NO_XMLNS = 3056
|
---|
8767 | XML_SCHEMAP_NO_XSI = 3057
|
---|
8768 | XML_SCHEMAP_COS_VALID_DEFAULT_1 = 3058
|
---|
8769 | XML_SCHEMAP_COS_VALID_DEFAULT_2_1 = 3059
|
---|
8770 | XML_SCHEMAP_COS_VALID_DEFAULT_2_2_1 = 3060
|
---|
8771 | XML_SCHEMAP_COS_VALID_DEFAULT_2_2_2 = 3061
|
---|
8772 | XML_SCHEMAP_CVC_SIMPLE_TYPE = 3062
|
---|
8773 | XML_SCHEMAP_COS_CT_EXTENDS_1_1 = 3063
|
---|
8774 | XML_SCHEMAP_SRC_IMPORT_1_1 = 3064
|
---|
8775 | XML_SCHEMAP_SRC_IMPORT_1_2 = 3065
|
---|
8776 | XML_SCHEMAP_SRC_IMPORT_2 = 3066
|
---|
8777 | XML_SCHEMAP_SRC_IMPORT_2_1 = 3067
|
---|
8778 | XML_SCHEMAP_SRC_IMPORT_2_2 = 3068
|
---|
8779 | XML_SCHEMAP_INTERNAL = 3069
|
---|
8780 | XML_SCHEMAP_NOT_DETERMINISTIC = 3070
|
---|
8781 | XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_1 = 3071
|
---|
8782 | XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_2 = 3072
|
---|
8783 | XML_SCHEMAP_SRC_ATTRIBUTE_GROUP_3 = 3073
|
---|
8784 | XML_SCHEMAP_MG_PROPS_CORRECT_1 = 3074
|
---|
8785 | XML_SCHEMAP_MG_PROPS_CORRECT_2 = 3075
|
---|
8786 | XML_SCHEMAP_SRC_CT_1 = 3076
|
---|
8787 | XML_SCHEMAP_DERIVATION_OK_RESTRICTION_2_1_3 = 3077
|
---|
8788 | XML_SCHEMAP_AU_PROPS_CORRECT_2 = 3078
|
---|
8789 | XML_SCHEMAP_A_PROPS_CORRECT_2 = 3079
|
---|
8790 | XML_SCHEMAP_C_PROPS_CORRECT = 3080
|
---|
8791 | XML_SCHEMAP_SRC_REDEFINE = 3081
|
---|
8792 | XML_SCHEMAP_SRC_IMPORT = 3082
|
---|
8793 | XML_SCHEMAP_WARN_SKIP_SCHEMA = 3083
|
---|
8794 | XML_SCHEMAP_WARN_UNLOCATED_SCHEMA = 3084
|
---|
8795 | XML_SCHEMAP_WARN_ATTR_REDECL_PROH = 3085
|
---|
8796 | XML_SCHEMAP_WARN_ATTR_POINTLESS_PROH = 3086
|
---|
8797 | XML_SCHEMAP_AG_PROPS_CORRECT = 3087
|
---|
8798 | XML_SCHEMAP_COS_CT_EXTENDS_1_2 = 3088
|
---|
8799 | XML_SCHEMAP_AU_PROPS_CORRECT = 3089
|
---|
8800 | XML_SCHEMAP_A_PROPS_CORRECT_3 = 3090
|
---|
8801 | XML_SCHEMAP_COS_ALL_LIMITED = 3091
|
---|
8802 | XML_SCHEMATRONV_ASSERT = 4000
|
---|
8803 | XML_SCHEMATRONV_REPORT = 4001
|
---|
8804 | XML_MODULE_OPEN = 4900
|
---|
8805 | XML_MODULE_CLOSE = 4901
|
---|
8806 | XML_CHECK_FOUND_ELEMENT = 5000
|
---|
8807 | XML_CHECK_FOUND_ATTRIBUTE = 5001
|
---|
8808 | XML_CHECK_FOUND_TEXT = 5002
|
---|
8809 | XML_CHECK_FOUND_CDATA = 5003
|
---|
8810 | XML_CHECK_FOUND_ENTITYREF = 5004
|
---|
8811 | XML_CHECK_FOUND_ENTITY = 5005
|
---|
8812 | XML_CHECK_FOUND_PI = 5006
|
---|
8813 | XML_CHECK_FOUND_COMMENT = 5007
|
---|
8814 | XML_CHECK_FOUND_DOCTYPE = 5008
|
---|
8815 | XML_CHECK_FOUND_FRAGMENT = 5009
|
---|
8816 | XML_CHECK_FOUND_NOTATION = 5010
|
---|
8817 | XML_CHECK_UNKNOWN_NODE = 5011
|
---|
8818 | XML_CHECK_ENTITY_TYPE = 5012
|
---|
8819 | XML_CHECK_NO_PARENT = 5013
|
---|
8820 | XML_CHECK_NO_DOC = 5014
|
---|
8821 | XML_CHECK_NO_NAME = 5015
|
---|
8822 | XML_CHECK_NO_ELEM = 5016
|
---|
8823 | XML_CHECK_WRONG_DOC = 5017
|
---|
8824 | XML_CHECK_NO_PREV = 5018
|
---|
8825 | XML_CHECK_WRONG_PREV = 5019
|
---|
8826 | XML_CHECK_NO_NEXT = 5020
|
---|
8827 | XML_CHECK_WRONG_NEXT = 5021
|
---|
8828 | XML_CHECK_NOT_DTD = 5022
|
---|
8829 | XML_CHECK_NOT_ATTR = 5023
|
---|
8830 | XML_CHECK_NOT_ATTR_DECL = 5024
|
---|
8831 | XML_CHECK_NOT_ELEM_DECL = 5025
|
---|
8832 | XML_CHECK_NOT_ENTITY_DECL = 5026
|
---|
8833 | XML_CHECK_NOT_NS_DECL = 5027
|
---|
8834 | XML_CHECK_NO_HREF = 5028
|
---|
8835 | XML_CHECK_WRONG_PARENT = 5029
|
---|
8836 | XML_CHECK_NS_SCOPE = 5030
|
---|
8837 | XML_CHECK_NS_ANCESTOR = 5031
|
---|
8838 | XML_CHECK_NOT_UTF8 = 5032
|
---|
8839 | XML_CHECK_NO_DICT = 5033
|
---|
8840 | XML_CHECK_NOT_NCNAME = 5034
|
---|
8841 | XML_CHECK_OUTSIDE_DICT = 5035
|
---|
8842 | XML_CHECK_WRONG_NAME = 5036
|
---|
8843 | XML_CHECK_NAME_NOT_NULL = 5037
|
---|
8844 | XML_I18N_NO_NAME = 6000
|
---|
8845 | XML_I18N_NO_HANDLER = 6001
|
---|
8846 | XML_I18N_EXCESS_HANDLER = 6002
|
---|
8847 | XML_I18N_CONV_FAILED = 6003
|
---|
8848 | XML_I18N_NO_OUTPUT = 6004
|
---|
8849 | XML_BUF_OVERFLOW = 7000
|
---|
8850 |
|
---|
8851 | # xmlExpNodeType
|
---|
8852 | XML_EXP_EMPTY = 0
|
---|
8853 | XML_EXP_FORBID = 1
|
---|
8854 | XML_EXP_ATOM = 2
|
---|
8855 | XML_EXP_SEQ = 3
|
---|
8856 | XML_EXP_OR = 4
|
---|
8857 | XML_EXP_COUNT = 5
|
---|
8858 |
|
---|
8859 | # xmlElementContentType
|
---|
8860 | XML_ELEMENT_CONTENT_PCDATA = 1
|
---|
8861 | XML_ELEMENT_CONTENT_ELEMENT = 2
|
---|
8862 | XML_ELEMENT_CONTENT_SEQ = 3
|
---|
8863 | XML_ELEMENT_CONTENT_OR = 4
|
---|
8864 |
|
---|
8865 | # xmlParserProperties
|
---|
8866 | XML_PARSER_LOADDTD = 1
|
---|
8867 | XML_PARSER_DEFAULTATTRS = 2
|
---|
8868 | XML_PARSER_VALIDATE = 3
|
---|
8869 | XML_PARSER_SUBST_ENTITIES = 4
|
---|
8870 |
|
---|
8871 | # xmlReaderTypes
|
---|
8872 | XML_READER_TYPE_NONE = 0
|
---|
8873 | XML_READER_TYPE_ELEMENT = 1
|
---|
8874 | XML_READER_TYPE_ATTRIBUTE = 2
|
---|
8875 | XML_READER_TYPE_TEXT = 3
|
---|
8876 | XML_READER_TYPE_CDATA = 4
|
---|
8877 | XML_READER_TYPE_ENTITY_REFERENCE = 5
|
---|
8878 | XML_READER_TYPE_ENTITY = 6
|
---|
8879 | XML_READER_TYPE_PROCESSING_INSTRUCTION = 7
|
---|
8880 | XML_READER_TYPE_COMMENT = 8
|
---|
8881 | XML_READER_TYPE_DOCUMENT = 9
|
---|
8882 | XML_READER_TYPE_DOCUMENT_TYPE = 10
|
---|
8883 | XML_READER_TYPE_DOCUMENT_FRAGMENT = 11
|
---|
8884 | XML_READER_TYPE_NOTATION = 12
|
---|
8885 | XML_READER_TYPE_WHITESPACE = 13
|
---|
8886 | XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14
|
---|
8887 | XML_READER_TYPE_END_ELEMENT = 15
|
---|
8888 | XML_READER_TYPE_END_ENTITY = 16
|
---|
8889 | XML_READER_TYPE_XML_DECLARATION = 17
|
---|
8890 |
|
---|
8891 | # xmlCatalogPrefer
|
---|
8892 | XML_CATA_PREFER_NONE = 0
|
---|
8893 | XML_CATA_PREFER_PUBLIC = 1
|
---|
8894 | XML_CATA_PREFER_SYSTEM = 2
|
---|
8895 |
|
---|
8896 | # xmlElementType
|
---|
8897 | XML_ELEMENT_NODE = 1
|
---|
8898 | XML_ATTRIBUTE_NODE = 2
|
---|
8899 | XML_TEXT_NODE = 3
|
---|
8900 | XML_CDATA_SECTION_NODE = 4
|
---|
8901 | XML_ENTITY_REF_NODE = 5
|
---|
8902 | XML_ENTITY_NODE = 6
|
---|
8903 | XML_PI_NODE = 7
|
---|
8904 | XML_COMMENT_NODE = 8
|
---|
8905 | XML_DOCUMENT_NODE = 9
|
---|
8906 | XML_DOCUMENT_TYPE_NODE = 10
|
---|
8907 | XML_DOCUMENT_FRAG_NODE = 11
|
---|
8908 | XML_NOTATION_NODE = 12
|
---|
8909 | XML_HTML_DOCUMENT_NODE = 13
|
---|
8910 | XML_DTD_NODE = 14
|
---|
8911 | XML_ELEMENT_DECL = 15
|
---|
8912 | XML_ATTRIBUTE_DECL = 16
|
---|
8913 | XML_ENTITY_DECL = 17
|
---|
8914 | XML_NAMESPACE_DECL = 18
|
---|
8915 | XML_XINCLUDE_START = 19
|
---|
8916 | XML_XINCLUDE_END = 20
|
---|
8917 | XML_DOCB_DOCUMENT_NODE = 21
|
---|
8918 |
|
---|
8919 | # xlinkActuate
|
---|
8920 | XLINK_ACTUATE_NONE = 0
|
---|
8921 | XLINK_ACTUATE_AUTO = 1
|
---|
8922 | XLINK_ACTUATE_ONREQUEST = 2
|
---|
8923 |
|
---|
8924 | # xmlFeature
|
---|
8925 | XML_WITH_THREAD = 1
|
---|
8926 | XML_WITH_TREE = 2
|
---|
8927 | XML_WITH_OUTPUT = 3
|
---|
8928 | XML_WITH_PUSH = 4
|
---|
8929 | XML_WITH_READER = 5
|
---|
8930 | XML_WITH_PATTERN = 6
|
---|
8931 | XML_WITH_WRITER = 7
|
---|
8932 | XML_WITH_SAX1 = 8
|
---|
8933 | XML_WITH_FTP = 9
|
---|
8934 | XML_WITH_HTTP = 10
|
---|
8935 | XML_WITH_VALID = 11
|
---|
8936 | XML_WITH_HTML = 12
|
---|
8937 | XML_WITH_LEGACY = 13
|
---|
8938 | XML_WITH_C14N = 14
|
---|
8939 | XML_WITH_CATALOG = 15
|
---|
8940 | XML_WITH_XPATH = 16
|
---|
8941 | XML_WITH_XPTR = 17
|
---|
8942 | XML_WITH_XINCLUDE = 18
|
---|
8943 | XML_WITH_ICONV = 19
|
---|
8944 | XML_WITH_ISO8859X = 20
|
---|
8945 | XML_WITH_UNICODE = 21
|
---|
8946 | XML_WITH_REGEXP = 22
|
---|
8947 | XML_WITH_AUTOMATA = 23
|
---|
8948 | XML_WITH_EXPR = 24
|
---|
8949 | XML_WITH_SCHEMAS = 25
|
---|
8950 | XML_WITH_SCHEMATRON = 26
|
---|
8951 | XML_WITH_MODULES = 27
|
---|
8952 | XML_WITH_DEBUG = 28
|
---|
8953 | XML_WITH_DEBUG_MEM = 29
|
---|
8954 | XML_WITH_DEBUG_RUN = 30
|
---|
8955 | XML_WITH_ZLIB = 31
|
---|
8956 | XML_WITH_ICU = 32
|
---|
8957 | XML_WITH_LZMA = 33
|
---|
8958 | XML_WITH_NONE = 99999
|
---|
8959 |
|
---|
8960 | # xmlElementContentOccur
|
---|
8961 | XML_ELEMENT_CONTENT_ONCE = 1
|
---|
8962 | XML_ELEMENT_CONTENT_OPT = 2
|
---|
8963 | XML_ELEMENT_CONTENT_MULT = 3
|
---|
8964 | XML_ELEMENT_CONTENT_PLUS = 4
|
---|
8965 |
|
---|
8966 | # xmlXPathError
|
---|
8967 | XPATH_EXPRESSION_OK = 0
|
---|
8968 | XPATH_NUMBER_ERROR = 1
|
---|
8969 | XPATH_UNFINISHED_LITERAL_ERROR = 2
|
---|
8970 | XPATH_START_LITERAL_ERROR = 3
|
---|
8971 | XPATH_VARIABLE_REF_ERROR = 4
|
---|
8972 | XPATH_UNDEF_VARIABLE_ERROR = 5
|
---|
8973 | XPATH_INVALID_PREDICATE_ERROR = 6
|
---|
8974 | XPATH_EXPR_ERROR = 7
|
---|
8975 | XPATH_UNCLOSED_ERROR = 8
|
---|
8976 | XPATH_UNKNOWN_FUNC_ERROR = 9
|
---|
8977 | XPATH_INVALID_OPERAND = 10
|
---|
8978 | XPATH_INVALID_TYPE = 11
|
---|
8979 | XPATH_INVALID_ARITY = 12
|
---|
8980 | XPATH_INVALID_CTXT_SIZE = 13
|
---|
8981 | XPATH_INVALID_CTXT_POSITION = 14
|
---|
8982 | XPATH_MEMORY_ERROR = 15
|
---|
8983 | XPTR_SYNTAX_ERROR = 16
|
---|
8984 | XPTR_RESOURCE_ERROR = 17
|
---|
8985 | XPTR_SUB_RESOURCE_ERROR = 18
|
---|
8986 | XPATH_UNDEF_PREFIX_ERROR = 19
|
---|
8987 | XPATH_ENCODING_ERROR = 20
|
---|
8988 | XPATH_INVALID_CHAR_ERROR = 21
|
---|
8989 | XPATH_INVALID_CTXT = 22
|
---|
8990 | XPATH_STACK_ERROR = 23
|
---|
8991 | XPATH_FORBID_VARIABLE_ERROR = 24
|
---|
8992 |
|
---|
8993 | # xmlTextReaderMode
|
---|
8994 | XML_TEXTREADER_MODE_INITIAL = 0
|
---|
8995 | XML_TEXTREADER_MODE_INTERACTIVE = 1
|
---|
8996 | XML_TEXTREADER_MODE_ERROR = 2
|
---|
8997 | XML_TEXTREADER_MODE_EOF = 3
|
---|
8998 | XML_TEXTREADER_MODE_CLOSED = 4
|
---|
8999 | XML_TEXTREADER_MODE_READING = 5
|
---|
9000 |
|
---|
9001 | # xmlErrorLevel
|
---|
9002 | XML_ERR_NONE = 0
|
---|
9003 | XML_ERR_WARNING = 1
|
---|
9004 | XML_ERR_ERROR = 2
|
---|
9005 | XML_ERR_FATAL = 3
|
---|
9006 |
|
---|
9007 | # xmlCharEncoding
|
---|
9008 | XML_CHAR_ENCODING_ERROR = -1
|
---|
9009 | XML_CHAR_ENCODING_NONE = 0
|
---|
9010 | XML_CHAR_ENCODING_UTF8 = 1
|
---|
9011 | XML_CHAR_ENCODING_UTF16LE = 2
|
---|
9012 | XML_CHAR_ENCODING_UTF16BE = 3
|
---|
9013 | XML_CHAR_ENCODING_UCS4LE = 4
|
---|
9014 | XML_CHAR_ENCODING_UCS4BE = 5
|
---|
9015 | XML_CHAR_ENCODING_EBCDIC = 6
|
---|
9016 | XML_CHAR_ENCODING_UCS4_2143 = 7
|
---|
9017 | XML_CHAR_ENCODING_UCS4_3412 = 8
|
---|
9018 | XML_CHAR_ENCODING_UCS2 = 9
|
---|
9019 | XML_CHAR_ENCODING_8859_1 = 10
|
---|
9020 | XML_CHAR_ENCODING_8859_2 = 11
|
---|
9021 | XML_CHAR_ENCODING_8859_3 = 12
|
---|
9022 | XML_CHAR_ENCODING_8859_4 = 13
|
---|
9023 | XML_CHAR_ENCODING_8859_5 = 14
|
---|
9024 | XML_CHAR_ENCODING_8859_6 = 15
|
---|
9025 | XML_CHAR_ENCODING_8859_7 = 16
|
---|
9026 | XML_CHAR_ENCODING_8859_8 = 17
|
---|
9027 | XML_CHAR_ENCODING_8859_9 = 18
|
---|
9028 | XML_CHAR_ENCODING_2022_JP = 19
|
---|
9029 | XML_CHAR_ENCODING_SHIFT_JIS = 20
|
---|
9030 | XML_CHAR_ENCODING_EUC_JP = 21
|
---|
9031 | XML_CHAR_ENCODING_ASCII = 22
|
---|
9032 |
|
---|
9033 | # xmlErrorDomain
|
---|
9034 | XML_FROM_NONE = 0
|
---|
9035 | XML_FROM_PARSER = 1
|
---|
9036 | XML_FROM_TREE = 2
|
---|
9037 | XML_FROM_NAMESPACE = 3
|
---|
9038 | XML_FROM_DTD = 4
|
---|
9039 | XML_FROM_HTML = 5
|
---|
9040 | XML_FROM_MEMORY = 6
|
---|
9041 | XML_FROM_OUTPUT = 7
|
---|
9042 | XML_FROM_IO = 8
|
---|
9043 | XML_FROM_FTP = 9
|
---|
9044 | XML_FROM_HTTP = 10
|
---|
9045 | XML_FROM_XINCLUDE = 11
|
---|
9046 | XML_FROM_XPATH = 12
|
---|
9047 | XML_FROM_XPOINTER = 13
|
---|
9048 | XML_FROM_REGEXP = 14
|
---|
9049 | XML_FROM_DATATYPE = 15
|
---|
9050 | XML_FROM_SCHEMASP = 16
|
---|
9051 | XML_FROM_SCHEMASV = 17
|
---|
9052 | XML_FROM_RELAXNGP = 18
|
---|
9053 | XML_FROM_RELAXNGV = 19
|
---|
9054 | XML_FROM_CATALOG = 20
|
---|
9055 | XML_FROM_C14N = 21
|
---|
9056 | XML_FROM_XSLT = 22
|
---|
9057 | XML_FROM_VALID = 23
|
---|
9058 | XML_FROM_CHECK = 24
|
---|
9059 | XML_FROM_WRITER = 25
|
---|
9060 | XML_FROM_MODULE = 26
|
---|
9061 | XML_FROM_I18N = 27
|
---|
9062 | XML_FROM_SCHEMATRONV = 28
|
---|
9063 | XML_FROM_BUFFER = 29
|
---|
9064 | XML_FROM_URI = 30
|
---|
9065 |
|
---|
9066 | # htmlStatus
|
---|
9067 | HTML_NA = 0
|
---|
9068 | HTML_INVALID = 1
|
---|
9069 | HTML_DEPRECATED = 2
|
---|
9070 | HTML_VALID = 4
|
---|
9071 | HTML_REQUIRED = 12
|
---|
9072 |
|
---|
9073 | # xmlSchemaValidOption
|
---|
9074 | XML_SCHEMA_VAL_VC_I_CREATE = 1
|
---|
9075 |
|
---|
9076 | # xmlSchemaWhitespaceValueType
|
---|
9077 | XML_SCHEMA_WHITESPACE_UNKNOWN = 0
|
---|
9078 | XML_SCHEMA_WHITESPACE_PRESERVE = 1
|
---|
9079 | XML_SCHEMA_WHITESPACE_REPLACE = 2
|
---|
9080 | XML_SCHEMA_WHITESPACE_COLLAPSE = 3
|
---|
9081 |
|
---|
9082 | # htmlParserOption
|
---|
9083 | HTML_PARSE_RECOVER = 1
|
---|
9084 | HTML_PARSE_NODEFDTD = 4
|
---|
9085 | HTML_PARSE_NOERROR = 32
|
---|
9086 | HTML_PARSE_NOWARNING = 64
|
---|
9087 | HTML_PARSE_PEDANTIC = 128
|
---|
9088 | HTML_PARSE_NOBLANKS = 256
|
---|
9089 | HTML_PARSE_NONET = 2048
|
---|
9090 | HTML_PARSE_NOIMPLIED = 8192
|
---|
9091 | HTML_PARSE_COMPACT = 65536
|
---|
9092 | HTML_PARSE_IGNORE_ENC = 2097152
|
---|
9093 |
|
---|
9094 | # xmlRelaxNGValidErr
|
---|
9095 | XML_RELAXNG_OK = 0
|
---|
9096 | XML_RELAXNG_ERR_MEMORY = 1
|
---|
9097 | XML_RELAXNG_ERR_TYPE = 2
|
---|
9098 | XML_RELAXNG_ERR_TYPEVAL = 3
|
---|
9099 | XML_RELAXNG_ERR_DUPID = 4
|
---|
9100 | XML_RELAXNG_ERR_TYPECMP = 5
|
---|
9101 | XML_RELAXNG_ERR_NOSTATE = 6
|
---|
9102 | XML_RELAXNG_ERR_NODEFINE = 7
|
---|
9103 | XML_RELAXNG_ERR_LISTEXTRA = 8
|
---|
9104 | XML_RELAXNG_ERR_LISTEMPTY = 9
|
---|
9105 | XML_RELAXNG_ERR_INTERNODATA = 10
|
---|
9106 | XML_RELAXNG_ERR_INTERSEQ = 11
|
---|
9107 | XML_RELAXNG_ERR_INTEREXTRA = 12
|
---|
9108 | XML_RELAXNG_ERR_ELEMNAME = 13
|
---|
9109 | XML_RELAXNG_ERR_ATTRNAME = 14
|
---|
9110 | XML_RELAXNG_ERR_ELEMNONS = 15
|
---|
9111 | XML_RELAXNG_ERR_ATTRNONS = 16
|
---|
9112 | XML_RELAXNG_ERR_ELEMWRONGNS = 17
|
---|
9113 | XML_RELAXNG_ERR_ATTRWRONGNS = 18
|
---|
9114 | XML_RELAXNG_ERR_ELEMEXTRANS = 19
|
---|
9115 | XML_RELAXNG_ERR_ATTREXTRANS = 20
|
---|
9116 | XML_RELAXNG_ERR_ELEMNOTEMPTY = 21
|
---|
9117 | XML_RELAXNG_ERR_NOELEM = 22
|
---|
9118 | XML_RELAXNG_ERR_NOTELEM = 23
|
---|
9119 | XML_RELAXNG_ERR_ATTRVALID = 24
|
---|
9120 | XML_RELAXNG_ERR_CONTENTVALID = 25
|
---|
9121 | XML_RELAXNG_ERR_EXTRACONTENT = 26
|
---|
9122 | XML_RELAXNG_ERR_INVALIDATTR = 27
|
---|
9123 | XML_RELAXNG_ERR_DATAELEM = 28
|
---|
9124 | XML_RELAXNG_ERR_VALELEM = 29
|
---|
9125 | XML_RELAXNG_ERR_LISTELEM = 30
|
---|
9126 | XML_RELAXNG_ERR_DATATYPE = 31
|
---|
9127 | XML_RELAXNG_ERR_VALUE = 32
|
---|
9128 | XML_RELAXNG_ERR_LIST = 33
|
---|
9129 | XML_RELAXNG_ERR_NOGRAMMAR = 34
|
---|
9130 | XML_RELAXNG_ERR_EXTRADATA = 35
|
---|
9131 | XML_RELAXNG_ERR_LACKDATA = 36
|
---|
9132 | XML_RELAXNG_ERR_INTERNAL = 37
|
---|
9133 | XML_RELAXNG_ERR_ELEMWRONG = 38
|
---|
9134 | XML_RELAXNG_ERR_TEXTWRONG = 39
|
---|
9135 |
|
---|
9136 | # xmlCatalogAllow
|
---|
9137 | XML_CATA_ALLOW_NONE = 0
|
---|
9138 | XML_CATA_ALLOW_GLOBAL = 1
|
---|
9139 | XML_CATA_ALLOW_DOCUMENT = 2
|
---|
9140 | XML_CATA_ALLOW_ALL = 3
|
---|
9141 |
|
---|
9142 | # xmlAttributeType
|
---|
9143 | XML_ATTRIBUTE_CDATA = 1
|
---|
9144 | XML_ATTRIBUTE_ID = 2
|
---|
9145 | XML_ATTRIBUTE_IDREF = 3
|
---|
9146 | XML_ATTRIBUTE_IDREFS = 4
|
---|
9147 | XML_ATTRIBUTE_ENTITY = 5
|
---|
9148 | XML_ATTRIBUTE_ENTITIES = 6
|
---|
9149 | XML_ATTRIBUTE_NMTOKEN = 7
|
---|
9150 | XML_ATTRIBUTE_NMTOKENS = 8
|
---|
9151 | XML_ATTRIBUTE_ENUMERATION = 9
|
---|
9152 | XML_ATTRIBUTE_NOTATION = 10
|
---|
9153 |
|
---|
9154 | # xmlSchematronValidOptions
|
---|
9155 | XML_SCHEMATRON_OUT_QUIET = 1
|
---|
9156 | XML_SCHEMATRON_OUT_TEXT = 2
|
---|
9157 | XML_SCHEMATRON_OUT_XML = 4
|
---|
9158 | XML_SCHEMATRON_OUT_ERROR = 8
|
---|
9159 | XML_SCHEMATRON_OUT_FILE = 256
|
---|
9160 | XML_SCHEMATRON_OUT_BUFFER = 512
|
---|
9161 | XML_SCHEMATRON_OUT_IO = 1024
|
---|
9162 |
|
---|
9163 | # xmlSchemaContentType
|
---|
9164 | XML_SCHEMA_CONTENT_UNKNOWN = 0
|
---|
9165 | XML_SCHEMA_CONTENT_EMPTY = 1
|
---|
9166 | XML_SCHEMA_CONTENT_ELEMENTS = 2
|
---|
9167 | XML_SCHEMA_CONTENT_MIXED = 3
|
---|
9168 | XML_SCHEMA_CONTENT_SIMPLE = 4
|
---|
9169 | XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS = 5
|
---|
9170 | XML_SCHEMA_CONTENT_BASIC = 6
|
---|
9171 | XML_SCHEMA_CONTENT_ANY = 7
|
---|
9172 |
|
---|
9173 | # xmlSchemaTypeType
|
---|
9174 | XML_SCHEMA_TYPE_BASIC = 1
|
---|
9175 | XML_SCHEMA_TYPE_ANY = 2
|
---|
9176 | XML_SCHEMA_TYPE_FACET = 3
|
---|
9177 | XML_SCHEMA_TYPE_SIMPLE = 4
|
---|
9178 | XML_SCHEMA_TYPE_COMPLEX = 5
|
---|
9179 | XML_SCHEMA_TYPE_SEQUENCE = 6
|
---|
9180 | XML_SCHEMA_TYPE_CHOICE = 7
|
---|
9181 | XML_SCHEMA_TYPE_ALL = 8
|
---|
9182 | XML_SCHEMA_TYPE_SIMPLE_CONTENT = 9
|
---|
9183 | XML_SCHEMA_TYPE_COMPLEX_CONTENT = 10
|
---|
9184 | XML_SCHEMA_TYPE_UR = 11
|
---|
9185 | XML_SCHEMA_TYPE_RESTRICTION = 12
|
---|
9186 | XML_SCHEMA_TYPE_EXTENSION = 13
|
---|
9187 | XML_SCHEMA_TYPE_ELEMENT = 14
|
---|
9188 | XML_SCHEMA_TYPE_ATTRIBUTE = 15
|
---|
9189 | XML_SCHEMA_TYPE_ATTRIBUTEGROUP = 16
|
---|
9190 | XML_SCHEMA_TYPE_GROUP = 17
|
---|
9191 | XML_SCHEMA_TYPE_NOTATION = 18
|
---|
9192 | XML_SCHEMA_TYPE_LIST = 19
|
---|
9193 | XML_SCHEMA_TYPE_UNION = 20
|
---|
9194 | XML_SCHEMA_TYPE_ANY_ATTRIBUTE = 21
|
---|
9195 | XML_SCHEMA_TYPE_IDC_UNIQUE = 22
|
---|
9196 | XML_SCHEMA_TYPE_IDC_KEY = 23
|
---|
9197 | XML_SCHEMA_TYPE_IDC_KEYREF = 24
|
---|
9198 | XML_SCHEMA_TYPE_PARTICLE = 25
|
---|
9199 | XML_SCHEMA_TYPE_ATTRIBUTE_USE = 26
|
---|
9200 | XML_SCHEMA_FACET_MININCLUSIVE = 1000
|
---|
9201 | XML_SCHEMA_FACET_MINEXCLUSIVE = 1001
|
---|
9202 | XML_SCHEMA_FACET_MAXINCLUSIVE = 1002
|
---|
9203 | XML_SCHEMA_FACET_MAXEXCLUSIVE = 1003
|
---|
9204 | XML_SCHEMA_FACET_TOTALDIGITS = 1004
|
---|
9205 | XML_SCHEMA_FACET_FRACTIONDIGITS = 1005
|
---|
9206 | XML_SCHEMA_FACET_PATTERN = 1006
|
---|
9207 | XML_SCHEMA_FACET_ENUMERATION = 1007
|
---|
9208 | XML_SCHEMA_FACET_WHITESPACE = 1008
|
---|
9209 | XML_SCHEMA_FACET_LENGTH = 1009
|
---|
9210 | XML_SCHEMA_FACET_MAXLENGTH = 1010
|
---|
9211 | XML_SCHEMA_FACET_MINLENGTH = 1011
|
---|
9212 | XML_SCHEMA_EXTRA_QNAMEREF = 2000
|
---|
9213 | XML_SCHEMA_EXTRA_ATTR_USE_PROHIB = 2001
|
---|
9214 |
|
---|
9215 | # xmlModuleOption
|
---|
9216 | XML_MODULE_LAZY = 1
|
---|
9217 | XML_MODULE_LOCAL = 2
|
---|
9218 |
|
---|
9219 | # xmlParserMode
|
---|
9220 | XML_PARSE_UNKNOWN = 0
|
---|
9221 | XML_PARSE_DOM = 1
|
---|
9222 | XML_PARSE_SAX = 2
|
---|
9223 | XML_PARSE_PUSH_DOM = 3
|
---|
9224 | XML_PARSE_PUSH_SAX = 4
|
---|
9225 | XML_PARSE_READER = 5
|
---|
9226 |
|
---|
9227 | # xmlC14NMode
|
---|
9228 | XML_C14N_1_0 = 0
|
---|
9229 | XML_C14N_EXCLUSIVE_1_0 = 1
|
---|
9230 | XML_C14N_1_1 = 2
|
---|
9231 |
|
---|
9232 | # xmlParserOption
|
---|
9233 | XML_PARSE_RECOVER = 1
|
---|
9234 | XML_PARSE_NOENT = 2
|
---|
9235 | XML_PARSE_DTDLOAD = 4
|
---|
9236 | XML_PARSE_DTDATTR = 8
|
---|
9237 | XML_PARSE_DTDVALID = 16
|
---|
9238 | XML_PARSE_NOERROR = 32
|
---|
9239 | XML_PARSE_NOWARNING = 64
|
---|
9240 | XML_PARSE_PEDANTIC = 128
|
---|
9241 | XML_PARSE_NOBLANKS = 256
|
---|
9242 | XML_PARSE_SAX1 = 512
|
---|
9243 | XML_PARSE_XINCLUDE = 1024
|
---|
9244 | XML_PARSE_NONET = 2048
|
---|
9245 | XML_PARSE_NODICT = 4096
|
---|
9246 | XML_PARSE_NSCLEAN = 8192
|
---|
9247 | XML_PARSE_NOCDATA = 16384
|
---|
9248 | XML_PARSE_NOXINCNODE = 32768
|
---|
9249 | XML_PARSE_COMPACT = 65536
|
---|
9250 | XML_PARSE_OLD10 = 131072
|
---|
9251 | XML_PARSE_NOBASEFIX = 262144
|
---|
9252 | XML_PARSE_HUGE = 524288
|
---|
9253 | XML_PARSE_OLDSAX = 1048576
|
---|
9254 | XML_PARSE_IGNORE_ENC = 2097152
|
---|
9255 | XML_PARSE_BIG_LINES = 4194304
|
---|
9256 |
|
---|
9257 | # xmlElementTypeVal
|
---|
9258 | XML_ELEMENT_TYPE_UNDEFINED = 0
|
---|
9259 | XML_ELEMENT_TYPE_EMPTY = 1
|
---|
9260 | XML_ELEMENT_TYPE_ANY = 2
|
---|
9261 | XML_ELEMENT_TYPE_MIXED = 3
|
---|
9262 | XML_ELEMENT_TYPE_ELEMENT = 4
|
---|
9263 |
|
---|
9264 | # xmlDocProperties
|
---|
9265 | XML_DOC_WELLFORMED = 1
|
---|
9266 | XML_DOC_NSVALID = 2
|
---|
9267 | XML_DOC_OLD10 = 4
|
---|
9268 | XML_DOC_DTDVALID = 8
|
---|
9269 | XML_DOC_XINCLUDE = 16
|
---|
9270 | XML_DOC_USERBUILT = 32
|
---|
9271 | XML_DOC_INTERNAL = 64
|
---|
9272 | XML_DOC_HTML = 128
|
---|
9273 |
|
---|
9274 | # xlinkType
|
---|
9275 | XLINK_TYPE_NONE = 0
|
---|
9276 | XLINK_TYPE_SIMPLE = 1
|
---|
9277 | XLINK_TYPE_EXTENDED = 2
|
---|
9278 | XLINK_TYPE_EXTENDED_SET = 3
|
---|
9279 |
|
---|
9280 | # xmlXPathObjectType
|
---|
9281 | XPATH_UNDEFINED = 0
|
---|
9282 | XPATH_NODESET = 1
|
---|
9283 | XPATH_BOOLEAN = 2
|
---|
9284 | XPATH_NUMBER = 3
|
---|
9285 | XPATH_STRING = 4
|
---|
9286 | XPATH_POINT = 5
|
---|
9287 | XPATH_RANGE = 6
|
---|
9288 | XPATH_LOCATIONSET = 7
|
---|
9289 | XPATH_USERS = 8
|
---|
9290 | XPATH_XSLT_TREE = 9
|
---|
9291 |
|
---|
9292 | # xmlSchemaValidError
|
---|
9293 | XML_SCHEMAS_ERR_OK = 0
|
---|
9294 | XML_SCHEMAS_ERR_NOROOT = 1
|
---|
9295 | XML_SCHEMAS_ERR_UNDECLAREDELEM = 2
|
---|
9296 | XML_SCHEMAS_ERR_NOTTOPLEVEL = 3
|
---|
9297 | XML_SCHEMAS_ERR_MISSING = 4
|
---|
9298 | XML_SCHEMAS_ERR_WRONGELEM = 5
|
---|
9299 | XML_SCHEMAS_ERR_NOTYPE = 6
|
---|
9300 | XML_SCHEMAS_ERR_NOROLLBACK = 7
|
---|
9301 | XML_SCHEMAS_ERR_ISABSTRACT = 8
|
---|
9302 | XML_SCHEMAS_ERR_NOTEMPTY = 9
|
---|
9303 | XML_SCHEMAS_ERR_ELEMCONT = 10
|
---|
9304 | XML_SCHEMAS_ERR_HAVEDEFAULT = 11
|
---|
9305 | XML_SCHEMAS_ERR_NOTNILLABLE = 12
|
---|
9306 | XML_SCHEMAS_ERR_EXTRACONTENT = 13
|
---|
9307 | XML_SCHEMAS_ERR_INVALIDATTR = 14
|
---|
9308 | XML_SCHEMAS_ERR_INVALIDELEM = 15
|
---|
9309 | XML_SCHEMAS_ERR_NOTDETERMINIST = 16
|
---|
9310 | XML_SCHEMAS_ERR_CONSTRUCT = 17
|
---|
9311 | XML_SCHEMAS_ERR_INTERNAL = 18
|
---|
9312 | XML_SCHEMAS_ERR_NOTSIMPLE = 19
|
---|
9313 | XML_SCHEMAS_ERR_ATTRUNKNOWN = 20
|
---|
9314 | XML_SCHEMAS_ERR_ATTRINVALID = 21
|
---|
9315 | XML_SCHEMAS_ERR_VALUE = 22
|
---|
9316 | XML_SCHEMAS_ERR_FACET = 23
|
---|
9317 | XML_SCHEMAS_ERR_ = 24
|
---|
9318 | XML_SCHEMAS_ERR_XXX = 25
|
---|
9319 |
|
---|