1

estoy intentando leer un archivo xml el cual esta dividido en dos partes, es el siguiente:

<?xml version="1.0" encoding="utf-8"?>
<CPU_ConfigData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <VersTablaCnf>
    <VersTabla>3</VersTabla>
    <IdInstalacion>0</IdInstalacion>
    <EdDatosCnf>3</EdDatosCnf>
  </VersTablaCnf>
  <SysCnf>
    <AddressMicroA>0</AddressMicroA>
    <AddressMicroB>32768</AddressMicroB>
    <CnfSopAddress>8192</CnfSopAddress>
  </SysCnf>
  <AppsCnf>
    <NumApps>2</NumApps>
    <AppCnf>
      <sAppCnf>
        <SafeOutputMask>AAAAAAAAAAAAAAAAAAA=</SafeOutputMask>
        <AuxOutputMask>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
        </AuxOutputMask>
      </sAppCnf>
      <sAppCnf>
        <SafeOutputMask>AAAAAAAAAAAAAAAAAAA=</SafeOutputMask>
        <AuxOutputMask>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
        </AuxOutputMask>
      </sAppCnf>
      <sAppCnf>
        <SafeOutputMask>AAAAAAAAAAAAAAAAAAA=</SafeOutputMask>
        <AuxOutputMask>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
        </AuxOutputMask>
      </sAppCnf>
    </AppCnf>
  </AppsCnf>
  <BusLocalCnf>
    <SlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>0</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>1</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>2</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>3</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>CPU</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>4</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>5</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>6</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>7</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>8</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>9</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>10</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>11</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>12</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>13</DeviceAddress>
      </sSlotCnf>
    </SlotCnf>
    <GpibCycleTime>50</GpibCycleTime>
    <GpibTimeout>5</GpibTimeout>
  </BusLocalCnf>
  <UartsCnf>
    <NumUarts>1</NumUarts>
    <ArrayUarts>
      <sUartCnf>
        <IdUart>1</IdUart>
        <BaudRate>57600</BaudRate>
        <Parity>0</Parity>
        <StopBits>0</StopBits>
        <FlowControl>0</FlowControl>
        <DataBits>8</DataBits>
        <TransportProtocol>0</TransportProtocol>
      </sUartCnf>
      <sUartCnf>
        <IdUart>0</IdUart>
        <BaudRate>0</BaudRate>
        <Parity>0</Parity>
        <StopBits>0</StopBits>
        <FlowControl>0</FlowControl>
        <DataBits>0</DataBits>
        <TransportProtocol>0</TransportProtocol>
      </sUartCnf>
      <sUartCnf>
        <IdUart>0</IdUart>
        <BaudRate>0</BaudRate>
        <Parity>0</Parity>
        <StopBits>0</StopBits>
        <FlowControl>0</FlowControl>
        <DataBits>0</DataBits>
        <TransportProtocol>0</TransportProtocol>
      </sUartCnf>
      <sUartCnf>
        <IdUart>0</IdUart>
        <BaudRate>0</BaudRate>
        <Parity>0</Parity>
        <StopBits>0</StopBits>
        <FlowControl>0</FlowControl>
        <DataBits>0</DataBits>
        <TransportProtocol>0</TransportProtocol>
      </sUartCnf>
      <sUartCnf>
        <IdUart>0</IdUart>
        <BaudRate>0</BaudRate>
        <Parity>0</Parity>
        <StopBits>0</StopBits>
        <FlowControl>0</FlowControl>
        <DataBits>0</DataBits>
        <TransportProtocol>0</TransportProtocol>
      </sUartCnf>
    </ArrayUarts>
  </UartsCnf>
  <DpCnf>
    <DPRAM0_NumChannels>2</DPRAM0_NumChannels>
    <DPRAM1_NumChannels>2</DPRAM1_NumChannels>
  </DpCnf>
  <RoutingTable>
    <NumRoutes>6</NumRoutes>
    <ArrayRoutes>
      <sRoute>
        <OrigenAdd>65535</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>QVBQMAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>32768</DestinoAdd>
        <MailBoxId>RFBSQU0xMAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>65535</OrigenAdd>
        <DestinoAdd>8192</DestinoAdd>
        <MailBoxId>RFBSQU0wMAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>65535</OrigenAdd>
        <DestinoAdd>12</DestinoAdd>
        <MailBoxId>QVBQMQAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>12</OrigenAdd>
        <DestinoAdd>16397</DestinoAdd>
        <MailBoxId>RFBSQU0wMQA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>12</OrigenAdd>
        <DestinoAdd>10</DestinoAdd>
        <MailBoxId>Q09NMQAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
    </ArrayRoutes>
  </RoutingTable>
  <CrcInstance>
    <CRCp>0</CRCp>
  </CrcInstance>
