Java 类org.jdom.CDATA 实例源码

项目:purple-include    文件:BrowserResultWriter.java   
private void addPropertiesElementTo(Element element) {
    Element properties = new Element(PROPERTIES);
    element.addContent(properties);

    Browser browser = browserResult.getBrowser();
    if (browser != null) {
        addProperty(properties, BROWSER_FILE_NAME, browser.getFileName());
        addProperty(properties, BROWSER_ID, String.valueOf(browserResult.getBrowser().getId()));
    }
    if (browserResult.completedTestRun()) {
        addProperty(properties, JSUNIT_VERSION, browserResult.getJsUnitVersion());
        addProperty(properties, USER_AGENT, browserResult.getUserAgent());
        addProperty(properties, REMOTE_ADDRESS, browserResult.getRemoteAddress());
        addProperty(properties, URL, browserResult.getBaseURL());
    }
    if (browserResult.hasServerSideExceptionStackTrace()) {
        Element stackTrace = createPropertyElement(SERVER_SIDE_EXCEPTION_STACK_TRACE);
        stackTrace.addContent(new CDATA(browserResult.getServerSideExceptionStackTrace()));
        properties.addContent(stackTrace);
    }
}
项目:purple-include    文件:FarmServerConfigurationActionTest.java   
public void testCrashingRemoteURLs() throws Exception {
    action.setRemoteRunnerHitter(new BlowingUpRemoteServerHitter());
    action.execute();
    Element rootElement = action.getXmlRenderable().asXml();
    List<CDATA> stackTraceElements = getCDATAExceptionStackTracesUnder(rootElement);
    assertEquals(2, stackTraceElements.size());
    for (CDATA stackTraceElement : stackTraceElements)
        stackTraceElement.detach();

    String xml = XmlUtility.asString(rootElement);
    assertEquals(
            "<remoteConfigurations>" +
                    "<remoteConfiguration remoteMachineURL=\"" + DummyConfigurationSource.REMOTE_URL_1 + "\">" +
                    "<configuration failedToConnect=\"true\" />" +
                    "</remoteConfiguration>" +
                    "<remoteConfiguration remoteMachineURL=\"" + DummyConfigurationSource.REMOTE_URL_2 + "\">" +
                    "<configuration failedToConnect=\"true\" />" +
                    "</remoteConfiguration>" +
                    "</remoteConfigurations>",
            xml
    );
}
项目:purple-include    文件:FarmServerConfigurationAction.java   
public String execute() throws Exception {
    result = new Element("remoteConfigurations");
    for (URL url : server.getConfiguration().getRemoteMachineURLs()) {
        URL configurationURL = new URL(url.toString() + "/config");
        Element configurationElement;
        try {
            Document document = hitter.hitURL(configurationURL);
            configurationElement = document.getRootElement();
            configurationElement.detach();
        } catch (IOException e) {
            configurationElement = new Element("configuration");
            configurationElement.setAttribute("failedToConnect", String.valueOf(true));
            configurationElement.addContent(new CDATA(e.toString()));
        }

        addRemoteConfigurationElementToResult(url, configurationElement);
    }
    return SUCCESS;
}
项目:XSLTXT    文件:StringStatement.java   
void init(Token tok, Lexer lex)
throws IOException, SyntaxException {

if (tok.getValue().equals(CDATA)) {
    isCDATA = true;
    int startingIndent = tok.getIndent();
    tok = lex.next(startingIndent);
}
if (!(tok instanceof QuotedToken)) {
    logCat.warn("TokenNotAllowedException");
    throw new TokenNotAllowedException(lex.getSourceIdent(),
                       tok,
                       "Quoted String");
}
s = tok.getValue();
   }
