List of usage examples for org.w3c.dom CDATASection getData
public String getData() throws DOMException;
From source file:fr.gouv.finances.dgfip.xemelios.utils.TextWriter.java
private void cDataSection(Writer writer, CDATASection cdata) throws IOException { if (prettyPrint) { checkTextBuffer(writer);/*from ww w .jav a 2 s . com*/ indent(writer); } writer.write("<![CDATA["); writer.write(cdata.getData()); writer.write("]]>"); if (prettyPrint) writer.write('\n'); }
From source file:org.gvnix.flex.ui.MxmlRoundTripUtils.java
/** * Compares and updates script blocks in the MXML document if necessary. * Assumes that there is only a single script block. * /* ww w. j av a 2 s .c o m*/ * @param original * @param proposed * @param originalDocumentAdjusted * @return the new document if changes are necessary, null if no changes are * necessary */ private static boolean updateScriptBlock(Element original, Element proposed, boolean originalDocumentAdjusted) { Element originalScriptBlock = XmlUtils.findFirstElementByName("fx:Script", original); Element proposedScriptBlock = XmlUtils.findFirstElementByName("fx:Script", proposed); if (originalScriptBlock != null && proposedScriptBlock != null) { if (originalScriptBlock.getTextContent() != null && !originalScriptBlock.getTextContent().equals(proposedScriptBlock.getTextContent())) { originalScriptBlock.setTextContent(proposedScriptBlock.getTextContent()); originalDocumentAdjusted = true; } else if (originalScriptBlock.getChildNodes().getLength() > 0 && proposedScriptBlock.getChildNodes().getLength() > 0) { CDATASection originalCDATA = null; CDATASection proposedCDATA = null; for (int i = 0; i < originalScriptBlock.getChildNodes().getLength(); i++) { if (originalScriptBlock.getChildNodes().item(i).getNodeType() == Node.CDATA_SECTION_NODE) { originalCDATA = (CDATASection) originalScriptBlock.getChildNodes().item(i); break; } } for (int i = 0; i < proposedScriptBlock.getChildNodes().getLength(); i++) { if (proposedScriptBlock.getChildNodes().item(i).getNodeType() == Node.CDATA_SECTION_NODE) { proposedCDATA = (CDATASection) proposedScriptBlock.getChildNodes().item(i); break; } } if (originalCDATA == null || proposedCDATA == null) { return originalDocumentAdjusted; } if (originalCDATA.getData() != null && !originalCDATA.getData().equals(proposedCDATA.getData())) { originalCDATA.setData(proposedCDATA.getData()); originalDocumentAdjusted = true; } } } return originalDocumentAdjusted; }
From source file:org.rdv.DockingDataPanelManager.java
@Override public void setConfigurationXML(Document document) throws Exception { XPath xp = XPathFactory.newInstance().newXPath(); Node layoutNode = (Node) xp.evaluate("windowLayout/serialState", document, XPathConstants.NODE); final CDATASection cdata = (CDATASection) layoutNode.getFirstChild(); SwingUtilities.invokeLater(new Runnable() { public void run() { try { byte layoutData[] = new sun.misc.BASE64Decoder().decodeBuffer(cdata.getData()); ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(layoutData)); rootWindow_.read(in, true); in.close();//from w w w . j a v a 2s .co m } catch (Exception e) { e.printStackTrace(); } } }); }