I am reading a simple XML file using the matlab xmlread internal function.
<root> <ref> <requestor>John Doe</requestor> <project>X</project> </ref> </root>
But when I call getChildren () on the ref element, it tells me that it has 5 .
It works great IF . I put all the XML in an ONE string. Matlab tells me that the ref element has 2 children.
It doesn't seem like spaces between elements.
Even if I run Canonicalize in the oXygen XML editor, I still get the same results. Because Canonicalize still leaves blanks.
Matlab uses java and xerces for xml material.
Question:
What can I do to save the xml file in a readable format (not all on one line), but still Matlab parsed it correctly?
Code Update:
filename='example01.xml'; docNode = xmlread(filename); rootNode = docNode.getDocumentElement; entries = rootNode.getChildNodes; nEnt = entries.getLength
xml-parsing matlab
capdragon
source share