Package org.dom4j.io

Examples of org.dom4j.io.SAXReader


            importInteraction.reportError("File does not exist: " + file.getAbsolutePath());
            return null//we should really sit in a loop until they cancel or give us a valid file.
        }

        try {
            SAXReader reader = new SAXReader();
            Document document = reader.read(file);

            return new DOM4JSettingsNode(document.getRootElement());
        } catch (Throwable t) {
            LOGGER.error("Unable to read file: " + file.getAbsolutePath(), t);
            importInteraction.reportError("Unable to read file: " + file.getAbsolutePath());
View Full Code Here


     * @return
     */
    public static final Document parse (InputStream in) {
        Assert.notNull(in);
        try {
            SAXReader reader = new SAXReader();
            return reader.read(in);
        } catch (Exception e) {
            log.warn("Could not read and parse XML document from stream [" + in + "]", e);
            throw new IWebMvcException(e);
        }
    }
View Full Code Here

     * @throws Exception
     */
    private org.dom4j.Document replaceVariableProperties(byte[] documentBuffer)
        throws Exception
    {
        SAXReader reader = new SAXReader();
        org.dom4j.Document document = reader.read(new ByteArrayInputStream(documentBuffer));
       
        // List elements = document.selectNodes("//*[contains(text(),'%module%')]");
        List elements = document.selectNodes("//*");
        for (final Iterator it = elements.iterator(); it.hasNext(); )
        {
View Full Code Here

   *
   * @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);
View Full Code Here

   * @param document
   * @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) {
      throw new StarFlowParserException("流程定义信息不正确", e);
    }
    return element;
View Full Code Here

   * @param document
   * @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) {
      throw new StarFlowParserException("流程定义信息不正确", e);
    }
    return list;
View Full Code Here

* @author libinsong1204@gmail.com
* @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);
    }
    return document;
  }
View Full Code Here

     * @return the max depth of the bookmarks tree. 0 if no bookmark.
     */
    public static int getMaxBookmarksDepth(InputStream bookmarks) throws Exception {
        int retVal = 0;
        if (bookmarks != null) {
            SAXReader reader = new SAXReader();
            org.dom4j.Document document = reader.read(bookmarks);
            StringBuffer buffer = new StringBuffer("/Bookmark/Title[@Action=\"GoTo\"]");
            List nodes = document.selectNodes(buffer.toString());
            while ((nodes != null && nodes.size() > 0)) {
                retVal++;
                buffer.append("/Title[@Action=\"GoTo\"]");
View Full Code Here

    private PdfFile[] parseXmlFile(File inputFile) throws ConcatException {
        List fileList = new ArrayList();
        String parentPath = null;
        try {
            LOG.debug("Parsing xml file " + inputFile.getAbsolutePath());
            SAXReader reader = new SAXReader();
            org.dom4j.Document document = reader.read(inputFile);
            List nodes = document.selectNodes("/filelist/*");
            parentPath = inputFile.getParent();
            for (Iterator iter = nodes.iterator(); iter.hasNext();) {
                Node domNode = (Node) iter.next();
                String nodeName = domNode.getName();
View Full Code Here

  private Transitions parseXmlInput(File inputFile, Transitions transitions) throws SlideShowException{
    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");
View Full Code Here

TOP

Related Classes of org.dom4j.io.SAXReader

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.