xmlNumChildOf FunctionReturns the number of child XML elements that have a given element tag name. Syntaxvalue = xmlNumChildOf(el, tagName); Parameters
ReturnsReturns the number of child elements of the specified name; zero if none exist. Example 1<CUSTOM_FOO> <FOOHOLDER> <FOO BAR="Foo 1"/> <FOO BAR="Foo 1"/> </FOOHOLDER> </CUSTOM_FOO> numFoos = xmlNumChildOf(xmlChildOf (xmlLocData, "FOOHOLDER", 0), "FOO", 0); The variable numFoos will equal 2. Example 2<CUSTOM_FOO> <FOO>Inside Foo 1</FOO> <FOO>Inside Foo 2</FOO> <FOO>Inside Foo 3</FOO> </CUSTOM_FOO> for(i = 0; i < xmlNumChildOf(xmlLocData, "FOO"); i++) { foo = xmlChildOf(xmlLocData, "FOO", i); spanFoo.insertAdjacentText("beforeEnd", foo.text + "... "); } The HTML element spanFoo will contain the following: |