Undefined data type: 'token'

I've got a committee designed xsd that I need to read and read xml data against it.

I'm getting this error 'Undefined data type: 'token'' on the second line of this VS2005 VB code:
Dim _ds As New DataSet
_ds.ReadXmlSchema("long path to.xsd")

The xsd I'm trying to read has 3 files, 2 imports. It looks like this:
transcript <-- academic record <-- core

The only place in the 3 files I find 'token' is in the core.xsd file. One of 2 occurrences looks like this:
<xs:simpleType name="StateProvinceCodeType">
<xs:annotation>
<xs:documentation>Code for US states, etc., and Canadian provinces:
AA Military-Americas
AB Alberta
...
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:token">
<xs:enumeration value="AA">
<xs:annotation>
<xs:documentation>MILITARY-AMERICAS</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="AB">
<xs:annotation>
<xs:documentation>ALBERTA</xs:documentation>
</xs:annotation>
</xs:enumeration>
...
</xs:restriction>
</xs:simpleType>

I think I know what the committee was trying to do with this schema segment. Maybe VS2K5 doesn't implement this 'token' construct.

Does anyone know of a workaround to this problem

Thanks.


Answer this question

Undefined data type: 'token'

  • SDLacey

    I found that 'solution' on another forum and that seeker decided to go with an xslt transform. That answer put me in learning mode for .Net v2 Xsl.XslCompiledTransform.

    Before I devote too much time to another dead end, can I feed the output of this transform into a datadocument or directly into a dataset

  • fuul

    It's not very easy. Unfortunately.< xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    XmlDataDovument and DataSet can be loaded from XmlReader while XslCompiledTransform produces XML in form of XmlWriter.

    The simplest solution is to write result of transformation into file or string and then load it to DataSet.

    If perf is critical to your app you can use XslReader class.

    The best approach would be develop XmlDataSetAddapter that can load DataSet directly from XmlWriter, but I never hared about such thing.



  • Josh D

    Yes, you are able to read the output of the transform into another document.

    --VV [MS]
    vascov@microsoft.com


  • Sigura

    Apparently DataSet does not support xs:token.

    If you change xs:token to xs:string, it should work.

    --VV [MS]
    vascov@microsoft.com

  • Undefined data type: 'token'