[XML-SIG] DOM circular refs
Jeff.Johnson@stn.siemens.com
Jeff.Johnson@stn.siemens.com
Fri, 9 Oct 1998 14:12:33 -0400
--0__=A2kFZT3qDsXrOyFApQpGBoEJxCoVbsRUYNc21gz18D7Arav2w7NYsuZs
Content-type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi Andrew,
I think I fixed the last of the circular references but to do it I had to
make the Document.documentElement a function called
get_documentElement() which generates a new Element at call time.
I've got a small test file and a new version or core.py that I
temporarily call coretest.py. According to the DOM spec, the
documentElement is a readonly, convenience attribute. By making it a
function, we can enforce the readonly bit. I patched a few other
things too.
I've improved my test suite too. I left the code that checks __init__ vs
__del__, otherwise my test code can't work, it should be taken out of
the released code...
(See attached file: coretest.py)(See attached file: test.py)
--0__=A2kFZT3qDsXrOyFApQpGBoEJxCoVbsRUYNc21gz18D7Arav2w7NYsuZs
Content-type: application/octet-stream;
name="coretest.py"
Content-Disposition: attachment; filename="coretest.py"
Content-transfer-encoding: base64
JycnDQpjb3JlLnB5OiBgbGlnaHQnIGltcGxlbWVudGF0aW9uIG9mIHRoZSBEb2N1bWVudCBPYmpl
Y3QgTW9kZWwgKGNvcmUpIGxldmVsIDEuDQoNClJlZmVyZW5jZTogaHR0cDovL3d3dy53My5vcmcv
VFIvV0QtRE9NL2xldmVsLW9uZS1jb3JlDQoNCkRldmlhdGlvbnMgZnJvbSB0aGUgc3BlY3M6DQoN
Ci0tIHRoZXJlIGlzIGN1cnJlbnRseSBubyBEb2N1bWVudEZyYWdtZW50Lg0KDQpTbywgdXNlZnVs
IGNsYXNzZXMgaW4gdGhpcyBtb2R1bGUgYXJlIE5vZGUgKGFic3RyYWN0KSBhbmQgaXRzDQooY29u
Y3JldGUpIHN1YmNsYXNzZXMgLS0gRG9jdW1lbnQsIEVsZW1lbnQsIFRleHQsIENvbW1lbnQsDQpQ
cm9jZXNzaW5nSW5zdHJ1Y3Rpb24gLS0gYWxsIG9mIHdoaWNoIHNob3VsZCBiZSBpbnN0YW50aWF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nQsDQogICAgICAgICAgICAgICAgICAgICAgIFRleHQsIENEQVRB
U2VjdGlvbiwgRW50aXR5UmVmZXJlbmNlXQ0KTm90YXRpb24uY2hpbGRDbGFzc2VzID0gW10NCg0K
IyB2aW06dHM9MjphaQ0K
--0__=A2kFZT3qDsXrOyFApQpGBoEJxCoVbsRUYNc21gz18D7Arav2w7NYsuZs
Content-type: application/octet-stream;
name="test.py"
Content-Disposition: attachment; filename="test.py"
Content-transfer-encoding: base64
IiIiVGhpcyB0ZXN0cyB0aGUgbmV3IFhNTCBET00gcGFja2FnZSBmb3IgY2lyY3VsYXIgcmVmZXJl
bmNlIG1lbW9yeSBsZWFrcy4NClRvIHVzZSBpdCwgY29kZSBtdXN0IGJlIGFkZGVkIHRvIGNvcmUu
Tm9kZSBhbmQgY29yZS5fbm9kZURhdGEgdG8gaW5jcmVtZW50DQpOb2RlX2NvdW50ZXIgaW4gX19p
bml0X18gYW5kIGRlY3JlbWVudCBpdCBpbiBfX2RlbF9fLiIiIg0KDQpmcm9tIHhtbC5kb20gaW1w
b3J0IGNvcmV0ZXN0DQpjb3JlID0gY29yZXRlc3QNCg0KZGVmIGNoZWNrTWVtKG1zZyk6DQoJaWYg
Y29yZS5Ob2RlLk5vZGVfY291bnRlciBvciBjb3JlLl9ub2RlRGF0YS5Ob2RlX2NvdW50ZXI6DQoJ
CWlmIG1zZzogcHJpbnQgJyMjIyMjIyMjIyMjIyMjIyMjIycsbXNnLCcjIyMjIyMjIyMjIyMjIyMj
IyMnDQoJCXByaW50ICJFcnJvcjogJWQgTm9kZXMgYW5kICVkIF9ub2RlRGF0YXMgd2VyZSBub3Qg
ZGVsZXRlZCIgJSBcDQoJCQkoY29yZS5Ob2RlLk5vZGVfY291bnRlcixjb3JlLl9ub2RlRGF0YS5O
b2RlX2NvdW50ZXIpDQoNCmRlZiB0ZXN0MSgpOg0KCXByaW50ICc9PT09PT09PT09PT09PT09PT0g
dGVzdDEgPT09PT09PT09PT09PT09PT09Jw0KCWR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