项目:FallenGalaxy    文件:ShipsServlet.java   
private void addParameter(Element parentElement, String key, String value, boolean useCDATA) {
    Element parameterElement = new Element("parameter");
    parentElement.addContent(parameterElement);

    Element keyElement = new Element("key");
    keyElement.addContent(key);
    parameterElement.addContent(keyElement);


    Element valueElement = new Element("value");
    if (useCDATA) {
        CDATA cdata = new CDATA(value);
        valueElement.addContent(cdata);
    } else {
        valueElement.addContent(value);
    }
    parameterElement.addContent(valueElement);
}
项目:LAS    文件:LASAnnotations.java   
public void setDatasetTitle(String string) {
    Element group = new Element(ELEMENT_ANNOTATION_GROUP);
    group.setAttribute("type", "data");
    Element ann = new Element(ELEMENT_ANNOTATION);
    ann.setAttribute("type", "dataset_title");
    Element value = new Element(ELEMENT_VALUE);
    CDATA text = new CDATA(string);
    value.addContent(text);
    ann.addContent(value);
    group.addContent(ann);
    getRootElement().addContent(group);
}
项目:intellij-ce-playground    文件:BaseInjection.java   
public final Element getState() {
  final Element e = new Element("injection");
  e.setAttribute("language", myInjectedLanguageId);
  e.setAttribute("injector-id", mySupportId);
  e.addContent(new Element("display-name").setText(getDisplayName()));
  if (StringUtil.isNotEmpty(myPrefix)) {
    e.addContent(new Element("prefix").setText(myPrefix));
  }
  if (StringUtil.isNotEmpty(mySuffix)) {
    e.addContent(new Element("suffix").setText(mySuffix));
  }
  if (StringUtil.isNotEmpty(myValuePattern)) {
    e.addContent(new Element("value-pattern").setText(myValuePattern));
  }
  if (mySingleFile) {
    e.addContent(new Element("single-file"));
  }
  Arrays.sort(myPlaces, new Comparator<InjectionPlace>() {
    public int compare(final InjectionPlace o1, final InjectionPlace o2) {
      return Comparing.compare(o1.getText(), o2.getText());
    }
  });
  for (InjectionPlace place : myPlaces) {
    final Element child = new Element("place").setContent(new CDATA(place.getText()));
    if (!place.isEnabled()) child.setAttribute("disabled", "true");
    e.addContent(child);
  }
  writeExternalImpl(e);
  return e;
}
项目:kc-rice    文件:XmlRenderer.java   
public Element renderCDATAElement(Element parent, String elementName, String data) {
    Element element = null;
    if (data != null) {
        element = renderElement(parent, elementName);
        element.addContent(new CDATA(data));
    }
    return element;
}
项目:BART    文件:SaveEGTask.java   
private void saveDependencies(Element rootElement)   {
    String dependencies = dto.getDependencies();
    if(dependencies == null)return;
    if(dependencies.isEmpty())return;
    Element dependenciesElement = new Element("dependencies");       
    dependenciesElement.addContent(new CDATA(dependencies));
    rootElement.addContent(dependenciesElement);
}
项目:jaxen    文件:DocumentNavigator.java   
public String getTextStringValue(Object obj)
{
    if ( obj instanceof Text )
    {
        return ((Text)obj).getText();
    }

    if ( obj instanceof CDATA )
    {
        return ((CDATA)obj).getText();
    }

    return "";
}
项目:jaxen    文件:DocumentNavigator.java   
public String getElementStringValue(Object obj)
{
    Element elem = (Element) obj;

    StringBuffer buf = new StringBuffer();

    List     content     = elem.getContent();
    Iterator contentIter = content.iterator();
    Object   each        = null;

    while ( contentIter.hasNext() )
    {
        each = contentIter.next();

        if ( each instanceof Text )
        {
            buf.append( ((Text)each).getText() );
        }
        else if ( each instanceof CDATA )
        {
            buf.append( ((CDATA)each).getText() );
        }
        else if ( each instanceof Element )
        {
            buf.append( getElementStringValue( each ) );
        }
    }

    return buf.toString();
}
项目:purple-include    文件:FarmServerConfigurationActionTest.java   
private List<CDATA> getCDATAExceptionStackTracesUnder(Element rootElement) {
    Iterator it = rootElement.getDescendants(new Filter() {
        public boolean matches(Object arg0) {
            return arg0 instanceof CDATA;
        }
    });
    List<CDATA> stackTraceElements = new ArrayList<CDATA>();
    while (it.hasNext()) {
        CDATA next = (CDATA) it.next();
        stackTraceElements.add(next);
    }
    return stackTraceElements;
}
项目:XSLTXT    文件:StringStatement.java   
public void outputTXT(Outputter out) {
if (isCDATA) {
    out.output(CDATA);
    out.output(" ");
}
out.output(fqs(s));
out.newline();
   }
