11.07.2014 Views

Flute acoustics: measurement, modelling and design - School of ...

Flute acoustics: measurement, modelling and design - School of ...

Flute acoustics: measurement, modelling and design - School of ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

APPENDIX B. PROGRAM LISTINGS 286<br />

return 1;<br />

else<br />

return 0;<br />

}<br />

int assertXMLElement(xmlNodePtr node, const char* expectedname) {<br />

if(isXMLElement(node, expectedname))<br />

return 1;<br />

else {<br />

fprintf(stderr, "XML error: Expected \"\", got \"\".\n",<br />

expectedname, (const char*)(node->name));<br />

return 0;<br />

}<br />

}<br />

char* getXMLAttribute(xmlNodePtr node, const char* attributename) {<br />

return (char*)xmlGetProp(node, (const xmlChar*)attributename);<br />

}<br />

double getXMLDoubleAttribute(xmlNodePtr node, const char*<br />

attributename) {<br />

char* cdata = getXMLAttribute(node, attributename);<br />

return at<strong>of</strong>(cdata);<br />

}<br />

char* getXMLData(xmlDocPtr doc, xmlNodePtr node) {<br />

return (char*)xmlNodeListGetString(doc, node->children, 1);<br />

}<br />

int getXMLIntegerData(xmlDocPtr doc, xmlNodePtr node) {<br />

char* pcdata = getXMLData(doc, node);<br />

return atoi(pcdata);<br />

}<br />

double getXMLDoubleData(xmlDocPtr doc, xmlNodePtr node) {<br />

char* pcdata = getXMLData(doc, node);<br />

return at<strong>of</strong>(pcdata);<br />

}<br />

double getAndScaleXMLDimensionData(xmlDocPtr doc, xmlNodePtr node) {<br />

return 1e-3 * getXMLDoubleData(doc, node);<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!