Complex XML as input

We are thinking about purchasing Aspose.Word however, using the evaluation version we can populate our Word template (the Mail Merge fields) from an XML input file. The problem is that the XML file is very simple. Please see below.

This works fine and all the mail merge fields in the document are populated using the following 3 lines:

DataSet ds = new DataSet();

ds.ReadXml("InputData.xml");

doc.MailMerge.Execute(ds.Tables[0]);

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

<people>

<customer>

<Name>Alan Smith Name>

<Property_Address>Anywhere RoadProperty_Address>

<Billing_Address>A Street in the UKBilling_Address>

<Number>No 6789 Number>

<Property_Number>3Property_Number>

</customer>

</people>

However, the below XML will not work. Is this slightly more complex XML supported. In the Word template we have the MailMerge fields set to be "Forname" and "Surname".

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

<people>

<customer>

<Name>

<Forname>AlanForname>

<Surname>SmithSurname>

Name>

<Property_Address>nywhere RoadProperty_Address>

<Billing_Address>A Street in the UKBilling_Address>

<Number>No 6789 Number>

<Property_Number>3Property_Number>

</customer>

</people>

Can we populate these fields?

Hi,

Thank you for considering Aspose.

ADO .NET DataSet tries to infer schema from XML itself, so in the latter case it apparently does not guess it right - at least for your purposes. You should either change the XML or provide a schema to make the XML properly treated by DataSet. Please refer to MSDN documentation to learn about loading XML into a DataSet object.