vtkXMLPolyDataWriter requires file name even when writing to an output string
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
When writing to an output string, vtkXMLPolyDataWriter class requires a file name. Since there isn't a method to set string stream, the user gets 'The FileName or Stream must be set first.'. I can reproduce this bug on VTK 6.2.0 with the code below:
vtkSmartPointer writer = vtkSmartPointer::New();
// writer->SetFileName("InputPolyData"); writer->SetInputData(this->inputPolyData); writer->WriteToOutputStringOn(); writer->Update(); writer->Write();
writer->GetOutputString();
vtkXMLUnstructuredDataWriter class calls vtkXMLWriter::OpenStream after the validation of Stream and FileName attributes (see vtkXMLUnstructuredDataWriter.cxx, lines 117 and 149). I think the vtkXMLWriter::OpenStream method must be called BEFORE both attributes validation.