xml to RTF - stuck with code

dev121

New member
Joined
Aug 21, 2007
Messages
1
Programming Experience
1-3
Hello everyone.
I am new to the forum. Im trying to find my way round...
Dont know if someone could possibly help me out as im a bit stuck with my codes.

I am trying to develop an xml to rtf converter.
This meaning that certain xml data needs to be converted into a rtf format so that cross platform data transaction becomes easier.

So far I have created a code that I think is pretty close to what I want.
I am not entirely sure though how to search in a xml file for particular fields.
Could anyone give me an example on how to extract data from an xml file to an rtf file.

Have a look at my code so far and feel free to leave comments.

<<<<<code stars after this line>>>>>> text in blue = comments

Private Sub cmdConvert(ByVal sender As System.Object, ByVal e
As System.EventArgs) _
Handles cmdConvert.Click

'Set the Path equal to the selected path after using the folder browse function, sPath needs to equal the selected path where the xml file is


Dim sPath As String = Directory.GetParent
(Directory.GetCurrentDirectory()).ToString
' Load the XML file that has been selected using the browse file/folder function
Dim xmlDoc As New XmlDocument()
xmlDoc.Load(sPath)

' Transform the XML and save it as a rtf file.
Select Case sender.name
Case "Transform"
Dim TWrtr As New XmlTextWriter(sPath &
"\Dictionary.RTF", System.Text.Encoding.Default)
xslDoc.Transform(xmlDoc, Nothing, TWrtr)
TWrtr.Close()
MsgBox("Transformed RTF saved to " D:\\
& "\test.RTF")

End Select

End Sub


<<< code ended before this line>>>

I have been trying my utterly best to fix this code and get it working but I cant figure out how to extract certain data from the xml file to rtf format.

The data that needs to be extracted could look like this:

<BookNumber Preserve="true"> 5 </BookNumber>
<Amount>12</Amount>

these are two examples of data that i need to extract to my rtf, namely 5 and 12.

Many thanks for having a look,
sorry for the long post, i am trying to make it as clear as i can ... i hope i did ok.



I am willing to make a monetary donation for your help if needed.
 
Back
Top