|
version 1.1, 2012/02/21 23:38:00
|
version 1.1.1.3, 2014/06/15 19:53:34
|
|
Line 13 str = doc.serialize()
|
Line 13 str = doc.serialize()
|
| if str != """<?xml version="1.0"?> |
if str != """<?xml version="1.0"?> |
| <root><foo>hello</foo></root> |
<root><foo>hello</foo></root> |
| """: |
""": |
| print "error serializing XML document 1" | print("error serializing XML document 1") |
| sys.exit(1) |
sys.exit(1) |
| str = doc.serialize("iso-8859-1") |
str = doc.serialize("iso-8859-1") |
| if str != """<?xml version="1.0" encoding="iso-8859-1"?> |
if str != """<?xml version="1.0" encoding="iso-8859-1"?> |
| <root><foo>hello</foo></root> |
<root><foo>hello</foo></root> |
| """: |
""": |
| print "error serializing XML document 2" | print("error serializing XML document 2") |
| sys.exit(1) |
sys.exit(1) |
| str = doc.serialize(format=1) |
str = doc.serialize(format=1) |
| if str != """<?xml version="1.0"?> |
if str != """<?xml version="1.0"?> |
|
Line 27 if str != """<?xml version="1.0"?>
|
Line 27 if str != """<?xml version="1.0"?>
|
| <foo>hello</foo> |
<foo>hello</foo> |
| </root> |
</root> |
| """: |
""": |
| print "error serializing XML document 3" | print("error serializing XML document 3") |
| sys.exit(1) |
sys.exit(1) |
| str = doc.serialize("iso-8859-1", 1) |
str = doc.serialize("iso-8859-1", 1) |
| if str != """<?xml version="1.0" encoding="iso-8859-1"?> |
if str != """<?xml version="1.0" encoding="iso-8859-1"?> |
|
Line 35 if str != """<?xml version="1.0" encoding="iso-8859-1"
|
Line 35 if str != """<?xml version="1.0" encoding="iso-8859-1"
|
| <foo>hello</foo> |
<foo>hello</foo> |
| </root> |
</root> |
| """: |
""": |
| print "error serializing XML document 4" | print("error serializing XML document 4") |
| sys.exit(1) |
sys.exit(1) |
| |
|
| # |
# |
|
Line 44 if str != """<?xml version="1.0" encoding="iso-8859-1"
|
Line 44 if str != """<?xml version="1.0" encoding="iso-8859-1"
|
| root = doc.getRootElement() |
root = doc.getRootElement() |
| str = root.serialize() |
str = root.serialize() |
| if str != """<root><foo>hello</foo></root>""": |
if str != """<root><foo>hello</foo></root>""": |
| print "error serializing XML root 1" | print("error serializing XML root 1") |
| sys.exit(1) |
sys.exit(1) |
| str = root.serialize("iso-8859-1") |
str = root.serialize("iso-8859-1") |
| if str != """<root><foo>hello</foo></root>""": |
if str != """<root><foo>hello</foo></root>""": |
| print "error serializing XML root 2" | print("error serializing XML root 2") |
| sys.exit(1) |
sys.exit(1) |
| str = root.serialize(format=1) |
str = root.serialize(format=1) |
| if str != """<root> |
if str != """<root> |
| <foo>hello</foo> |
<foo>hello</foo> |
| </root>""": |
</root>""": |
| print "error serializing XML root 3" | print("error serializing XML root 3") |
| sys.exit(1) |
sys.exit(1) |
| str = root.serialize("iso-8859-1", 1) |
str = root.serialize("iso-8859-1", 1) |
| if str != """<root> |
if str != """<root> |
| <foo>hello</foo> |
<foo>hello</foo> |
| </root>""": |
</root>""": |
| print "error serializing XML root 4" | print("error serializing XML root 4") |
| sys.exit(1) |
sys.exit(1) |
| doc.freeDoc() |
doc.freeDoc() |
| |
|
|
Line 72 str = doc.serialize()
|
Line 72 str = doc.serialize()
|
| if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
| <html><head><title>Hello</title></head><body><p>hello</p></body></html> |
<html><head><title>Hello</title></head><body><p>hello</p></body></html> |
| """: |
""": |
| print "error serializing HTML document 1" | print("error serializing HTML document 1") |
| sys.exit(1) |
sys.exit(1) |
| str = doc.serialize("ISO-8859-1") |
str = doc.serialize("ISO-8859-1") |
| if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
| <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Hello</title></head><body><p>hello</p></body></html> |
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Hello</title></head><body><p>hello</p></body></html> |
| """: |
""": |
| print "error serializing HTML document 2" | print("error serializing HTML document 2") |
| sys.exit(1) |
sys.exit(1) |
| str = doc.serialize(format=1) |
str = doc.serialize(format=1) |
| if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
|
Line 90 if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4
|
Line 90 if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4
|
| <body><p>hello</p></body> |
<body><p>hello</p></body> |
| </html> |
</html> |
| """: |
""": |
| print "error serializing HTML document 3" | print("error serializing HTML document 3") |
| sys.exit(1) |
sys.exit(1) |
| str = doc.serialize("iso-8859-1", 1) |
str = doc.serialize("iso-8859-1", 1) |
| if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
if str != """<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> |
| <html> |
<html> |
| <head> |
<head> |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>Hello</title> |
<title>Hello</title> |
| </head> |
</head> |
| <body><p>hello</p></body> |
<body><p>hello</p></body> |
| </html> |
</html> |
| """: |
""": |
| print "error serializing HTML document 4" | print("error serializing HTML document 4") |
| sys.exit(1) |
sys.exit(1) |
| |
|
| # |
# |
|
Line 112 doc.htmlSetMetaEncoding(None)
|
Line 112 doc.htmlSetMetaEncoding(None)
|
| root = doc.getRootElement() |
root = doc.getRootElement() |
| str = root.serialize() |
str = root.serialize() |
| if str != """<html><head><title>Hello</title></head><body><p>hello</p></body></html>""": |
if str != """<html><head><title>Hello</title></head><body><p>hello</p></body></html>""": |
| print "error serializing HTML root 1" | print("error serializing HTML root 1") |
| sys.exit(1) |
sys.exit(1) |
| str = root.serialize("ISO-8859-1") |
str = root.serialize("ISO-8859-1") |
| if str != """<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Hello</title></head><body><p>hello</p></body></html>""": |
if str != """<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Hello</title></head><body><p>hello</p></body></html>""": |
| print "error serializing HTML root 2" | print("error serializing HTML root 2") |
| sys.exit(1) |
sys.exit(1) |
| str = root.serialize(format=1) |
str = root.serialize(format=1) |
| if str != """<html> |
if str != """<html> |
|
Line 126 if str != """<html>
|
Line 126 if str != """<html>
|
| </head> |
</head> |
| <body><p>hello</p></body> |
<body><p>hello</p></body> |
| </html>""": |
</html>""": |
| print "error serializing HTML root 3" | print("error serializing HTML root 3") |
| sys.exit(1) |
sys.exit(1) |
| str = root.serialize("iso-8859-1", 1) |
str = root.serialize("iso-8859-1", 1) |
| if str != """<html> |
if str != """<html> |
| <head> |
<head> |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>Hello</title> |
<title>Hello</title> |
| </head> |
</head> |
| <body><p>hello</p></body> |
<body><p>hello</p></body> |
| </html>""": |
</html>""": |
| print "error serializing HTML root 4" | print("error serializing HTML root 4") |
| sys.exit(1) |
sys.exit(1) |
| |
|
| doc.freeDoc() |
doc.freeDoc() |
|
Line 144 doc.freeDoc()
|
Line 144 doc.freeDoc()
|
| # Memory debug specific |
# Memory debug specific |
| libxml2.cleanupParser() |
libxml2.cleanupParser() |
| if libxml2.debugMemory(1) == 0: |
if libxml2.debugMemory(1) == 0: |
| print "OK" | print("OK") |
| else: |
else: |
| print "Memory leak %d bytes" % (libxml2.debugMemory(1)) | print("Memory leak %d bytes" % (libxml2.debugMemory(1))) |
| libxml2.dumpMemory() |
libxml2.dumpMemory() |