Search code examples
c#xmlvb6xml-serializationmsxml

MSXML creating XML "header"


I am attempting to use MSXML in VB6 to create a XML file that can then be deserialized as an object in C#.

The XML I am attempting to mimic looks like this

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfStock xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Stock>
    <ProductCode>12345</ProductCode>
    <ProductPrice>10.32</ProductPrice>
  </Stock>
  <Stock>
    <ProductCode>45632</ProductCode>
    <ProductPrice>5.43</ProductPrice>
  </Stock>
</ArrayOfStock>

The question I have is how do I create the following line using the MSXML library?

<?xml version="1.0" encoding="utf-8"?>

IE: How do I create an unterminated "header" value?


Solution

  • Have a look at this similar question.

    You need to use a MXXMLWriter60, instead of saving it directly. ... See IMXWriter for details.