せっかくDITAのXMLスキーマがプログラムで読めるようになったので、スキーマをロードして中身をダンプしてみようかと思いました.というのもDITA-OTのschemaフォルダにある.xsdを見ても以前書いたようにモジュール化してあります.様々なxsdファイルをインクルードしてあって、とてもではないですが全体像が把握できないからです.特に私のようにXMLスキーマはちょっと参考書を読んだだけという部類の人間にとっては読解するのは無理に等しいです.
ところが以前紹介したマイクロソフトのサンプルプログラムですが、
キャストが大胆すぎてDITAのXMLスキーマでは例外が発生していとてもではないのですが使えません.やはりあくまでもサンプルプログラムです.初心者には結構大変でしたがダンププログラムを自前でやってみました.要素定義のところはインデントさせてみました.これなら初心者でもわかります.
Complex type element='topic'
Attribute: Name='class' type=String use=None default='- topic/topic '
Attribute: Name='id' type=Id use=Required
Attribute: Name='outputclass' type=String use=None
Attribute: Name='conref' type=String use=None
Attribute: Name='conrefend' type=String use=None
Attribute: Name='conaction' type=String use=None
Attribute: Name='conkeyref' type=String use=None
Attribute: Name='DITAArchVersion' type=String use=None
Attribute: Name='domains' type=String use=None default='(topic hazard-d) (topic hi-d) (topic indexing-d) (topic ut-d) '
Attribute: Name='props' type=String use=None
Attribute: Name='platform' type=String use=None
Attribute: Name='product' type=String use=None
Attribute: Name='audience' type=String use=None
Attribute: Name='otherprops' type=String use=None
Attribute: Name='base' type=String use=None
Attribute: Name='rev' type=String use=None
Attribute: Name='importance' type=String use=None
Attribute: Name='status' type=String use=None
Attribute: Name='translate' type=String use=None
Attribute: Name='xml:lang' type=AnyAtomicType use=None
Attribute: Name='dir' type=String use=None
Attribute: Name='xtrc' type=String use=None
Attribute: Name='xtrf' type=String use=None
Sequence: Min=1 Max=1
Element: Name='title'
Sequence: Min=0 Max=1
Element: Name='titlealts'
End Sequence:
Chocice: Min=0 Max=1
Sequence: Min=1 Max=1
Element: Name='shortdesc'
End Sequence:
Sequence: Min=1 Max=1
Element: Name='abstract'
End Sequence:
End Chocice:
Sequence: Min=0 Max=1
Element: Name='prolog'
End Sequence:
Sequence: Min=0 Max=1
Element: Name='body'
End Sequence:
Sequence: Min=0 Max=1
Element: Name='related-links'
End Sequence:
Chocice: Min=0 Max=unbounded
Sequence: Min=1 Max=1
Element: Name='topic'
End Sequence:
End Chocice:
End Sequence:
Attribute: Name='class' type=String use=None default='- topic/topic '
Attribute: Name='id' type=Id use=Required
Attribute: Name='outputclass' type=String use=None
Attribute: Name='conref' type=String use=None
Attribute: Name='conrefend' type=String use=None
Attribute: Name='conaction' type=String use=None
Attribute: Name='conkeyref' type=String use=None
Attribute: Name='DITAArchVersion' type=String use=None
Attribute: Name='domains' type=String use=None default='(topic hazard-d) (topic hi-d) (topic indexing-d) (topic ut-d) '
Attribute: Name='props' type=String use=None
Attribute: Name='platform' type=String use=None
Attribute: Name='product' type=String use=None
Attribute: Name='audience' type=String use=None
Attribute: Name='otherprops' type=String use=None
Attribute: Name='base' type=String use=None
Attribute: Name='rev' type=String use=None
Attribute: Name='importance' type=String use=None
Attribute: Name='status' type=String use=None
Attribute: Name='translate' type=String use=None
Attribute: Name='xml:lang' type=AnyAtomicType use=None
Attribute: Name='dir' type=String use=None
Attribute: Name='xtrc' type=String use=None
Attribute: Name='xtrf' type=String use=None
Sequence: Min=1 Max=1
Element: Name='title'
Sequence: Min=0 Max=1
Element: Name='titlealts'
End Sequence:
Chocice: Min=0 Max=1
Sequence: Min=1 Max=1
Element: Name='shortdesc'
End Sequence:
Sequence: Min=1 Max=1
Element: Name='abstract'
End Sequence:
End Chocice:
Sequence: Min=0 Max=1
Element: Name='prolog'
End Sequence:
Sequence: Min=0 Max=1
Element: Name='body'
End Sequence:
Sequence: Min=0 Max=1
Element: Name='related-links'
End Sequence:
Chocice: Min=0 Max=unbounded
Sequence: Min=1 Max=1
Element: Name='topic'
End Sequence:
End Chocice:
End Sequence:
.netは今までほとんど触ったことがなかったのですが結構おもしろいですね.何よりVBが使えるところが良いです.以前紹介したXmlCatalogResolverクラスはC#で書いてあったのですが、この際ついでにとVBで書き直してしまいました.すこし移植に時間はかかりましたが今のところなんの問題もなく動いています.
プログラムはYahooのブログにははいりきらないので以下に置いてあります.興味のある方はどうぞ!
net.xmlcatalog.zip