By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,592 Members | 1,607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,592 IT Pros & Developers. It's quick & easy.

Reading in a type from an XML file

P: n/a
How do I read in a type from XML? I can successfully write the value out to
the file as a type, but I cannot read it back in. Here is partial code for
the save portion:

Private NT As Type = GetType(NetworkType)
Private m_PubNetworkType As NetworkType

............
Dim dcPubNetworkType As DataColumn = dt.Columns.Add("PublisherNetworkType",
NT)
drNew("PublisherNetworkType") = m_PubNetworkType

Here is partial code for the retrieval portion. This would seem to cast the
input field to a type, but when I pull the file in, I get a NullReference
exception (despite the fact that the field IS populated in the XML file).

m_PubNetworkType =
CType(dsIn.Tables("ReplicationSettings").Rows(0)(" PublisherNetworkType"),
NetworkType)

Here is the written schema:
<xs:element name="PublisherNetworkType"
msdata:DataType="System.Data.SqlServerCe.NetworkTy pe" type="xs:string"
minOccurs="0" />

Here is the written XML:
<PublisherNetworkType>DefaultNetwork</PublisherNetworkType>

Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Earl,
How do I read in a type from XML? I can successfully write the value out
to the file as a type, but I cannot read it back in. Here is partial code
for the save portion:

You mean this one
http://msdn.microsoft.com/library/de...atypetopic.asp

Tell next time that it is a XML dataset file. There are more types for XML
files by instance documents.

I hope this helps,

Cor
Nov 21 '05 #2

P: n/a
That is the general idea, unfortunately, NetworkType and SecurityType are
not System types and apparently cannot be assigned in that fashion. Thus my
question.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uq**************@TK2MSFTNGP09.phx.gbl...
Earl,
How do I read in a type from XML? I can successfully write the value out
to the file as a type, but I cannot read it back in. Here is partial code
for the save portion:

You mean this one
http://msdn.microsoft.com/library/de...atypetopic.asp

Tell next time that it is a XML dataset file. There are more types for XML
files by instance documents.

I hope this helps,

Cor

Nov 21 '05 #3

P: n/a
Earl,
That is the general idea, unfortunately, NetworkType and SecurityType are
not System types and apparently cannot be assigned in that fashion. Thus
my question.

In my ideas are it in your sample just column (item) names, therefore I
don't understand why you cannot get the type with the sample I gave you. It
can of course be nothing when there is no schema where it is set. (The last
not tested).

Cor
Nov 21 '05 #4

P: n/a
The "sample you gave me" is the standard MSDN sample, and only allows
standard System types and no others.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uW****************@tk2msftngp13.phx.gbl...
Earl,
That is the general idea, unfortunately, NetworkType and SecurityType are
not System types and apparently cannot be assigned in that fashion. Thus
my question.

In my ideas are it in your sample just column (item) names, therefore I
don't understand why you cannot get the type with the sample I gave you.
It can of course be nothing when there is no schema where it is set. (The
last not tested).

Cor

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.