user9654842
user9654842

Reputation:

how to assign XML values to string in Vb6

I want to assign below mentioned xml values to a string like this

Dim test As String

test = ... ?

Where the XML should contain:

      <RptVer>1</RptVer>

      <RptTyp>1</RptTyp>

    </RptInfo>

</InstRptRoot>

How can I do this and also preserve the formatting (ie linebreaks, spacing, etc.)?

Upvotes: 0

Views: 229

Answers (1)

Bill Hileman
Bill Hileman

Reputation: 2838

Mark answered your question, I'll answer your second question:

Dim test As String

test = "<RptInfo>" & vbCrLf & vbCrLf & _
       vbTab & "<RptVer>1</RptVer>" & vbCrLf & vbCrLf & _
       vbTab & "<RptTyp>1</RptTyp> & vbCrLf & vbCrLf & _
      "</RptInfo>"

Assuming you want it double-spaced and indented. You had also missed the leading tag, but MarkL caught that as well.

Upvotes: 3

Related Questions