项目:XSLTXT    文件:Statement.java   
void processXMLContent(org.jdom.Element e)
    throws SyntaxException {

    if (logCat.isDebugEnabled())
        logCat.debug("processXMLContent(" +
                e +
                ")");
    try {
        for (Iterator it = e.getContent().listIterator();
                it.hasNext();) {
            Object o = it.next();
            if (logCat.isDebugEnabled())
                logCat.debug("processXMLContent factory is " +
                        factory);
            if (o instanceof org.jdom.Element) {
                addChild(factory.getStatement((org.jdom.Element)o));
            } else if (o instanceof org.jdom.Text) {
                addChild(factory.getStatement(((org.jdom.Text)o).getText()));
            } else if (o instanceof String) {
                addChild(factory.getStatement((String)o));
            } else if (o instanceof org.jdom.Comment) {
                addChild(factory.getStatement((org.jdom.Comment)o));
            } else if (o instanceof CDATA) {
                addChild(factory.getStatement((CDATA)o));
            } else {
                logCat.warn("Could not convert " + o.getClass().getName());
            }
                }
    } catch (SyntaxException se) {
        se.setContainingStatement(getXMLLocalName());
        throw se;
    }
}
项目:XSLTXT    文件:StatementDescriptor.java   
/**
    * Output an xml representation of this statement descriptor.
    * @param name the name of the token recognized for this statement
    * @param root the element to which the representation should
    * be added.
    */
   void toXML(String name, Element root) {

Element e = new Element("statement");

addElement(e, "txtName", name);

addElement(e, "elementName", getXMLName());

if (requiredFields.size() > 0) {
    Element req = new Element("requiredFields");
    addFields(req, requiredFields);
    e.addContent(req);
}

if (optionalFields.size() > 0) {
    Element opt = new Element("optionalFields");
    addFields(opt, optionalFields);
    e.addContent(opt);
}

String ex = getExample();
if (ex != null) {
    Element example = new Element("example");
    example.addContent(new CDATA(ex));
    e.addContent(example);
}

root.addContent(e);
   }
