XmlDataSource: clarifications on tree organization

Dear Aspose support,
I noticed the following behaviour; please consider the following XML that I load as XmlDataSource:

    <DATA>
      <INFO />
      <Schweissrapport>
        <KMTO1>10.1</KMTO1>
        <ENDDT>2021-04-01 11:13:00.0</ENDDT>
        <KMFROM1>9.8</KMFROM1>
        <TRACKNR>test1 2</TRACKNR>
        <S2_AUFTRAGENELEKTRODEN>true</S2_AUFTRAGENELEKTRODEN>
        <S2_GEKLEBTER>true</S2_GEKLEBTER>
        <S2_ALUTHERM>true</S2_ALUTHERM>
        <S2_ELEKTRISCHE>true</S2_ELEKTRISCHE>
        <S2_AUFTRAGENDRAHT>true</S2_AUFTRAGENDRAHT>
        <STARTDT>2021-05-26 11:13:00.0</STARTDT>
        <usedMaterial />
        <additionalWork />
        <weldingsTable />
        <completedServices />
      </Schweissrapport>
    </DATA>

If in the template I write <<[Schweissrapport. TRACKNR]>> I get the expected output.
Now consider the following XML, similar to the above except for the removal first empty child “INFO”:

    <DATA>
      <Schweissrapport>
        <KMTO1>10.1</KMTO1>
        <ENDDT>2021-04-01 11:13:00.0</ENDDT>
        <KMFROM1>9.8</KMFROM1>
        <TRACKNR>test1 2</TRACKNR>
        <S2_AUFTRAGENELEKTRODEN>true</S2_AUFTRAGENELEKTRODEN>
        <S2_GEKLEBTER>true</S2_GEKLEBTER>
        <S2_ALUTHERM>true</S2_ALUTHERM>
        <S2_ELEKTRISCHE>true</S2_ELEKTRISCHE>
        <S2_AUFTRAGENDRAHT>true</S2_AUFTRAGENDRAHT>
        <STARTDT>2021-05-26 11:13:00.0</STARTDT>
        <usedMaterial />
        <additionalWork />
        <weldingsTable />
        <completedServices />
      </Schweissrapport>
    </DATA>

In this case all the report fields are no more resolved, and are left blank in the generated document.

This is not blocking in our application as we have control over XML generation and can insert the empty element, but it is an unexpected behviour, possibly difficult to debug, so I’d like to ask:

Is this behaviour expected? Does the root node need at least one direct simple child to be parsable?

Thanks in advance for your attention,
Kind regards
FV

@fabrizio.vaglia

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a simple Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Aspose_Issue_227417.zip (13.7 KB)

Dear Aspose support,
here you find a zip attachment, with a document template and two XML files as per my first post.

You can generate the output documents with the sample application: one will be good, and one bad (fields from XML are not replaced in the output document even though I cannot see the reason why).

Thanks in advance for your attention
Regards,
FV

@fabrizio.vaglia

We are working over your query and will get back to you soon.

@fabrizio.vaglia

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-22070. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@fabrizio.vaglia

Your issue has been resolved. We have added an option to always generate an object for a JSON or XML root element for LINQ Reporting Engine. You can use XmlDataLoadOptions as shown below to avoid the shared issue.

Please note that this feature is added in Aspose.Words for Java 21.6. We will inform you via this forum thread once new version of Aspose.Words for Java is released.

XmlDataLoadOptions options = new XmlDataLoadOptions();
options.setAlwaysGenerateRootObject(true);
XmlDataSource xmlData = new XmlDataSource(NOT_WORKING_XML, options);

The issues you have found earlier (filed as WORDSNET-22070) have been fixed in this Aspose.Words for .NET 21.6 update and this Aspose.Words for Java 21.6 update.