VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/python/tests/attribs.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: 798 bytes
Line 
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)))
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