项目:tools-idea    文件:BaseInjection.java   
public final Element getState() {
  final Element e = new Element("injection");
  e.setAttribute("language", myInjectedLanguageId);
  e.setAttribute("injector-id", mySupportId);
  e.addContent(new Element("display-name").setText(getDisplayName()));
  if (StringUtil.isNotEmpty(myPrefix)) {
    e.addContent(new Element("prefix").setText(myPrefix));
  }
  if (StringUtil.isNotEmpty(mySuffix)) {
    e.addContent(new Element("suffix").setText(mySuffix));
  }
  if (StringUtil.isNotEmpty(myValuePattern)) {
    e.addContent(new Element("value-pattern").setText(myValuePattern));
  }
  if (mySingleFile) {
    e.addContent(new Element("single-file"));
  }
  Arrays.sort(myPlaces, new Comparator<InjectionPlace>() {
    public int compare(final InjectionPlace o1, final InjectionPlace o2) {
      return Comparing.compare(o1.getText(), o2.getText());
    }
  });
  for (InjectionPlace place : myPlaces) {
    final Element child = new Element("place").setContent(new CDATA(place.getText()));
    if (!place.isEnabled()) child.setAttribute("disabled", "true");
    e.addContent(child);
  }
  writeExternalImpl(e);
  return e;
}
项目:rice    文件:XmlRenderer.java   
public Element renderCDATAElement(Element parent, String elementName, String data) {
    Element element = null;
    if (data != null) {
        element = renderElement(parent, elementName);
        element.addContent(new CDATA(data));
    }
    return element;
}
项目:intellij-xquery    文件:XmlConfigurationAccessor.java   
public void writeConfiguration(XQueryRunConfiguration runConfiguration, Element element) {
    Element configuration = new Element(CONFIGURATION_TAG);
    element.addContent(configuration);
    if (runConfiguration.getMainFileName() != null)
        configuration.setAttribute("mainFileName", runConfiguration.getMainFileName());
    if (runConfiguration.getVMParameters() != null)
        configuration.setAttribute("vmParameters", runConfiguration.getVMParameters());
    if (runConfiguration.getProgramParameters() != null)
        configuration.setAttribute("programParameters", runConfiguration.getProgramParameters());
    if (runConfiguration.getRawWorkingDirectory() != null)
        configuration.setAttribute("workingDirectory", runConfiguration.getRawWorkingDirectory());
    configuration.setAttribute("alternativeJrePathEnabled", Boolean.toString(runConfiguration.isAlternativeJrePathEnabled()));
    if (runConfiguration.getAlternativeJrePath() != null)
        configuration.setAttribute("alternativeJrePath", runConfiguration.getAlternativeJrePath());
    configuration.setAttribute("contextItemEnabled", Boolean.toString(runConfiguration.isContextItemEnabled()));
    configuration.setAttribute("contextItemFromEditorEnabled", Boolean.toString(runConfiguration.isContextItemFromEditorEnabled()));
    if (runConfiguration.getContextItemText() != null) {
        Element contextItemTextElement = new Element("contextItemText");
        contextItemTextElement.addContent(new CDATA(runConfiguration.getContextItemText()));
        configuration.addContent(contextItemTextElement);
    }
    if (runConfiguration.getContextItemFile() != null) {
        configuration.setAttribute("contextItemFile", runConfiguration.getContextItemFile());
    }
    if (runConfiguration.getContextItemType() != null) {
        configuration.setAttribute("contextItemType", runConfiguration.getContextItemType());
    }
    if (runConfiguration.getDataSourceName() != null) {
        configuration.setAttribute("dataSourceName", runConfiguration.getDataSourceName());
    }
}
项目:MesquiteArchive    文件:MesquiteXMLPreferencesModule.java   
/**
 * Ideally this should not be static but since we don't always have control over the superclass,
 * make it available for classes that might otherwise not be able to use it due to inheritance
 * constraints
 * @param provider
 * @param versionInt
 * @return
 */
public static String preparePreferencesForXML (PropertyNamesProvider provider, int versionInt) {
    String[] propertyNames = provider.getPreferencePropertyNames();
    Document preferencesDoc = new Document();
    Element rootElement = new Element("mesquite");
    preferencesDoc.setRootElement(rootElement);
    Element classElement = new Element(getShortClassName(provider.getClass()));
    rootElement.addContent(classElement);
    Element versionElement = new Element(VERSION);
    versionElement.setText("" + versionInt);
    classElement.addContent(versionElement);
    for (int i = 0; i < propertyNames.length; i++) {
        String currentPropertyName = propertyNames[i];
        try {
            Object prefsContent = PropertyUtils.read(provider, currentPropertyName);
            if (prefsContent != null) {
                Element nextPrefsElement = new Element(PREFERENCE);
                nextPrefsElement.setAttribute(KEY, currentPropertyName);
                nextPrefsElement.addContent(new CDATA(prefsContent.toString()));
                classElement.addContent(nextPrefsElement);
            }
        } catch (Exception e) {
            MesquiteMessage.warnProgrammer("Could not read property value " + currentPropertyName + " for writing xml preferences on module: " + provider);
        }
        //nextPrefsElement.addContent(new CDATA())
    }
    return BaseXMLWriter.getDocumentAsString(preferencesDoc);
}
项目:MesquiteArchive    文件:MesquiteXMLPreferencesModule.java   
/**
 * Ideally this should not be static but since we don't always have control over the superclass,
 * make it available for classes that might otherwise not be able to use it due to inheritance
 * constraints
 * @param provider
 * @param versionInt
 * @return
 */
