Package org.dom4j

Examples of org.dom4j.Document


   * @param processDefine
   * @return
   */
  public static ProcessDefine parserProcessInfo(ProcessDefine processDefine) {
    SAXReader reader = new SAXReader();
    Document document = null;
    try {
      document = reader.read(new StringReader(processDefine.getProcessDefContent()));
      Element rootElement = document.getRootElement();
      String _name = rootElement.attributeValue(StarFlowNames.FLOW_ATTR_NAME);
      String _chname = rootElement.attributeValue(StarFlowNames.FLOW_ATTR_CHNAME);
      String _version = rootElement.attributeValue(StarFlowNames.FLOW_ATTR_VERSION);
      String _xpath = "/ProcessDefine/ProcessProperty/".concat(StarFlowNames.FLOW_CHILD_DESC);
      String _description = rootElement.selectSingleNode(_xpath).getText();
View Full Code Here


   * @param activityDefId
   * @return
   */
  public static Element parserActivityInfo(String processDefContent, String activityDefId) {
    SAXReader reader = new SAXReader();
    Document document = null;
    Element element = null;
    try {
      document = reader.read(new StringReader(processDefContent));
      element = parserActivityInfo(document, activityDefId);
    } catch (Exception e) {
View Full Code Here

   * @param activityDefId
   * @return
   */
  public static List<Element> parserTransitionInfo(String processDefContent, String activityDefId) {
    SAXReader reader = new SAXReader();
    Document document = null;
    List<Element> list = null;
    try {
      document = reader.read(new StringReader(processDefContent));
      list = parserTransitionInfoFromTo(document, activityDefId);
    } catch (Exception e) {
View Full Code Here

      throws DocumentException {
    if (xml == null || xml.trim().length() < 1) {
      return xml;
    }

    Document doc = DocumentHelper.parseText(xml);
    return getPrettyString(doc, encoding);
  }
View Full Code Here

* @version 1.0
*/
public class ProcessDefineParser {
  public static Document createDocument(String xml) {
    SAXReader reader = new SAXReader();
    Document document = null;
    try {
      document = reader.read(new StringReader(xml));
    } catch (Exception e) {
      throw new StarFlowParserException("流程定义信息不正确", e);
    }
View Full Code Here

    return document;
  }
 
  public static ProcessElement createProcessXml(String xml) {
    ProcessElement processXml = new ProcessElement();
    Document document = createDocument(xml);
    queryProcessXmlInfo(processXml, document);
    processXml.setTransitions(queryTransitionXmlInfo(document));
    processXml.setActivitys(queryActivityXmlInfo(processXml, document));
    return processXml;
  }
View Full Code Here

    Transitions retVal = transitions;
    if(inputFile!=null){
      try{
        LOG.debug("Parsing xml transitions file "+inputFile.getAbsolutePath());   
        SAXReader reader = new SAXReader();
        Document document = reader.read(inputFile);
        Node rootNode = document.selectSingleNode("/transitions");
        if(rootNode != null){
          Node defType = rootNode.selectSingleNode("@defaulttype");
          Node defTransDur = rootNode.selectSingleNode("@defaulttduration");
          Node defDur = rootNode.selectSingleNode("@defaultduration");
          if(defType != null && defTransDur != null && defDur != null){
            if(transitions.getDefaultTransition() != null){
              throw new SlideShowException(SlideShowException.ERR_DEFAULT_TRANSITION_ALREADY_SET);
            }else{
              transitions.setDefaultTransition(new Transition(Transition.EVERY_PAGE, new Integer(defTransDur.getText().trim()).intValue(), defType.getText().trim(), new Integer(defDur.getText().trim()).intValue()));
            }
          }
          List transitionsList = document.selectNodes("/transitions/transition");
          for (int i = 0; transitionsList != null && i < transitionsList.size(); i++) {
            Node transitionNode = (Node) transitionsList.get(i);
            Node type = transitionNode.selectSingleNode("@type");
            Node transDuration = transitionNode.selectSingleNode("@tduration");
            Node duration = transitionNode.selectSingleNode("@duration");
View Full Code Here

     * @param selectedFile
     * @throws Exception
     */
    public void writeXmlFile(PdfSelectionTableItem[] rows, File selectedFile) throws Exception {
        if (selectedFile != null && rows != null) {
            Document document = DocumentHelper.createDocument();
            Element root = document.addElement("filelist");
            for (int i = 0; i < rows.length; i++) {
                PdfSelectionTableItem row = rows[i];
                Element node = (Element) root.addElement("file");
                node.addAttribute("value", row.getInputFile().getAbsolutePath());
                String pwd = row.getPassword();
View Full Code Here

   * @param in
   * @param validateXML
   * @return parsed document
   */
  public Document parse(InputStream in, boolean validateXML) {
    Document document;
    try {
      SAXReader reader = new SAXReader();
      reader.setEntityResolver(er);
      reader.setValidation(validateXML);
      document = reader.read(in, "");
View Full Code Here

      try
      {
         SAXReader reader = new SAXReader();
         reader.setEntityResolver(new JBossEntityResolver());

         Document metaDoc = reader.read(metaTmpFile);
         metaData = new DeploymentMetaData(metaDoc);
         log.debug(DeploymentMetaData.ENTRY_NAME + "\n" + metaData.toXMLString());
      }
      catch (Exception e)
      {
View Full Code Here

TOP

Related Classes of org.dom4j.Document

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.