VirtualBox

source: vbox/trunk/src/libs/libxml2-2.6.30/python/tests/attribs.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
檔案大小: 816 位元組
 
1#!/usr/bin/python -u
2import sys
3import libxml2
4
5# Memory debug specific
6libxml2.debugMemory(1)
7
8#
9# Testing XML document serialization
10#
11doc = libxml2.parseDoc(
12"""<?xml version="1.0" encoding="iso-8859-1"?>
13<!DOCTYPE test [
14<!ELEMENT test (#PCDATA) >
15<!ATTLIST test xmlns:abc CDATA #FIXED "http://abc.org" >
16<!ATTLIST test abc:attr CDATA #FIXED "def" >
17]>
18<test />
19""")
20elem = doc.getRootElement()
21attr = elem.hasNsProp('attr', 'http://abc.org')
22if attr == None or attr.serialize()[:-1] != """<!ATTLIST test abc:attr CDATA #FIXED "def">""":
23 print "Failed to find defaulted attribute abc:attr"
24 sys.exit(1)
25
26doc.freeDoc()
27
28# Memory debug specific
29libxml2.cleanupParser()
30if libxml2.debugMemory(1) == 0:
31 print "OK"
32else:
33 print "Memory leak %d bytes" % (libxml2.debugMemory(1))
34 libxml2.dumpMemory()
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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