VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/python/tests/attribs.py@ 105681

最後變更 在這個檔案從105681是 105420,由 vboxsync 提交於 7 月 前

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

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:executable 設為 *
檔案大小: 798 位元組
 
1#!/usr/bin/env python3
2import sys
3import setup_test
4import libxml2
5
6# Memory debug specific
7libxml2.debugMemory(1)
8
9#
10# Testing XML document serialization
11#
12doc = libxml2.readDoc(
13"""<?xml version="1.0" encoding="iso-8859-1"?>
14<!DOCTYPE test [
15<!ELEMENT test (#PCDATA) >
16<!ATTLIST test xmlns:abc CDATA #FIXED "http://abc.org" >
17<!ATTLIST test abc:attr CDATA #FIXED "def" >
18]>
19<test />
20""", None, None, libxml2.XML_PARSE_DTDATTR)
21elem = doc.getRootElement()
22attr = elem.hasNsProp('attr', 'http://abc.org')
23print(attr.serialize())
24if attr == None:
25 print("Failed to find defaulted attribute abc:attr")
26 sys.exit(1)
27
28doc.freeDoc()
29
30# Memory debug specific
31libxml2.cleanupParser()
32if libxml2.debugMemory(1) == 0:
33 print("OK")
34else:
35 print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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