public static String preparePreferencesForXML (PropertyNamesProvider provider, int versionInt) {
    String[] propertyNames = provider.getPreferencePropertyNames();
    Document preferencesDoc = new Document();
    Element rootElement = new Element("mesquite");
    preferencesDoc.setRootElement(rootElement);
    Element classElement = new Element(getShortClassName(provider.getClass()));
    rootElement.addContent(classElement);
    Element versionElement = new Element(VERSION);
    versionElement.setText("" + versionInt);
    classElement.addContent(versionElement);
    for (int i = 0; i < propertyNames.length; i++) {
        String currentPropertyName = propertyNames[i];
        try {
            Object prefsContent = PropertyUtils.read(provider, currentPropertyName);
            if (prefsContent != null) {
                Element nextPrefsElement = new Element(PREFERENCE);
                nextPrefsElement.setAttribute(KEY, currentPropertyName);
                nextPrefsElement.addContent(new CDATA(prefsContent.toString()));
                classElement.addContent(nextPrefsElement);
            }
        } catch (Exception e) {
            MesquiteMessage.warnProgrammer("Could not read property value " + currentPropertyName + " for writing xml preferences on module: " + provider);
        }
        //nextPrefsElement.addContent(new CDATA())
    }
    return BaseXMLWriter.getDocumentAsString(preferencesDoc);
}
项目:MesquiteArchive    文件:ToLUtil.java   
public static int getTerminals(Element element, String[] names, boolean[] leaves, boolean[] hasChildren, MesquiteString termName, MesquiteInteger c) {
    boolean isNode = isNode(element);
    boolean isName = "Name".equalsIgnoreCase(element.getName());
    List children = element.getContent();
    Iterator iterator = children.iterator();
    int terms = 0;
    while (iterator.hasNext()) {
        Object o = iterator.next();
        if (isName){
            if (o instanceof CDATA) {
                termName.setValue(((CDATA)o).getText());
            }
        }
        else if (o instanceof Element) {
            Element e = (Element)o;
            if (isContinuable(e))
                terms += getTerminals((Element) o, names, leaves,hasChildren, termName, c);
        }
    }
    if (isNode && terms == 0) {

        names[c.getValue()] =  new String(termName.getValue()); //element.getAttributeValue("NAME");
        if (isLeaf(element))
            leaves[c.getValue()] = true;
        else
            leaves[c.getValue()] = false;
        if (hasChildren(element))
            hasChildren[c.getValue()] = true;
        else
            hasChildren[c.getValue()] = false;
        c.increment();
        return 1;
    }
    else 
        return terms;

}
项目:MesquiteArchive    文件:MesquiteXMLPreferencesModule.java   
/**
 * Ideally this should not be static but since we don't always have control over the superclass,
 * make it available for classes that might otherwise not be able to use it due to inheritance
 * constraints
 * @param provider
 * @param versionInt
 * @return
 */
