Wrong depth while using xmlread

3 visualizaciones (últimos 30 días)
Stephan He
Stephan He el 14 de Jul. de 2015
Comentada: KAE el 7 de Mzo. de 2017
I have a xml file that roughly looks like this (I just skipped the binary data):
<?xml version="1.0"?>
<VTKFile type="ImageData" version="0.1" byte_order="LittleEndian">
<ImageData WholeExtent="-1 65 -1 36 0 0" Origin="0 0.289062 0" Spacing="0.0078125 0.0078125 0.0078125">
<Piece Extent="-1 65 -1 36 0 0">
<PointData>
<DataArray type="Float32" Name="cuboid" format="binary" encoding="base64">cCkAAA</DataArray>
</PointData>
</Piece>
</ImageData>
</VTKFile>
parsing it with xmlread (same code as here: xmlread) works fine for all nodes but the 'DataArray'.
Here i get a node with the right attributes. But the data is listed in further child named #text.
I would be glad if someone could explain it to me why this happens =)
System: Win7 Proffesional 64bit Matlab 2015a 64bit

Respuesta aceptada

Guillaume
Guillaume el 15 de Jul. de 2015
Note that xmlread delegates all the xml parsing and DOM building to java.
This is correct behaviour. type, Name, format, and encoding are all attributes of the DataArray tag and anything between the > and the corresponding closing tag are children of the tag (the same way that DataArray is a child of pointData.
The textual content of a tag is indeed a new TEXT node according to the official DOM.
  1 comentario
KAE
KAE el 7 de Mzo. de 2017
FYI I found xlm2struct from the file exchange to be easy to use if that helps.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by