Ummm - you have lots of issues with the DTD as well. You've got lots of repeated elements (itemName and itemNumber, for example). The element names in the definition of the content of the detail element don't match the element naems defined in the DTD (postCode vs postcode, for example). And remember, the XML is NOT fine if it doesn't validate against the DTD...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p CodeProject MVP for 2010 - who'd'a thunk it!