public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { SwingTreeNodeImpl<String> newNode = new SwingTreeNodeImpl<String>(); if (currentNode == null) { rootNodes.add(newNode); } else { currentNode.addChild(newNode); } newNode.setData(JOINER.join(newNode.getData(), localName.toLowerCase(Locale.US), " [")); currentNode = newNode; }
public void endElement(String uri, String localName, String qName) throws SAXException { currentNode.setData(JOINER.join(currentNode.getData(), "]")); currentNode = (SwingTreeNodeImpl) currentNode.getParent(); }
public void characters(char[] ch, int start, int length) throws SAXException { currentNode.setData(JOINER.join(currentNode.getData(), new String(ch, start, length).trim())); }