public static String preparePreferencesForXML (PropertyNamesProvider provider, int versionInt) {
    String[] propertyNames = provider.getPreferencePropertyNames();
    Document preferencesDoc = new Document();
    Element rootElement = new Element("mesquite");
    preferencesDoc.setRootElement(rootElement);
    Element classElement = new Element(getShortClassName(provider.getClass()));
    rootElement.addContent(classElement);
    Element versionElement = new Element(VERSION);
    versionElement.setText("" + versionInt);
    classElement.addContent(versionElement);
    for (int i = 0; i < propertyNames.length; i++) {
        String currentPropertyName = propertyNames[i];
        try {
            Object prefsContent = PropertyUtils.read(provider, currentPropertyName);
            if (prefsContent != null) {
                Element nextPrefsElement = new Element(PREFERENCE);
                nextPrefsElement.setAttribute(KEY, currentPropertyName);
                nextPrefsElement.addContent(new CDATA(prefsContent.toString()));
                classElement.addContent(nextPrefsElement);
            }
        } catch (Exception e) {
            MesquiteMessage.warnProgrammer("Could not read property value " + currentPropertyName + " for writing xml preferences on module: " + provider);
        }
        //nextPrefsElement.addContent(new CDATA())
    }
    return BaseXMLWriter.getDocumentAsString(preferencesDoc);
}
项目:MesquiteArchive    文件:PhoneHomeUtil.java   
public static void writePhoneRecords(String path, ListableVector phoneRecords) {
    if (StringUtil.blank(path))
        return ;
    Element mesquiteElement = new Element("mesquite");
    Document doc = new Document(mesquiteElement);
    Element phoneRecordElement = new Element("phoneRecords");
    mesquiteElement.addContent(phoneRecordElement);
    Element versionElement = new Element("version").addContent("1");
    phoneRecordElement.addContent(versionElement);

    for (int i= 0; i<phoneRecords.size(); i++){
        Element recordElement = new Element("record");
        phoneRecordElement.addContent(recordElement);
        PhoneHomeRecord phoneRecord = (PhoneHomeRecord)phoneRecords.elementAt(i);
        recordElement.addContent(new Element("module").addContent(new CDATA(phoneRecord.getModuleName())));
        MesquiteModuleInfo mmi = MesquiteTrunk.mesquiteModulesInfoVector.findModule(MesquiteModule.class, phoneRecord.getModuleName());
        recordElement.addContent(new Element("lastVersionUsed").addContent(MesquiteInteger.toString(phoneRecord.getLastVersionUsed())));
        recordElement.addContent(new Element("lastNotice").addContent(MesquiteInteger.toString(phoneRecord.getLastNotice())));
        recordElement.addContent(new Element("lastNoticeForMyVersion").addContent(MesquiteInteger.toString(phoneRecord.getLastNoticeForMyVersion())));
        recordElement.addContent(new Element("lastVersionNoticed").addContent(MesquiteInteger.toString(phoneRecord.getLastVersionNoticed())));
        recordElement.addContent(new Element("lastNewerVersionReported").addContent(MesquiteInteger.toString(phoneRecord.getLastNewerVersionReported())));
    }
    String xml = BaseXMLWriter.getDocumentAsString(doc);
    if (!StringUtil.blank(xml))
        MesquiteFile.putFileContents(path, xml, true);

}
项目:MesquiteArchive    文件:MesquiteXMLPreferencesModule.java   
/**
 * Ideally this should not be static but since we don't always have control over the superclass,
 * make it available for classes that might otherwise not be able to use it due to inheritance
 * constraints
 * @param provider
 * @param versionInt
 * @return
 */
