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