Simple Type Element of Strongly Typed DataSet MIA

  • Thread starter Thread starter gr8brain
  • Start date Start date
G

gr8brain

I've done some googling on this one, but I'm not sure how to phrase
the search. Any help is greatly appreciated.

The problem is I have an xml file coming from a non-.Net source that
I'm trying to load into a strongly typed DataSet. I've created the
schema and then the DataSet from there. Here's an exampe of the XSD
(with the actual names/structure changed of course):

snip
<xs:element name="ROOT_ELEMENT">
<xs:complexType>
<xs:sequence>
<xs:element name="COMPLEX_TYPE_ELEMENT_A"
type="SOME_COMPLEX_TYPE" minOccurs="1" />
<xs:element name="SOME_TEXT_DATA" type="xs:string"
minOccurs="1" />
<xs:element name="COMPLEXT_TYPE_ELEMENT_B"
type="ANOTHER_COMPLEX_TYPE" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
snip

When this is converted into a Strongly typed DataSet, the
"SOME_TEXT_DATA" element goes away. VS even removes it from the XSD
file.

Is there a way to handle this? Other than editing the XML to put the
text data as child to another complex type? Could I add a property to
the inherited DataSet that is somehow loaded by the XML?

TIA

Brian
 
Brian,

AFAIK can a SQL database not handle complex types. In my idea will your XSD
be transformed to more tables.

Cor
 
I forgot to write. A dataset reflects a database.

Yeah, I was thinking the DataSet would set up a DataTable with only
one field or something similar. Seems to me this is the point of
having a ReadXml method. For example, what happens to attributes?
Are they discarded as well?

Brian
 
Brian,

Mostly in the same way translated to elements.

Cor

Right, so why would my element disappear? How do I get it to
translate?


You're right that the complex types translate to more tables. That's
not a problem (in fact, that's the desired result). It's the simple
type that goes away in the translation.

Thanks,

Brian
 
Back
Top