Link to home
Start Free TrialLog in
Avatar of jdhackett
jdhackettFlag for Ireland

asked on

XML Writer - two elements in one line

I'm using XMLWriter in VB.Net 2005.
I'm trying to get an XML output that looks like:

<Employees>
  <NumberEmployed Category="111">1</NumberEmployed>
  <NumberEmployed Category="006">1</NumberEmployed>
  </Employees>

But I can't figure out what I must do. My existing code is below, which gives me an output like
<NumberEmployed Category="111" N="1" />

What must I change?
Thanks


Private Sub Add_NumberEmployed(ByVal iNumEmps As Integer, ByVal stCategory As String)
      ' Add number employed for the Category
 
      With HB_Writer
         .WriteStartElement("NumberEmployed")
         .WriteAttributeString("Category", stCategory)
         .WriteAttributeString("N", iNumEmps)
         .WriteEndElement()
      End With
 
   End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial