[ https://issues.apache.org/jira/browse/XERCESJ-911?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Glavassevich resolved XERCESJ-911. ------------------------------------------ Resolution: Invalid Assignee: (was: Xerces-J Developers Mailing List) As per my previous comments, this is a usage error. Applications must synchronize their access to the DOM even if they're just reading it. > Traversing the DOM throws NullPointerException > ---------------------------------------------- > > Key: XERCESJ-911 > URL: https://issues.apache.org/jira/browse/XERCESJ-911 > Project: Xerces2-J > Issue Type: Bug > Components: DOM (Level 3 Core) > Affects Versions: 2.6.2 > Environment: Operating System: Other > Platform: PC > Reporter: Malik Hemani > > I'm traversing a Document parsed by the DOMParser and running into > NullPointerExceptions. > The exception occurs at > org.apache.xerces.dom.ParentNode.nodeListItem(Unknown Source) > org.apache.xerces.dom.ParentNode.item(Unknown Source) > Sometimes is it also seen when 'NodeList.getLength()' is called. > The traversing is done using a for loop and recursing into the routine, > EXAMPLE: > ======== > Node findNode(Node parentNode) { > NodeList childNodes = parentNode.getChildNodes(); > for(int i = 0; i < childNodes.getLength(); i++) { > Node child = childNodes.item(i); > if (child != null && child.getNodeType != Node.ELEMENT_NODE) { > continue; > } > else { > // do something > ... > ... > } > } > // Then recursively call the above routine > for (int i = 0; i < childNodes.getLength(); i++) { > Node child = childnodes.item(i); > > if (child != null) { > Node found = findNode(child); > // more code to follow > ... > ... > } > } > } > If you need the sample XML document, I prefer to email it you. > Thanks. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]