Processing でのXML処理

2:37 am Google App Engine, Java, Processing

Processing でWeb Serviceを使いXML処理をする際、今までは、proXMLを使っていたけど、これは、encodingをみて読み込んでくれない。そのため、Windows環境でencodingがUTF-8のXMLを読み込むと文字化けをおこしてしまう。

そう、今までは、日本語を扱うようなものを読み込んでいなかったので問題に気づかなかった。 そこで、SAX(http://www.saxproject.org/)を使うことにした。これは、XMLのencodingをみて読み込んでくれるため、問題なく日本語の処理ができる。

SAXは、DOMと違い、イベントで処理をする。最初は、なれなかったが、今回の目的にはSAXの方が向いていた。

Pythonにも、xml.saxがあるようなので今度使ってみよう。


Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.