</CPU_ConfigData><?xml version="1.0" encoding="utf-8"?>
<CPU_ConfigData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <VersTablaCnf>
    <VersTabla>3</VersTabla>
    <IdInstalacion>0</IdInstalacion>
    <EdDatosCnf>3</EdDatosCnf>
  </VersTablaCnf>
  <SysCnf>
    <AddressMicroA>32768</AddressMicroA>
    <AddressMicroB>0</AddressMicroB>
    <CnfSopAddress>8192</CnfSopAddress>
  </SysCnf>
  <AppsCnf>
    <NumApps>2</NumApps>
    <AppCnf>
      <sAppCnf>
        <SafeOutputMask>AAAAAAAAAAAAAAAAAAA=</SafeOutputMask>
        <AuxOutputMask>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
          <unsignedInt>512</unsignedInt>
        </AuxOutputMask>
      </sAppCnf>
      <sAppCnf>
        <SafeOutputMask>AAAAAAAAAAAAAAAAAAA=</SafeOutputMask>
        <AuxOutputMask>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
        </AuxOutputMask>
      </sAppCnf>
      <sAppCnf>
        <SafeOutputMask>AAAAAAAAAAAAAAAAAAA=</SafeOutputMask>
        <AuxOutputMask>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
          <unsignedInt>0</unsignedInt>
        </AuxOutputMask>
      </sAppCnf>
    </AppCnf>
  </AppsCnf>
  <BusLocalCnf>
    <SlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>15</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>14</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>13</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>12</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>CPU</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>11</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>10</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>9</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>8</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>7</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>6</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>5</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>4</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>3</DeviceAddress>
      </sSlotCnf>
      <sSlotCnf>
        <DeviceType>None</DeviceType>
        <DeviceFunction>Device</DeviceFunction>
        <DeviceAddress>2</DeviceAddress>
      </sSlotCnf>
    </SlotCnf>
    <GpibCycleTime>50</GpibCycleTime>
    <GpibTimeout>5</GpibTimeout>
  </BusLocalCnf>
  <UartsCnf>
    <NumUarts>1</NumUarts>
    <ArrayUarts>
      <sUartCnf>
        <IdUart>1</IdUart>
        <BaudRate>57600</BaudRate>
        <Parity>0</Parity>
        <StopBits>0</StopBits>
        <FlowControl>0</FlowControl>
        <DataBits>8</DataBits>
        <TransportProtocol>0</TransportProtocol>
      </sUartCnf>
      <sUartCnf>
        <IdUart>0</IdUart>
        <BaudRate>0</BaudRate>
        <Parity>0</Parity>
        <StopBits>0</StopBits>
        <FlowControl>0</FlowControl>
        <DataBits>0</DataBits>
        <TransportProtocol>0</TransportProtocol>
      </sUartCnf>
      <sUartCnf>
        <IdUart>0</IdUart>
        <BaudRate>0</BaudRate>
        <Parity>0</Parity>
        <StopBits>0</StopBits>
        <FlowControl>0</FlowControl>
        <DataBits>0</DataBits>
        <TransportProtocol>0</TransportProtocol>
      </sUartCnf>
      <sUartCnf>
        <IdUart>0</IdUart>
        <BaudRate>0</BaudRate>
        <Parity>0</Parity>
        <StopBits>0</StopBits>
        <FlowControl>0</FlowControl>
        <DataBits>0</DataBits>
        <TransportProtocol>0</TransportProtocol>
      </sUartCnf>
      <sUartCnf>
        <IdUart>0</IdUart>
        <BaudRate>0</BaudRate>
        <Parity>0</Parity>
        <StopBits>0</StopBits>
        <FlowControl>0</FlowControl>
        <DataBits>0</DataBits>
        <TransportProtocol>0</TransportProtocol>
      </sUartCnf>
    </ArrayUarts>
  </UartsCnf>
  <DpCnf>
    <DPRAM0_NumChannels>2</DPRAM0_NumChannels>
    <DPRAM1_NumChannels>2</DPRAM1_NumChannels>
  </DpCnf>
  <RoutingTable>
    <NumRoutes>6</NumRoutes>
    <ArrayRoutes>
      <sRoute>
        <OrigenAdd>65535</OrigenAdd>
        <DestinoAdd>32768</DestinoAdd>
        <MailBoxId>QVBQMAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>32768</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>RFBSQU0xMAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>65535</OrigenAdd>
        <DestinoAdd>8192</DestinoAdd>
        <MailBoxId>RFBSQU0wMAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>65535</OrigenAdd>
        <DestinoAdd>32780</DestinoAdd>
        <MailBoxId>QVBQMQAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>32780</OrigenAdd>
        <DestinoAdd>16397</DestinoAdd>
        <MailBoxId>RFBSQU0wMQA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>32780</OrigenAdd>
        <DestinoAdd>32778</DestinoAdd>
        <MailBoxId>Q09NMQAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
      <sRoute>
        <OrigenAdd>0</OrigenAdd>
        <DestinoAdd>0</DestinoAdd>
        <MailBoxId>AAAAAAAAAAA=</MailBoxId>
      </sRoute>
    </ArrayRoutes>
  </RoutingTable>
  <CrcInstance>
    <CRCp>0</CRCp>
  </CrcInstance>
