xmlGetText FunctionReturns the text contents of an XML element. Syntaxvalue = xmlGetText(el, defVal); Parameters
ReturnsReturns the contents of the element, or defVal if the element does not exist or is empty. RemarksUsing this function instead of the text property of XML element objects allows you to handle a default value if the element does not exist. Example<CUSTOM_FOO> <FOO>Custom Foo Contents</FOO> </CUSTOM_FOO> spanFoo.innerText = xmlGetText(xmlChildOf( xmlLocData, "FOO", 0), "Default FOO contents."); spanBar.innerText = xmlGetText(xmlChildOf( xmlLocData, "BAR", 0), "Default BAR contents."); The HTML element spanFoo will contain Custom Foo Contents, while the element spanBar will contain Default Bar Contents. |