List of usage examples for com.google.gwt.xml.client Document createCDATASection
CDATASection createCDATASection(String data);
CDATASection. From source file:org.openxdata.designer.client.xforms.OpenXdataFormBuilder.java
public static String build(FormDef formDef, HashMap<String, String> localeText) { Document doc = XMLParser.createDocument(); doc.appendChild(doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\"")); Element openXdataFormNode = doc.createElement("PurcForm"); doc.appendChild(openXdataFormNode);//w w w . j a v a2s .c o m Element xformNode = doc.createElement("Xform"); Element node = (Element) formDef.getDoc().getDocumentElement().cloneNode(true); doc.importNode(node, true); xformNode.appendChild(node); openXdataFormNode.appendChild(xformNode); String xml = formDef.getLayoutXml(); if (xml != null && xml.trim().length() > 0) { node = (Element) XmlUtil.getDocument(xml).getDocumentElement().cloneNode(true); doc.importNode(node, true); Element layoutNode = doc.createElement("Layout"); layoutNode.appendChild(node); openXdataFormNode.appendChild(layoutNode); } String src = formDef.getJavaScriptSource(); if (src != null && src.trim().length() > 0) { Element javaScriptNode = doc.createElement("JavaScript"); javaScriptNode.appendChild(doc.createCDATASection(src)); openXdataFormNode.appendChild(javaScriptNode); } openXdataFormNode.appendChild(getLanguageNode(doc, localeText)); return XmlUtil.fromDoc2String(doc); }