VirtualBox

source: vbox/trunk/src/libs/libxml2-2.6.30/python/tests/dtdvalid.py@ 8268

最後變更 在這個檔案從8268是 6076,由 vboxsync 提交於 17 年 前

Merged dmik/s2 branch (r25959:26751) to the trunk.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Date Revision Author Id
檔案大小: 616 位元組
 
1#!/usr/bin/python -u
2import libxml2
3import sys
4
5# Memory debug specific
6libxml2.debugMemory(1)
7
8dtd="""<!ELEMENT foo EMPTY>"""
9instance="""<?xml version="1.0"?>
10<foo></foo>"""
11
12dtd = libxml2.parseDTD(None, 'test.dtd')
13ctxt = libxml2.newValidCtxt()
14doc = libxml2.parseDoc(instance)
15ret = doc.validateDtd(ctxt, dtd)
16if ret != 1:
17 print "error doing DTD validation"
18 sys.exit(1)
19
20doc.freeDoc()
21dtd.freeDtd()
22del dtd
23del ctxt
24
25# Memory debug specific
26libxml2.cleanupParser()
27if libxml2.debugMemory(1) == 0:
28 print "OK"
29else:
30 print "Memory leak %d bytes" % (libxml2.debugMemory(1))
31 libxml2.dumpMemory()
32
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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