%description: Check ev.getXMLDocument()'s optional path expression %file: test.xml one two three four five six seven eight nine ten %global: #ifdef _MSC_VER #pragma warning(disable:4786) #endif static void getElement(const char *pathexpr) { cXMLElement *node = getEnvir()->getXMLDocument("test.xml", pathexpr); EV << (!pathexpr ? "''" : pathexpr) << ": " << (!node ? "null" : node->getAttribute("id")) << "\n"; } %activity: //__asm int 3; getElement(nullptr); getElement("foo"); getElement("/foo"); getElement("foo/foo"); getElement("foo/bar"); getElement("foo/nothing"); getElement("foo/bar[0]"); getElement("foo/bar[2]"); getElement("foo/bar[3]"); getElement("foo/bar[@color='green']"); getElement("foo/bar[@id='11']"); getElement("foo/bar[1]/bar[1]"); getElement("foo/*/bar"); getElement("foo/*[@color='green']/bar"); getElement("foo/*[3]/*[1]"); getElement("foo//baz"); getElement("foo//bar[@color='yellow']"); getElement("foo//bar[@color='green']/foo"); getElement("foo//nothing"); getElement("*"); getElement("*/foo"); getElement("*/bar"); getElement("*/bar/././././."); getElement("/*"); getElement("/*/foo"); %contains: stdout '': 1 foo: 1 /foo: 1 foo/foo: 2 foo/bar: 3 foo/nothing: null foo/bar[0]: 3 foo/bar[2]: 15 foo/bar[3]: null foo/bar[@color='green']: 11 foo/bar[@id='11']: 11 foo/bar[1]/bar[1]: 14 foo/*/bar: 5 foo/*[@color='green']/bar: 13 foo/*[3]/*[1]: 13 foo//baz: 10 foo//bar[@color='yellow']: 9 foo//bar[@color='green']/foo: 12 foo//nothing: null *: 1 */foo: 2 */bar: 3 */bar/././././.: 3 /*: 1 /*/foo: 2