{"action":"created","issue":{"url":"https://api.github.com/repos/nfarina/xmldoc/issues/13","labels_url":"https://api.github.com/repos/nfarina/xmldoc/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/nfarina/xmldoc/issues/13/comments","events_url":"https://api.github.com/repos/nfarina/xmldoc/issues/13/events","html_url":"https://github.com/nfarina/xmldoc/issues/13","id":53220642,"number":13,"title":"How to retrieve the value in a few level down the nodes?","user":{"login":"alitavector","id":4294383,"avatar_url":"https://avatars.githubusercontent.com/u/4294383?v=3","gravatar_id":"","url":"https://api.github.com/users/alitavector","html_url":"https://github.com/alitavector","followers_url":"https://api.github.com/users/alitavector/followers","following_url":"https://api.github.com/users/alitavector/following{/other_user}","gists_url":"https://api.github.com/users/alitavector/gists{/gist_id}","starred_url":"https://api.github.com/users/alitavector/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alitavector/subscriptions","organizations_url":"https://api.github.com/users/alitavector/orgs","repos_url":"https://api.github.com/users/alitavector/repos","events_url":"https://api.github.com/users/alitavector/events{/privacy}","received_events_url":"https://api.github.com/users/alitavector/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-01T14:23:07Z","updated_at":"2015-01-05T16:41:37Z","closed_at":null,"body":"Updated code:\r\nHow does the childrenNamed is use with eachChild for looping? It's simply return undefined error and need to get one of more ```step``` value in each measure?\r\n```\r\nfs.readFile('Test1.xml', 'utf-8', function(err, data) {\r\n\tif (err) throw err;\r\n\tvar document = new xmldoc.XmlDocument(data);\r\n\t\r\n\t//Get all <measure>...</measure> contents in part element\r\n\tvar dd=document.childNamed(\"part\").childrenNamed(\"measure\")\r\n\t\r\n\t//Loop each measure element\r\n\tdd.eachChild(function (measure) {   //Error\r\n\t\t//If <pitch> exist, get it\r\n\t});\r\n});\r\n\r\nXML file:\r\n<measure id=\"1\">\r\n<note>\r\n  <pitch>\r\n    <step>A</step>\r\n  </pitch>\r\n</note>\r\n<note>\r\n  <pitch>\r\n    <step>B</step>\r\n  </pitch>\r\n</note>\r\n<note>\r\n  <pitch>\r\n    <step>C</step>\r\n  </pitch>\r\n</note>\r\n</measure>\r\n<measure id=\"2\">\r\n...\r\n</measure>\r\n```\r\n\r\nUncaught node.js Error \r\nTypeError: undefined is not a function\r\n    at file:///D:/testfolder/index.html:44:5\r\n    at fs.js:289:14\r\n    at Object.oncomplete (fs.js:97:15)"},"comment":{"url":"https://api.github.com/repos/nfarina/xmldoc/issues/comments/68735074","html_url":"https://github.com/nfarina/xmldoc/issues/13#issuecomment-68735074","issue_url":"https://api.github.com/repos/nfarina/xmldoc/issues/13","id":68735074,"user":{"login":"nfarina","id":117280,"avatar_url":"https://avatars.githubusercontent.com/u/117280?v=3","gravatar_id":"","url":"https://api.github.com/users/nfarina","html_url":"https://github.com/nfarina","followers_url":"https://api.github.com/users/nfarina/followers","following_url":"https://api.github.com/users/nfarina/following{/other_user}","gists_url":"https://api.github.com/users/nfarina/gists{/gist_id}","starred_url":"https://api.github.com/users/nfarina/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nfarina/subscriptions","organizations_url":"https://api.github.com/users/nfarina/orgs","repos_url":"https://api.github.com/users/nfarina/repos","events_url":"https://api.github.com/users/nfarina/events{/privacy}","received_events_url":"https://api.github.com/users/nfarina/received_events","type":"User","site_admin":false},"created_at":"2015-01-05T16:41:37Z","updated_at":"2015-01-05T16:41:37Z","body":"Hello, `childrenNamed()` simply returns a native JS array, so you can't call `eachChild()` on it. You can loop through it the old-fashioned way with something like `for (var i=0; i<dd.length; i++)` etc. Hope this helps!"}}