</CPU_ConfigData>

Es decir yo quiero leer hasta que me encuentre <?xml version=... Por ahora mi código es el siguiente:

public static Object LoadConfigFromXML(string psConfigFilePath, XmlSerializer loSerializerInstance)
{
     Object loReturn = null;

     // Lee la configuración a partir del fichero
     try
     {
         FileStream loReadFileECCEStream = new FileStream(psConfigFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
         XmlSerializer loECCESerializerInstance = loSerializerInstance;

         loReturn = loECCESerializerInstance.Deserialize(loReadFileECCEStream);

         // Cleanup
         loReadFileECCEStream.Close();

         return loReturn;
     }
     catch (Exception)
     {
         return loReturn;
     }
 }

Me esta dando el error siguiente:

  • $exception {"Error en el documento XML (363, 20)."} System.InvalidOperationException

  • InnerException {"Declaración XML inesperada. La declaración XML debe ser el primer nodo del documento y no pueden aparecer espacios en blanco delante. línea 363, posición 20."} System.Exception {System.Xml.XmlException}

Donde loSerializerInstance = new XmlSerializer(typeof(CPU_ConfigData));

Alguien sabe como puedo leer el archivo hasta que se encuentre ?xml y cerrar el archivo en ese punto? Gracias de antemano por la ayuda

8
  • Tu xml está mal. No se pueden parsear dos xml concatenados de ese modo. Primero tendrás que tratar uno y luego el otro y para ello debes separarlos pero no con un parseador de xml sino con leyendo el fichero como si fuera de texto Puedes comprobar si tu xml está bien en esta página Commented el 13 sept. 2018 a las 7:19
  • entonces a la hora de guardar el xml debo ponerle un delimitador para que al leer se pare ahi. Pero que delimitador puedo ponerle?
    – user72979
    Commented el 13 sept. 2018 a las 7:21
  • ¿Por qué no lo guardas en dos xml? Commented el 13 sept. 2018 a las 7:34
  • Es lo que me ha pedido el cliente para evitar tener varios xml a la hora de manejarlo, moverlo, etc se ve que lo necesitan así
    – user72979
    Commented el 13 sept. 2018 a las 7:42
  • Entonces busca la línea <?xml version="1.0" encoding="utf-8"?> y corta por ahí para separarlos. Cuidado porque en el xml que has puesto esta línea se monta sobre la anterior así que tendrías que buscar este texto como cadena y trocearlo ahí Commented el 13 sept. 2018 a las 7:46

1 respuesta 1

1

Lo que debes hacer es procesar el archivo primero para dividirlo en las partes que tenga, para posteriormente deserializarlo. Para ello puedes usar Split:

var xmltext=File.ReadAllText(ruta a tu archivo xml);
var dividido = xmltext.Split(new string[]{ "<?xml"},StringSplitOptions.RemoveEmptyEntries);
foreach(string xml in dividido)
{
     var xmlfinal = "<?xml" + xml; //añadimos esto porque split lo quita
     LoadConfigFromXml(xmlfinal);  //tendrás que cambiar el método para que lea el xml 
                                   //de un string en lugar de desde un archivo
}

Este código permitiría no solo dos, sino varios xml concatenados.

4
  • Vale entiendo, pero lo de xml = xml + "<?xml"; no debería ser xml = "<?xml" + xml ?
    – user72979
    Commented el 13 sept. 2018 a las 8:04
  • @Xim123 vale, es lo que tiene poner código de cabeza sin probarlo. Tienes que usar otra variable ya que xml es una variable de iteración. He modificado la respuesta
    – Pikoh
    Commented el 13 sept. 2018 a las 8:07
  • @Xim123 y tienes razón,es xmlfinal = "<?xml" + xml :)
    – Pikoh
    Commented el 13 sept. 2018 a las 8:09
  • de acuerdo gracias!
    – user72979
    Commented el 13 sept. 2018 a las 8:43

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.