开发者

Can XML schema be written to allow xs:attribute of either xs:date or xs:dateTime?

I've some XML being returned from various sources and rather than update each of the sources so that they return date-specific data as attributes in either xs:date or xs:dateTime format I'd like for the XML Schema to be liberal a开发者_StackOverflow社区nd accept either.

Is it possible to use an OR operator somehow? What are the options?


I think it should work with Union Types: http://www.w3.org/TR/xmlschema-0/#UnionDt

Declare a new type, e.g.:

<xsd:simpleType name="dateOrDateTime">
     <xsd:union memberTypes="xs:date xs:dateTime"/>
</xsd:simpleType>

Then use that type for your attribute. I wish I could try it right now - please report back, if it works :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