[Mono-list] dtd2xsd
Atsushi Eno
atsushi@ximian.com
Thu, 09 Dec 2004 18:22:05 +0900
This is a multi-part message in MIME format.
--------------000606060003030804050502
Content-Type: text/plain; charset=ISO-2022-JP
Content-Transfer-Encoding: 7bit
Hi,
I had been wondering where to put this tiny tool in svn. So
right now I decided to just post it here.
It works only after r37469 (mono 1.1.3 does not work) and it
works only with mono (it is reflection-based hack).
Atsushi Eno
--------------000606060003030804050502
Content-Type: text/plain;
name="dtd2xsd.cs"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="dtd2xsd.cs"
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uSU87CnVzaW5nIFN5c3RlbS5SZWZsZWN0aW9u
Owp1c2luZyBTeXN0ZW0uWG1sOwp1c2luZyBTeXN0ZW0uWG1sLlNjaGVtYTsKCnVzaW5nIEJG
ID0gU3lzdGVtLlJlZmxlY3Rpb24uQmluZGluZ0ZsYWdzOwoKY2xhc3MgRHRkMlhzZERyaXZl
cgp7CglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbiAoc3RyaW5nIFtdIGFyZ3MpCgl7CgkJdHJ5
IHsKCQkJUnVuIChhcmdzKTsKCQl9IGNhdGNoIChFeGNlcHRpb24gZXgpIHsKCQkJQ29uc29s
ZS5Xcml0ZUxpbmUgKCJFUlJPUjogIiArIGV4Lk1lc3NhZ2UpOwoJCX0KCX0KCglzdGF0aWMg
dm9pZCBSdW4gKHN0cmluZyBbXSBhcmdzKQoJewoJCWlmIChhcmdzLkxlbmd0aCA8IDEpIHsK
CQkJQ29uc29sZS5Xcml0ZUxpbmUgKCJVU0FHRTogbW9ubyBkdGQyeHNkLmV4ZSBpbnN0YW5j
ZS14bWxmaWxlIFtvdXRwdXQteHNkZmlsZV0iKTsKCQkJcmV0dXJuOwoJCX0KCQlYbWxUZXh0
UmVhZGVyIHh0ciA9IG5ldyBYbWxUZXh0UmVhZGVyIChhcmdzIFswXSk7CgkJWG1sU2NoZW1h
IHhzZCA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