Saves the stack trace summary tree starting from the given root node to an XML file.<p>

@param root the root node
960956
private void saveSummaryXml(SampleNode root) {

        root.sortTree();
        Document doc = DocumentHelper.createDocument();
        Element rootElem = doc.addElement("root");
        root.appendToXml(rootElem);
        OutputFormat outformat = OutputFormat.createPrettyPrint();
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        outformat.setEncoding("UTF-8");
        try {
            XMLWriter writer = new XMLWriter(buffer, outformat);
            writer.write(doc);
            writer.flush();
            try (FileOutputStream fos = new FileOutputStream(m_summaryFilename)) {
                fos.write(buffer.toByteArray());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
189085
public Connector getStandardMetaData(File root) throws Exception
   {
      Connector result = null;
      File metadataFile = new File(root, "/META-INF/ra.xml");

      if (metadataFile.exists())
      {
         InputStream input = null;
         String url = metadataFile.getAbsolutePath();
         try
         {
            long start = System.currentTimeMillis();
            input = new FileInputStream(metadataFile);

            XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(input);

            result = (new RaParser()).parse(xsr);

            log.debugf("Total parse for %s took %d ms", url, (System.currentTimeMillis() - start));
         }
         catch (Exception e)
         {
            log.parsingErrorRaXml(url, e);
            throw e;
         }
         finally
         {
            if (input != null)
               input.close();
         }

      }
      else
      {
         log.tracef("metadata file %s does not exist", metadataFile.toString());
      }

      return result;
   }
1280009
@Override
    public void visit(final Root root) {
        final Map<String, GedObject> objectMap = root.getObjects();
        final Collection<GedObject> objects = objectMap.values();
        for (final GedObject gob : objects) {
            gob.accept(this);
        }
    }
294110
public void saveTo(File file) throws IOException{
        FileOutputStream fout = null;
        try{
            fout = new FileOutputStream(file);
            SyntaxDocument xml = new SyntaxDocument(new StreamResult(fout));
            xml.startDocument();
            xml.add(this);
            xml.endDocument();
        }catch(IOException ex){
            throw ex;
        }catch(Exception ex){
            throw new IOException(ex);
        }finally{
            try{
                if(fout!=null)
                    fout.close();
            }catch(IOException ex){
                ex.printStackTrace();
            }
        }
    }
913280
protected JsTreeNodeData populateTreeNodeData(FileObject root, FileObject file) throws FileSystemException {
		boolean noChild = true;
		FileType type = file.getType();
		if (type.equals(FileType.FOLDER) || type.equals(FileType.FILE_OR_FOLDER)){
			noChild = file.getChildren().length == 0;
		}
		String relativePath = root.getName().getRelativeName(file.getName());
		return populateTreeNodeData(file, noChild, relativePath);
	}
474304
private final void fixReportProjectSummary(final Element root) {
        for (final Element head : root.getElementsByTag("h2")) {
            head.tagName("h1");
        }

        for (final Element head : root.getElementsByTag("h3")) {
            head.tagName("h2");
        }
    }
1181901
public static byte[] encode(final TaskNode root) {
    try (final ByteArrayOutputStream bstream = new ByteArrayOutputStream();
         final DataOutputStream dstream = new DataOutputStream(bstream)) {
      encodeHelper(dstream, root);
      return bstream.toByteArray();

    } catch (final IOException e) {
      throw new RuntimeException("Exception while encoding topology of " + root.getTaskId(), e);
    }
  }
1172258
public static void exports(Xml root, Collidable collidable)
    {
        Check.notNull(root);
        Check.notNull(collidable);

        final Xml node = root.createChild(NODE_GROUP);
        node.setText(collidable.getGroup().toString());
    }
727984
private void setHeaders(final HttpServletResponse response,
            final Root root) {
        response.setHeader("content-type", "application/octet-stream");
        response.setHeader("content-disposition",
                "attachment; filename=" + getSaveFilename(root));
    }
1316631
public void writeContainerPage(CmsObject cms, CmsContainerPageBean cntPage) throws CmsException {

        // keep unused containers
        CmsContainerPageBean savePage = cleanupContainersContainers(cms, cntPage);
        savePage = removeEmptyContainers(cntPage);
        // Replace existing locales with master locale
        for (Locale locale : getLocales()) {
            removeLocale(locale);
        }
        Locale masterLocale = CmsLocaleManager.MASTER_LOCALE;
        addLocale(cms, masterLocale);

        // add the nodes to the raw XML structure
        Element parent = getLocaleNode(masterLocale);
        saveContainerPage(cms, parent, savePage);
        initDocument(m_document, m_encoding, m_contentDefinition);
    }
1149311
public void write(Tree<?, ?> tree) throws IOException {
        this.writer.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"); //$NON-NLS-1$
        this.writer.append("<gxl>\n"); //$NON-NLS-1$

        if (tree != null) {
            this.writer.append("\t<graph id=\""); //$NON-NLS-1$
            this.writer.append(Integer.toHexString(System.identityHashCode(new Integer(tree.hashCode()))));
            this.writer.append("-"); //$NON-NLS-1$
            this.writer.append(Integer.toString(this.graphIndex++));
            this.writer.append("\" edgeids=\"true\" edgemode=\"directed\">\n"); //$NON-NLS-1$

            // Write the node attributes
            Iterator<? extends TreeNode<?, ?>> iterator = tree.broadFirstIterator();
            TreeNode<?, ?> node;
            int dataCount;
            while (iterator.hasNext()) {
                node = iterator.next();
                dataCount = node.getUserDataCount();
                final String name = "NODE" + Integer.toHexString(node.hashCode()); //$NON-NLS-1$
                final String label = Integer.toString(dataCount);

                this.writer.append("\t\t<node id=\""); //$NON-NLS-1$
                this.writer.append(name);
                this.writer.append("\">\n"); //$NON-NLS-1$

                this.writer.append("\t\t\t<attr name=\"label\">\n"); //$NON-NLS-1$
                this.writer.append("\t\t\t\t<string>"); //$NON-NLS-1$
                this.writer.append(label);
                this.writer.append("</string>\n"); //$NON-NLS-1$
                this.writer.append("\t\t\t</attr>\n"); //$NON-NLS-1$

                this.writer.append("\t\t</node>\n"); //$NON-NLS-1$
            }

            // Write the node attributes
            iterator = tree.broadFirstIterator();
            TreeNode<?, ?> child;
            String childName;
            while (iterator.hasNext()) {
                node = iterator.next();
                final String name = "NODE" + Integer.toHexString(node.hashCode()); //$NON-NLS-1$
                if (!node.isLeaf()) {
                    final int childCount = node.getChildCount();
                    for (int i = 0; i < childCount; ++i) {
                        child = node.getChildAt(i);
                        if (child != null) {
                            childName = "NODE" + Integer.toHexString(child.hashCode()); //$NON-NLS-1$

                            this.writer.append("\t\t<edge id=\""); //$NON-NLS-1$
                            this.writer.append(name);
                            this.writer.append("--"); //$NON-NLS-1$
                            this.writer.append(childName);
                            this.writer.append("\" isdirected=\"true\" from=\""); //$NON-NLS-1$
                            this.writer.append(name);
                            this.writer.append("\" to=\""); //$NON-NLS-1$
                            this.writer.append(childName);
                            this.writer.append("\">\n"); //$NON-NLS-1$

                            this.writer.append("\t\t\t<attr name=\"label\">\n"); //$NON-NLS-1$
                            this.writer.append("\t\t\t\t<string>"); //$NON-NLS-1$
                            this.writer.append(Integer.toString(i));
                            this.writer.append("</string>\n"); //$NON-NLS-1$
                            this.writer.append("\t\t\t</attr>\n"); //$NON-NLS-1$

                            this.writer.append("\t\t</edge>\n"); //$NON-NLS-1$
                        }
                    }
                }
            }

            this.writer.append("\t</graph>\n"); //$NON-NLS-1$
        }

        this.writer.append("</gxl>\n"); //$NON-NLS-1$
    }
1165319
public static void exports(Xml root, CollisionRange range)
    {
        Check.notNull(root);
        Check.notNull(range);

        final Xml node = root.createChild(NODE_RANGE);
        node.writeString(ATT_AXIS, range.getOutput().name());
        node.writeInteger(ATT_MIN_X, range.getMinX());
        node.writeInteger(ATT_MIN_Y, range.getMinY());
        node.writeInteger(ATT_MAX_X, range.getMaxX());
        node.writeInteger(ATT_MAX_Y, range.getMaxY());
    }
704869
public void buildMethodsSummary(XMLNode node, Content memberSummaryTree) {
        MemberSummaryWriter writer =
                memberSummaryWriters.get(VisibleMemberMap.Kind.METHODS);
        VisibleMemberMap visibleMemberMap =
               getVisibleMemberMap(VisibleMemberMap.Kind.METHODS);
        addSummary(writer, visibleMemberMap, true, memberSummaryTree);
    }
974236
private void dumpNode(final Node node, final TransformContext transformContext, final StringBuilder builder) {
		if (node == null) {
			return;
		}
		if (node instanceof ASTProperty) {
			ASTProperty prop = (ASTProperty) node;
			if (!StringFunction.SHORT_NAME.equals(prop.toString())) {
				try {
					Object value = Ognl.getValue(prop, transformContext, null);
					builder.append(prop)
							.append(":[")
							.append(value == null ? null
									: ToStringBuilder.reflectionToString(value,
											ToStringStyle.SIMPLE_STYLE))
							.append("],");
				} catch (OgnlException ex) {
					// ダンプ処理でシステムが止まっては困るのでスタックトレースを出して握りつぶす
					ex.printStackTrace();
				}
			}
		} else {
			int childCount = node.jjtGetNumChildren();
			for (int i = 0; i < childCount; i++) {
				Node child = node.jjtGetChild(i);
				dumpNode(child, transformContext, builder);
			}
		}
	}
585329
public void commit(Object root) {
		try {
			XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime
					.queryInterface(XChangesBatch.class, root);
			xUpdateControl.commitChanges();
		} catch (WrappedTargetException e) {
			e.printStackTrace();
		}
	}
1081922
boolean treeFinished(treeNode root){
		return (root.parent == null && root.lc == null && root.rc == null);
	}
817241
public static void exports(Xml root, Collision collision)
    {
        Check.notNull(root);
        Check.notNull(collision);

        final Xml node = root.createChild(NODE_COLLISION);
        node.writeString(ATT_NAME, collision.getName());
        node.writeInteger(ATT_OFFSETX, collision.getOffsetX());
        node.writeInteger(ATT_OFFSETY, collision.getOffsetY());
        node.writeInteger(ATT_WIDTH, collision.getWidth());
        node.writeInteger(ATT_HEIGHT, collision.getHeight());
        node.writeBoolean(ATT_MIRROR, collision.hasMirror());
    }