PC Review


Reply
Thread Tools Rate Thread

Document Class as XML?

 
 
Lars Netzel
Guest
Posts: n/a
 
      12th Aug 2005
Hello!

I have written a few Classes and inheriting Classes in VB and I would like
to export these as XML...

Is there any programs or maybe even features in Visual Studio to produce
this?

The reason is that the classes are to be populated thru XML files (that I
recieve from another company) in runtime and I need to create the XML schema
and give to the the company so they know how to send the information to
me...

best regards
/Lars


 
Reply With Quote
 
 
 
 
=?Utf-8?B?bWFyY21j?=
Guest
Posts: n/a
 
      12th Aug 2005
I dunno if i'm on the right track here as I've never used classes to xml.
However, it's data so like any other form of data so I have always defined
my schema, loaded it and fed the structure into a datas et through
ReadXMLSchema & XML Text Reader as follows:

Dim fs As FileStream = New FileStream(fileName, FileMode.Open,
FileAccess.Read)
Dim xtr As XmlTextReader = New XmlTextReader(fs)
dsSettings = New DataSet
Try
dsSettings.ReadXmlSchema(xtr)
Catch ex As XmlException
MessageBox.Show(ex.ToString)
End Try

xtr.Close()

Then... loaded the XML file with data(in your case your class has the data)
with...

If File.Exists(SettingsFileName) Then
Dim fsXML As FileStream = New FileStream(SettingsFileName,
FileMode.Open, FileAccess.ReadWrite)
Dim xtrXML As XmlTextReader = New XmlTextReader(fsXML)
dsSettings.ReadXml(xtrXML)
xtrXML.Close()
Else
Return -1
End If

And used a getData function like:

Private Function GetSettings()

Dim tbl As DataTable = dsSettings.Tables("Settings")
If tbl.Rows.Count > 0 Then
Dim row As DataRow = tbl.Rows(0)
XMLData1 = row("data1")
XMLData2 = row("data2")....etc
Else
Return -1
End If

End Function

hope this helps
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need an html document class Abubakar Microsoft ASP .NET 1 16th Sep 2008 12:05 PM
process class to print word document and pass in printer Rick Microsoft VB .NET 1 28th Jul 2008 08:23 PM
Document Processing Class =?Utf-8?B?ZXNzaWU=?= Microsoft Word Document Management 2 8th Feb 2006 04:17 AM
Design Guidelines for Class Library Developers Document =?Utf-8?B?Qm9i?= Microsoft Dot NET 0 14th Dec 2004 07:03 PM
Re: Printing to a Word document using PrintDocument class Herfried K. Wagner [MVP] Microsoft VB .NET 0 7th May 2004 08:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:57 PM.