Python bindings: DOM casts everything to xmlNode

I noticed another issue with Python bindings of libxml: the access methods do
not cast the pointers to specific classes such as xmlDtd, xmlEntityDecl, etc.
For example, with the following document:

<?xml version="1.0"?>
<!DOCTYPE root [<!ELEMENT root EMPTY>]>
<root/>

the following script:

import libxml2
doc = libxml2.readFile("c.xml", None, libxml2.XML_PARSE_DTDLOAD)
print repr(doc.children)

prints:

<xmlNode (root) object at 0xb74963ec>

With properly cast nodes, it outputs the following:

<xmlDtd (root) object at 0xb746352c>

The latter object (xmlDtd) enables one to use DTD-specific methods such as
debugDumpDTD(), copyDTD(), and so on.
1 file changed
tree: 273d6540ccce5201060742c7e5664540373068a3
  1. bakefile/
  2. doc/
  3. example/
  4. include/
  5. macos/
  6. optim/
  7. python/
  8. result/
  9. test/
  10. vms/
  11. VxWorks/
  12. win32/
  13. xstc/
  14. .gitignore
  15. acinclude.m4
  16. AUTHORS
  17. autogen.sh
  18. buf.c
  19. buf.h
  20. build_glob.py
  21. c14n.c
  22. catalog.c
  23. ChangeLog
  24. check-relaxng-test-suite.py
  25. check-relaxng-test-suite2.py
  26. check-xinclude-test-suite.py
  27. check-xml-test-suite.py
  28. check-xsddata-test-suite.py
  29. chvalid.c
  30. chvalid.def
  31. configure.in
  32. Copyright
  33. dbgen.pl
  34. dbgenattr.pl
  35. debugXML.c
  36. dict.c
  37. DOCBparser.c
  38. elfgcchack.h
  39. enc.h
  40. encoding.c
  41. entities.c
  42. error.c
  43. genChRanges.py
  44. gentest.py
  45. genUnicode.py
  46. global.data
  47. globals.c
  48. HACKING
  49. hash.c
  50. HTMLparser.c
  51. HTMLtree.c
  52. INSTALL.libxml2
  53. legacy.c
  54. libxml-2.0-uninstalled.pc.in
  55. libxml-2.0.pc.in
  56. libxml.3
  57. libxml.h
  58. libxml.m4
  59. libxml.spec.in
  60. libxml2.doap
  61. libxml2.syms
  62. list.c
  63. MAINTAINERS
  64. Makefile.am
  65. Makefile.tests
  66. Makefile.win
  67. nanoftp.c
  68. nanohttp.c
  69. NEWS
  70. parser.c
  71. parserInternals.c
  72. pattern.c
  73. README
  74. README.cvs-commits
  75. README.tests
  76. regressions.py
  77. regressions.xml
  78. relaxng.c
  79. rngparser.c
  80. runsuite.c
  81. runtest.c
  82. runxmlconf.c
  83. save.h
  84. SAX.c
  85. SAX2.c
  86. schematron.c
  87. testapi.c
  88. testAutomata.c
  89. testC14N.c
  90. testchar.c
  91. testdict.c
  92. testdso.c
  93. testHTML.c
  94. testlimits.c
  95. testModule.c
  96. testOOM.c
  97. testOOMlib.c
  98. testOOMlib.h
  99. testReader.c
  100. testrecurse.c
  101. testRegexp.c
  102. testRelax.c
  103. testSAX.c
  104. testSchemas.c
  105. testThreads.c
  106. testThreadsWin32.c
  107. testURI.c
  108. testXPath.c
  109. threads.c
  110. timsort.h
  111. TODO
  112. TODO_SCHEMAS
  113. tree.c
  114. trio.c
  115. trio.h
  116. triodef.h
  117. trionan.c
  118. trionan.h
  119. triop.h
  120. triostr.c
  121. triostr.h
  122. uri.c
  123. valid.c
  124. xinclude.c
  125. xlink.c
  126. xml2-config.1
  127. xml2-config.in
  128. xml2Conf.sh.in
  129. xmlcatalog.c
  130. xmlIO.c
  131. xmllint.c
  132. xmlmemory.c
  133. xmlmodule.c
  134. xmlreader.c
  135. xmlregexp.c
  136. xmlsave.c
  137. xmlschemas.c
  138. xmlschemastypes.c
  139. xmlstring.c
  140. xmlunicode.c
  141. xmlwriter.c
  142. xpath.c
  143. xpointer.c
  144. xzlib.c
  145. xzlib.h