<HTML>
<HEAD>
<TITLE>Re: [vtkusers] XMLDataParser for generic xml parsing</TITLE>
</HEAD>
<BODY>
<FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Perfect!!!<BR>
Thanks Dave!<BR>
Gerrick<BR>
<BR>
<BR>
On 8/19/08 12:52 PM, "David E DeMarle" <dave.demarle@kitware.com> wrote:<BR>
<BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hi Gerrick,<BR>
<BR>
Try calling parser->SetIgnoreCharacterData(0).<BR>
<BR>
The original vtk formats don'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>
On Tue, Aug 19, 2008 at 1:38 PM, Gerrick Bivins <gbivins@objectreservoir.com> wrote:<BR>
</SPAN></FONT></FONT><BLOCKQUOTE><FONT SIZE="4"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><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>
java.util.List<String><BR>
filteredComponents)<BR>
{<BR>
vtkXMLDataParser parser = new vtkXMLDataParser();<BR>
parser.SetFileName(xmlFileName);<BR>
if( parser.Parse() == 1)<BR>
{<BR>
vtkXMLDataElement root = parser.GetRootElement();<BR>
//vtkXMLDataElement components =<BR>
root.LookupElementWithName("components");<BR>
int numberOfComponents = root.GetNumberOfNestedElements();<BR>
for(int i = 0; i < numberOfComponents; ++i)<BR>
{<BR>
vtkXMLDataElement component = root.GetNestedElement(i);<BR>
vtkXMLDataElement componentID = component.GetNestedElement(0);<BR>
vtkXMLDataElement componentName = component.GetNestedElement(1);<BR>
vtkXMLDataElement componentType = component.GetNestedElement(2);<BR>
String id = componentID.GetCharacterData();//<== this is empty<BR>
System.out.println(id);<BR>
if( filteredComponents.contains(id))<BR>
{<BR>
String [] componentInfo = {componentName.GetCharacterData(),<BR>
componentType.GetCharacterData()};<BR>
componentsMap.put(id, componentInfo);<BR>
}<BR>
}<BR>
}<BR>
else<BR>
{<BR>
<BR>
}<BR>
<BR>
}<BR>
--<BR>
View this message in context: <a href="http://www.nabble.com/XMLDataParser-for-generic-xml-parsing-tp19055150p19055150.html">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">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">http://www.vtk.org/mailman/listinfo/vtkusers</a><BR>
<BR>
<BR>
</SPAN></FONT></FONT></BLOCKQUOTE></BLOCKQUOTE>
</BODY>
</HTML>