/** * Add a subobject. */ public void addSubobject(QName[] pathname, Object subobject, boolean flatten) { // System.out.println("added: "+SUtil.arrayToString(pathname)+" "+subobject+" "+flatten); if(subobjects==null) subobjects = new Tree(); // Build the path in the tree (on each level a decision about flattening needs to be done) TreeNode node = subobjects.getRootNode(); for(int i=0; i<pathname.length; i++) { // Never flatten last (object) layer (is this a hack?) node = getOrCreateChild(node, pathname[i], i+1==pathname.length? false: flatten); } // Last node data is [tag, object] node.setData(new Object[]{node.getData(), subobject}); }
writeNewline(writer); writeSubobjects(wc, subobs.getRootNode(), typeinfo);