vtkReader.parse is not a function

Running the below code

const vtkReader = vtkXMLPolyDataReader.newInstance();
vtkReader.parse(xmlStr);

results in TypeError: vtkReader.parse is not a function. What am I missing here?

I think the function is called parseXML.

I looked at some previous code I did and found out I used the HttpDataAccessHelper.fetchBinary call to get the xml polydata file and then call parseAsArrayBuffer on the vtkXMLPolyDataReader object, passing in the results of the fetchBinary call.

function buildGlobeRenderer() {

let url = 'HIDDEN/rendercontent/conus.vtp';

const progressCallback = (progressEvent) => {
if (progressEvent.lengthComputable) {
const percent = Math.floor(
(100 * progressEvent.loaded) / progressEvent.total
);
//progressContainer.innerHTML = Loading ${percent}%;
} else {
/progressContainer.innerHTML = macro.formatBytesToProperUnit(
progressEvent.loaded
);/
}
};

HttpDataAccessHelper.fetchBinary(url, {
progressCallback,
}).then((binary) => {
createGlobe(binary);
});
}

function createGlobe(fileContents) {

const vtpReader = vtkXMLPolyDataReader.newInstance();
vtpReader.parseAsArrayBuffer(fileContents);

const img = new Image();
img.onload = function textureLoaded() {
const globeTexture = vtkTexture.newInstance();
//globeTexture.setInterpolate(true);
globeTexture.setImage(img);
globeMapper.setInputConnection(vtpReader.getOutputPort());
globeActor.setMapper(globeMapper);
globeActor.addTexture(globeTexture);
globeActor.getProperty().setLighting(false);
globeRenderer.setLayer(0);
globeRenderer.addActor(globeActor);
globeRenderer.resetCamera();
renderWindow.render();
};
img.src = 'HIDDEN/rendercontent/48USAcolshade-grey.bmp';