VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/python/tests/dtdvalid.py@ 105420

Last change on this file since 105420 was 105420, checked in by vboxsync, 7 months ago

libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 614 bytes
Line 
1#!/usr/bin/env python3
2import setup_test
3import libxml2
4import sys
5
6# Memory debug specific
7libxml2.debugMemory(1)
8
9dtd="""<!ELEMENT foo EMPTY>"""
10instance="""<?xml version="1.0"?>
11<foo></foo>"""
12
13dtd = libxml2.parseDTD(None, 'test.dtd')
14ctxt = libxml2.newValidCtxt()
15doc = libxml2.parseDoc(instance)
16ret = doc.validateDtd(ctxt, dtd)
17if ret != 1:
18 print("error doing DTD validation")
19 sys.exit(1)
20
21doc.freeDoc()
22dtd.freeDtd()
23del dtd
24del ctxt
25
26# Memory debug specific
27libxml2.cleanupParser()
28if libxml2.debugMemory(1) == 0:
29 print("OK")
30else:
31 print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
32
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette