<div dir="ltr">Hi Gerrick,<br><br>Try calling parser-&gt;SetIgnoreCharacterData(0).<br><br>The original vtk formats don&#39;t let the parser read the character data. The potentially large data stored there is instead read elsewhere, much more quickly and with much less memory overhead.<br>
<br>I added the Ignore flag a while back for a new reader which does get the data from the parser.<br><br>cheers,<br>Dave DeMarle<br><br><br><div class="gmail_quote">On Tue, Aug 19, 2008 at 1:38 PM, Gerrick Bivins <span dir="ltr">&lt;<a href="mailto:gbivins@objectreservoir.com">gbivins@objectreservoir.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Hi All,<br>
Can I use vtkXMLDataParser to parse any xml file. It seems like all the<br>
calls are there in the API but when I attempt to read one of my own xml<br>
files, the GetCharacterData() for nested components is empty.<br>
<br>
Here is the sample function:<br>
<br>
protected void parseXMLComponentsDefinitionFile(String xmlFileName,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; java.util.List&lt;String&gt;<br>
filteredComponents)<br>
 &nbsp; {<br>
 &nbsp; &nbsp; &nbsp;vtkXMLDataParser parser = new vtkXMLDataParser();<br>
 &nbsp; &nbsp; &nbsp;parser.SetFileName(xmlFileName);<br>
 &nbsp; &nbsp; &nbsp;if( parser.Parse() == 1)<br>
 &nbsp; &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp; vtkXMLDataElement root = parser.GetRootElement();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; //vtkXMLDataElement components =<br>
root.LookupElementWithName(&quot;components&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; int numberOfComponents = root.GetNumberOfNestedElements();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; for(int i = 0; i &lt; numberOfComponents; ++i)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;vtkXMLDataElement component = root.GetNestedElement(i);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;vtkXMLDataElement componentID = component.GetNestedElement(0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;vtkXMLDataElement componentName = component.GetNestedElement(1);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;vtkXMLDataElement componentType = component.GetNestedElement(2);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;String id = componentID.GetCharacterData();//&lt;== this is empty<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(id);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if( filteredComponents.contains(id))<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; String [] componentInfo = {componentName.GetCharacterData(),<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;componentType.GetCharacterData()};<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; componentsMap.put(id, componentInfo);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp; &nbsp; }<br>
 &nbsp; &nbsp; &nbsp;}<br>
 &nbsp; &nbsp; &nbsp;else<br>
 &nbsp; &nbsp; &nbsp;{<br>
<br>
 &nbsp; &nbsp; &nbsp;}<br>
<br>
 &nbsp; }<br>
--<br>
View this message in context: <a href="http://www.nabble.com/XMLDataParser-for-generic-xml-parsing-tp19055150p19055150.html" target="_blank">http://www.nabble.com/XMLDataParser-for-generic-xml-parsing-tp19055150p19055150.html</a><br>

Sent from the VTK - Users mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
This is the private VTK discussion list.<br>
Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>