public static String preparePreferencesForXML (PropertyNamesProvider provider, int versionInt) {
    String[] propertyNames = provider.getPreferencePropertyNames();
    Document preferencesDoc = new Document();
    Element rootElement = new Element("mesquite");
    preferencesDoc.setRootElement(rootElement);
    Element classElement = new Element(getShortClassName(provider.getClass()));
    rootElement.addContent(classElement);
    Element versionElement = new Element(VERSION);
    versionElement.setText("" + versionInt);
    classElement.addContent(versionElement);
    for (int i = 0; i < propertyNames.length; i++) {
        String currentPropertyName = propertyNames[i];
        try {
            Object prefsContent = PropertyUtils.read(provider, currentPropertyName);
            if (prefsContent != null) {
                Element nextPrefsElement = new Element(PREFERENCE);
                nextPrefsElement.setAttribute(KEY, currentPropertyName);
                nextPrefsElement.addContent(new CDATA(prefsContent.toString()));
                classElement.addContent(nextPrefsElement);
            }
        } catch (Exception e) {
            MesquiteMessage.warnProgrammer("Could not read property value " + currentPropertyName + " for writing xml preferences on module: " + provider);
        }
        //nextPrefsElement.addContent(new CDATA())
    }
    return BaseXMLWriter.getDocumentAsString(preferencesDoc);
}
项目:kuali_rice    文件:XmlRenderer.java   
public Element renderCDATAElement(Element parent, String elementName, String data) {
    Element element = null;
    if (data != null) {
        element = renderElement(parent, elementName);
        element.addContent(new CDATA(data));
    }
    return element;
}
项目:jaxen    文件:DocumentNavigator.java   
public boolean isText(Object obj)
{
    return ( obj instanceof Text
             ||
             obj instanceof CDATA );
}
项目:HELMEditor    文件:Graph2NotationTranslator.java   
public static Element getStructureInfoElement(Graph2D graph,
        GraphManager graphManager) throws NotationException,
        MonomerException, IOException, JDOMException, StructureException,
        ListNotComparableException, ClassNotFoundException {
    if (null == graph || graph.isEmpty()) {
        return null;
    }

    // String textNotation = graph2Notation(graph, graphManager);
    String textNotation = getNewNotation(graphManager);
    if (null != textNotation || textNotation.length() > 0) {
        Element structureElement = new Element(STRUCTURE_ELEMENT);

        Element notationSourceElement = new Element(NOTATION_SOURCE_ELEMENT);
        notationSourceElement.setText(NotationConstant.NOTATION_SOURCE);
        structureElement.getChildren().add(notationSourceElement);

        Element textNotationElement = new Element(TEXT_NOTATION_ELEMENT);
        textNotationElement.setText(textNotation);
        structureElement.getChildren().add(textNotationElement);

        boolean containsGenericStruc = containsGenericStructure(graph);
        if (containsGenericStruc) {
            // String canonicalNotation =
            // getCanonicalNotation(textNotation);
            String canonicalNotation = ComplexNotationParser
                    .getCanonicalNotation(textNotation);

            Element canNotationElement = new Element(
                    CANONICAL_NOTATION_ELEMENT);
            canNotationElement.setText(canonicalNotation);
            structureElement.getChildren().add(canNotationElement);
        } else {
            String canonicalSmiles = ComplexNotationParser
                    .getComplexPolymerSMILES(textNotation);
            Element canSmilesElement = new Element(CANONICAL_SMILES_ELEMENT);
            canSmilesElement.setText(canonicalSmiles);
            structureElement.getChildren().add(canSmilesElement);
        }

        String structureXML = MacromoleculeEditor.getGraphXML(graph);
        Element structureXMLElement = new Element(STRUCTURE_XML_ELEMENT);

        CDATA structureXMLcdata = new CDATA(structureXML);
        structureXMLElement.setContent(structureXMLcdata);
        // structureXMLElement.setText(encodedStructureXML);
        structureElement.getChildren().add(structureXMLElement);

        Element newMonomers = getNewMonomersElement(graph);
        if (null != newMonomers) {
            structureElement.getChildren().add(newMonomers);
        }

        return structureElement;
    } else {
        return null;
    }
}
项目:XSLTXT    文件:StringStatement.java   
StringStatement(CDATA c) {

    super(desc);

    s = doubleSlash(c.getText());
    isCDATA = true;
    }
项目:XSLTXT    文件:StatementFactory.java   
/**
    * Returns a StringStatement for the CDATA passed in.
    *
    * @param c the CDATA
    * @return a StringStatement
    */
   Statement getStatement(CDATA c) {
if (logCat.isDebugEnabled())
    logCat.debug("getStatement(" + c + ")");
return new StringStatement(c);
   }