ものがたり(旧)

atsushieno.hatenablog.com に続く

XPathAtomicValue: all hype?

一方で、以下のコードは正しく*1エラーになるので、

new XPathAtomicValue (qname, XmlTypeCode.QName).Value

System.InvalidCastException: The QName 'test' cannot be represented as a String.
A prefix for namespace '' cannot be found.

このクラスはセクション17に準拠している、かのように見える。

しかし、同じXmlQualifiedName型にマップされたXML Schema型にNOTATIONという過去の遺物がある。これで試してみると…

new XPathAtomicValue (qname, XmlTypeCode.Notation).Value

System.InvalidCastException: The QName 'test' cannot be represented as a String.
A prefix for namespace '' cannot be found.

…ダメじゃん(こっちは正しくxs:stringに変換してくれないとおかしい)。

*1:と言えるかどうかは微妙なメッセージだが