Skip to content

Commit

Permalink
Use Poco::AutoPtr for xml docs, node lists and new elements, re #8511
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeMPouzols committed Nov 27, 2014
1 parent 9fbe932 commit 113fa93
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -31,7 +31,7 @@ AxisInformation *GeometryParser::getAxisInfo(const std::string dimension)
{
AxisInformation *axis = new AxisInformation();

Poco::XML::NodeList *pNodes = this->pDoc->getElementsByTagName(dimension);
Poco::AutoPtr<Poco::XML::NodeList> pNodes = this->pDoc->getElementsByTagName(dimension);
Poco::XML::Node *pNode = pNodes->item(0)->childNodes()->item(0);
Poco::XML::XMLString label = pNode->innerText();

Expand Down Expand Up @@ -90,20 +90,20 @@ double GeometryParser::convertBounds(Poco::XML::XMLString val)
}

/**
* This function takes a timestep value and places it within the geomtry
* This function takes a timestep value and places it within the geometry
* XML held by this object.
* @param time the value of the timestep
* @return the XML geometry with the timestep value added
*/
std::string GeometryParser::addTDimValue(double time)
{
std::string tDimLabel = Mantid::Geometry::MDGeometryXMLDefinitions::workspaceTDimensionElementName();
Poco::XML::NodeList *pNodes = this->pDoc->getElementsByTagName(tDimLabel);
Poco::AutoPtr<Poco::XML::NodeList> pNodes = this->pDoc->getElementsByTagName(tDimLabel);
Poco::XML::Node *pNode = pNodes->item(0);
std::ostringstream timeStr;
timeStr << time;
Poco::XML::Element *valueElement = this->pDoc->createElement("Value");
Poco::XML::Text *valueText = this->pDoc->createTextNode(timeStr.str());
Poco::AutoPtr<Poco::XML::Element> valueElement = this->pDoc->createElement("Value");
Poco::AutoPtr<Poco::XML::Text> valueText = this->pDoc->createTextNode(timeStr.str());
valueElement->appendChild(valueText);
pNode->appendChild(valueElement);

Expand Down

0 comments on commit 113fa93

Please sign in to comment.