Groups | Blog | Home
all groups > asp.net > august 2003 >

asp.net : Can I make a class from XML? Serialize?


Nak
8/8/2003 9:55:57 PM
Hi there,

Do you mean during Run-time? If so then I don't believe so. Or do you
mean at Design-time? If so then it is "possible" but you would need to
either find an application that can create a class from an XML file or make
one yourself, out of interest what purpose would it serve?

Nick.

[quoted text, click to view]

yoz
8/8/2003 10:32:05 PM
I am not sure if you want to do it at runtime, but if you do, create a C#
class from the XML (hey you can even do it with XSLT ;-) and use the free
csc.exe (C# compiler) in your windows/Microsoft.NET folder to compile.

If you really want to make things hard for yourself, I know (heard) there
are helper classes to create Assemblies straight without code. I don't have
the book with me, but they seem to exists. naaaaaa, option 1 would be far
cheaper.

Yoz

[quoted text, click to view]

Jonah Olsson
8/8/2003 10:49:00 PM
Hi guys,

I need a way to dynamically change (or create) a custom class using an
external xml file. Can this be done at all? This is what the class looks
like:

Public Class MemberData
Private _EmailGUID As String
Private _Email As String
Private _FirstName As String
Private _LastName As String
Private _Title As String
Private _Company As String
Private _Address As String
Private _PostalCode As Integer
Private _City As String
Private _Phone As String
Private _Active As Integer
Private _RegDate As DateTime
Private _ChangeDate As DateTime

Public Sub New()
MyBase.New()

_EmailGUID = ""
_Email = ""
_FirstName = ""
_LastName = ""
_Title = ""
_Company = ""
_Address = ""
_PostalCode = 0
_City = ""
_Phone = ""
_Active = 0
_RegDate = Nothing
_ChangeDate = Nothing
_SoftBounces = 0
_HardBounces = 0
_GroupIDs = ""

End Sub

Public Property EmailGUID() As String
Get
Return _EmailGUID
End Get
Set(ByVal Value As String)
If ((Value Is Nothing) OrElse (Value.Length = 0)) Then
Throw New Exception("The email address identifier cannot be
empty")
End If
_EmailGUID = Value
End Set
End Property

Public Property Email() As String
Get
Return _Email
End Get
Set(ByVal Value As String)
If ((Value Is Nothing) OrElse (Value.Length = 0)) Then
Throw New Exception("The email address cannot be empty")
End If
_Email = Value
End Set
End Property

[...]

End Class


Thanks.
Regards Jonah

Nak
8/8/2003 11:17:05 PM
Hi Jonah,

Sorry I have no idea about Web Services at the moment, I haven't gotten
into any of that. But by the sounds of things I am sure that you can make
the engine that you want, I just do not have the knowledge in that field to
provide enough assistance, sorry :-( Maybe someone else will offer advice
here.

Nick.

[quoted text, click to view]

Jonah Olsson
8/8/2003 11:22:57 PM
Hi Nick,

Here's the deal; I'm trying to create a Web Service to be run as an engine
for several client web applications. The engine takes care of all
communication with each database.
The reason I say 'each' is that a customer may use their own SQL server. All
this is just testing, but I came up with the idea when looking at an example
how to dynamically create stored procedures using XML files
(http://www.fawcette.com/xmlmag/2002_11/online/xml_wahlin_11_05_02/). Since
I use the MemberData class in the function that contains the call to the
Stored Procedure, and I can change the parameters in the SP using an XML
file, why shouldn't I be able to also make the MemberData class dynamic.

Say, one customer needs to add "Department" to the MemberData class. This
can easily be done in the XML file for the SP, but how to add it to the
MemberData class? I just don't want to re-build the entire Web Service
application.

I'm not sure though if I explained this so people can understand me... =)

Jonah

"Nak" <a@a.com> skrev i meddelandet
news:uc0t59eXDHA.2464@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

Jonah Olsson
8/9/2003 12:58:40 AM
Thanks anyway Nick! :-)

Jonah

"Nak" <a@a.com> skrev i meddelandet
news:Ob3bNrfXDHA.2464@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

yoz
8/9/2003 1:10:23 PM

[quoted text, click to view]

better with vb.net??

Cor
8/9/2003 2:02:07 PM
Jonah,
It seems clear, but it is not for me, you say a Web Service to run as an
engine (Webservice?) for several client web applications. There is a lot of
difference in that. When it is a webService who runs on side A and then
takes action on Side B will be very complex with authoring, but maybe I see
things wrong.

Like Nick I do not know if I can help you, I do know very few from SQL but
maybe this group can help you together.

And of course, when this solution can made with C# it can be made better
with VB.Net.

Cor









"Jonah Olsson" <jonah@IHateSpam.com> schreef in bericht
news:uWPr9MfXDHA.2640@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button