Hi, I'm trying to create a XML file that looks exactly like the one below.

Code:
<?xml version="1.0" encoding="iso-8859-1" ?>
<!DOCTYPE nzb PUBLIC "-//newzBin//DTD NZB 1.0//EN" "http://www.newzbin.com/DTD/nzb/nzb-1.0.dtd">
<nzb xmlns="http://www.newzbin.com/DTD/2003/nzb">

<file poster="John" date="1227360824" subject="Testing [1/2] - &quot;Test1.zip&quot; yEnc (1/4)">
<groups><group>alt.binaries.test</group><group>alt.binaries.boneless</group></groups>
<segments>
<segment bytes="100000" number="1">Test1</segment>
<segment bytes="100000" number="2">Test2</segment>
<segment bytes="100000" number="3">Test3</segment>
<segment bytes="100000" number="4">Test4</segment>
</segments>
</file>

<file poster="John" date="1227360810" subject="Testing [2/2] - &quot;Test2.zip&quot; yEnc (1/2)">
<groups><group>alt.binaries.test</group><group>alt.binaries.boneless</group></groups>
<segments>
<segment bytes="256896" number="1">Test1</segment>
<segment bytes="140067" number="2">Test2</segment>
</segments>
</file>

</nzb>
I've done half of it, but I'm stuck now. Can somebody please show me how to add these things?

1) The processing instruction is incorrect. encoding="iso-8859-1" is not added.
2) The doctype and nzb element need to be added.
3) Groups/group needs to be added.

Code:
<?xml version="1.0"?>
<file poster="John" date="1227360824" subject="Testing [1/2] - &quot;Test1.zip&quot; yEnc (1/4)">
<segments>
<segment bytes="100000" number="1">Test1</segment>
<segment bytes="100000" number="2">Test2</segment>
<segment bytes="100000" number="3">Test3</segment>
</segments>
</file>
Code:
Option Explicit

Private Sub Command1_Click()
Dim objDoc As MSXML2.DOMDocument 'this is a dom document which stores your xml
Dim objRootElement As IXMLDOMElement ' Create a root xml element
Dim objCurrentElement As IXMLDOMElement
Dim objNewElement As IXMLDOMElement
Dim objProcInst As MSXML2.IXMLDOMProcessingInstruction
Dim i As Integer

    Set objDoc = New DOMDocument

    Set objRootElement = objDoc.createElement("file")
    objDoc.appendChild objRootElement
    
    objRootElement.setAttribute "poster", "John"
    objRootElement.setAttribute "date", "1227360824"
    objRootElement.setAttribute "subject", "Testing [1/2] - ""Test1.zip"" yEnc (1/4)"
    
    Set objCurrentElement = objDoc.createElement("segments")
    objRootElement.appendChild objCurrentElement

    For i = 1 To 3
        Set objNewElement = objDoc.createElement("segment")
        objCurrentElement.appendChild objNewElement

        objNewElement.Text = "Test" & i

        objNewElement.setAttribute "bytes", "100000"
        objNewElement.setAttribute "number", i
    Next i
    
    
    Set objProcInst = objDoc.createProcessingInstruction("xml", "version='1.0' encoding='iso-8859-1'")
    objDoc.insertBefore objProcInst, objDoc.childNodes(0)
    
    
    Debug.Print objDoc.xml
    
    Set objDoc = Nothing
    Set objRootElement = Nothing
    Set objCurrentElement = Nothing
    Set objNewElement = Nothing
    Set objProcInst = Nothing
End Sub