Domanda

I am currently reading a xml file with Xmldocument and write some values. The parts I am reading are looking like this:

<para styleclass="Normal" style="margin-top:12px; line-height:1.0; tabstops:none;"><table rowcount="22" colcount="4" style="width:100%; cell-padding:1px; cell-spacing:2px; page-break-inside:auto; border-width:0px; border-spacing:2px; cell-border-width:0px; border-style:none; background-color:none; head-row-background-color:none; alt-row-background-color:none;">
  <tr style="vertical-align:top">
    <td style="vertical-align:bottom; width:33%; background-color:#dddddd;">
      <para><text styleclass="Normal" style="font-size:9pt; font-weight:bold; vertical-align:baseline; color:#000000;" translate="true">&#32;</text></para>
    </td>
    <td style="vertical-align:bottom; width:22%; background-color:#dddddd;">
      <para style="text-align:center;"><text styleclass="Normal" style="font-size:9pt; font-weight:bold; vertical-align:baseline; color:#000000;" translate="true">Windows 32</text></para>
    </td>
    <td style="vertical-align:bottom; width:22%; background-color:#dddddd;">
      <para style="text-align:center;"><text styleclass="Normal" style="font-size:9pt; font-weight:bold; vertical-align:baseline; color:#000000;" translate="true">Windows 64</text></para>
    </td>
    <td style="vertical-align:bottom; width:22%; background-color:#dddddd;">
      <para style="text-align:center;"><text styleclass="Normal" style="font-size:9pt; font-weight:bold; vertical-align:baseline; color:#000000;" translate="true">Linux</text></para>
    </td>
  </tr>
  <tr style="vertical-align:top">
    <td style="vertical-align:bottom; background-color:#dddddd;">
      <para><text styleclass="Normal" style="font-size:9pt; font-weight:bold; vertical-align:baseline; color:#000000;" translate="true">SomeDll.dll</text></para>
    </td>
    <td style="width:22%;">
      <para style="text-align:center;"><text styleclass="Normal" style="font-size:9pt; vertical-align:baseline; color:#000000;" translate="true">1.0.4.78</text></para>
    </td>
    <td style="width:22%;">
      <para style="text-align:center;"><text styleclass="Normal" style="font-size:9pt; vertical-align:baseline; color:#000000;" translate="true">1.0.4.77</text></para>
    </td>
    <td style="width:22%;">
      <para style="text-align:center;"><text styleclass="Normal" style="font-size:9pt; vertical-align:baseline; color:#000000;" translate="true">to be defined</text></para>
    </td>
  </tr>

As you can see, in the second para there is a character entity (& # 3 2 ;). I don't edit it, just going over it. After I've done my editing, I save the file with the .save method.

The problem is, the character entity gets saved to what it represents, in this case a space " ". If I now open the xml file again in my programm I get an exception because that value is null. Is there any way to save character entities to their entity form?

È stato utile?

Soluzione

Given the difficulty of identifying which entities were converted - For example there are many spaces in your sample - it would be very difficult to convert them back.

It might be easier if you modify you loading program to allow for instances where the entities are converted.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top