XHTMLのパース

最近、XML関連に手を出す事になって、jaxbを調査中。


仕事とは関係ないものの、興味深いエントリを見つけた。

るいもの戯れ言 - jaxbでちょっと遊び。
HTML周りに感じていた違和感が解消した気分。
そうだよなぁ、ちゃんと定義されてんだから、それぞれクラスで扱えばいいんだよなぁ。
そこまでは考えてたものの、jaxbで自動生成できるのが分かって、こりゃ面白そうと実験。
javaはさすがにめんどくさいので、jrubyあたりで操作できれば…と。


るいもさんのエントリに沿って試したものの、どうにも上手く行かない。

%sh /jaxb-ri-20071219/bin/xjc.sh -b binding.xsd -extension simpleMode.schemalet xhtml1-strict.xsd
parsing a schema...
[ERROR] compiler was unable to honor this property customization. It is attached to a wrong place, or its inconsistent with other bindings.
  line 13 of file:binding.xsd

[ERROR] (the above customization is attached to the following location in the schema)
  line 216 of file:xhtml1-strict.xsd

Failed to parse a schema.

多少binding file をいじってみたり、extensionを追加してみたりしたが、いかんせんこの辺の知識が足りなすぎる。
jaxbのバージョンが違うのやら、オプションが悪いのやら。
とりあえず今は諦めよう…。


参考:
バインドコンパイラ (xjc)
Customizing JAXB Bindings
JAXB customization just got easier to use
Reference of Schema (JAXB binding customization)