[vtkusers] XMLDataParser for generic xml parsing
Gerrick Bivins
gbivins at objectreservoir.com
Tue Aug 19 13:55:04 EDT 2008
Perfect!!!
Thanks Dave!
Gerrick
On 8/19/08 12:52 PM, "David E DeMarle" <dave.demarle at kitware.com> wrote:
> Hi Gerrick,
>
> Try calling parser->SetIgnoreCharacterData(0).
>
> 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.
>
> I added the Ignore flag a while back for a new reader which does get the data
> from the parser.
>
> cheers,
> Dave DeMarle
>
>
> On Tue, Aug 19, 2008 at 1:38 PM, Gerrick Bivins <gbivins at objectreservoir.com>
> wrote:
>>
>> Hi All,
>> Can I use vtkXMLDataParser to parse any xml file. It seems like all the
>> calls are there in the API but when I attempt to read one of my own xml
>> files, the GetCharacterData() for nested components is empty.
>>
>> Here is the sample function:
>>
>> protected void parseXMLComponentsDefinitionFile(String xmlFileName,
>> java.util.List<String>
>> filteredComponents)
>> {
>> vtkXMLDataParser parser = new vtkXMLDataParser();
>> parser.SetFileName(xmlFileName);
>> if( parser.Parse() == 1)
>> {
>> vtkXMLDataElement root = parser.GetRootElement();
>> //vtkXMLDataElement components =
>> root.LookupElementWithName("components");
>> int numberOfComponents = root.GetNumberOfNestedElements();
>> for(int i = 0; i < numberOfComponents; ++i)
>> {
>> vtkXMLDataElement component = root.GetNestedElement(i);
>> vtkXMLDataElement componentID = component.GetNestedElement(0);
>> vtkXMLDataElement componentName = component.GetNestedElement(1);
>> vtkXMLDataElement componentType = component.GetNestedElement(2);
>> String id = componentID.GetCharacterData();//<== this is empty
>> System.out.println(id);
>> if( filteredComponents.contains(id))
>> {
>> String [] componentInfo = {componentName.GetCharacterData(),
>> componentType.GetCharacterData()};
>> componentsMap.put(id, componentInfo);
>> }
>> }
>> }
>> else
>> {
>>
>> }
>>
>> }
>> --
>> View this message in context:
>> http://www.nabble.com/XMLDataParser-for-generic-xml-parsing-tp19055150p190551
>> 50.html
>> Sent from the VTK - Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at:
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20080819/14b703d8/attachment.htm>
More information about the vtkusers
mailing list