Package com.dotcms.repackage.org.jdom

Examples of com.dotcms.repackage.org.jdom.Document


  public Document getResponseAsDocument() throws IOException {
    InputStream in = getResponseBodyAsStream();
//        IOUtils.copy( in, out );
//        String xml = out.toString();
    try {
      Document document = RespUtils.getJDomDocument(in);
      return document;
    } catch (JDOMException ex) {
      throw new RuntimeException(ex);
    }
  }
View Full Code Here


      Header serverDateHeader = this.getResponseHeader("Date");
      String serverDate = null;
      if (serverDateHeader != null) {
        serverDate = serverDateHeader.getValue();
      }
      Document document = getResponseAsDocument();
      if (document == null) {
        return responses;
      }
      Element root = document.getRootElement();
      List<Element> responseEls = RespUtils.getElements(root, "response");
      for (Element el : responseEls) {
        Response resp = new Response(serverDate, el);

        // Dont add if href is the requested url
View Full Code Here

        InputStream in = getResponseBodyAsStream();
        IOUtils.copy( in, out );
        String xml = out.toString();
        try {

            Document document = RespUtils.getJDomDocument( new ByteArrayInputStream( xml.getBytes() ) );
            return document;
        } catch( JDOMException ex ) {
            throw new RuntimeException(xml, ex );
        }
    }
View Full Code Here

    }
 
    public String getLockToken() {
        try {

            Document document = getResponseAsDocument();
            if( document == null ) {
                throw new RuntimeException("Got empty response to LOCK request");
            }
            Element root = document.getRootElement();
            List<Element> lockTokenEls = RespUtils.getElements(root, "locktoken");
            for( Element el : lockTokenEls) {
        String token = RespUtils.asString( el, "href" );
        if( token == null ) {
          throw new RuntimeException("No href element in locktoken");
View Full Code Here

    public Document getResponseAsDocument() throws IOException {       
        InputStream in = getResponseBodyAsStream();
//        IOUtils.copy( in, out );
//        String xml = out.toString();
        try {
            Document document = RespUtils.getJDomDocument(in);
            return document;
        } catch( JDOMException ex ) {
            throw new RuntimeException( ex );
        }
    } 
View Full Code Here

public class TestStxxAction extends Action {

  public ActionForward execute(ActionMapping mapping, ActionForm form,
      HttpServletRequest req, HttpServletResponse res) throws Exception {

    Document document = new Document(new Element("test"));

    Element usersEl = new Element("users");

    Iterator itr = CompanyLocalManagerUtil.getUsers(
        PortalUtil.getCompanyId(req)).iterator();

    while (itr.hasNext()) {
      User user = (User) itr.next();

      Element userEl = new Element("user");

      userEl.addContent(new Element("full-name").setText(user
          .getFullName()));

      userEl.addContent(new Element("email-address").setText(user
          .getEmailAddress()));

      usersEl.addContent(userEl);
    }

    document.getRootElement().addContent(usersEl);

    Logger.info(this, document.toString());

    saveDocument(req, document);

    return mapping.findForward("portal.test_stxx");
  }
View Full Code Here

                    projectFile.getAbsolutePath(), Project.MSG_INFO );
                projectFile = null;
            }
        }

        Document projectDocument = null;
        try
        {
            if ( velocityPropertiesFile.exists() )
            {
                String file = velocityPropertiesFile.getAbsolutePath();
View Full Code Here

                //-- command line status
                log("Input:  " + xmlFile, Project.MSG_INFO );

                // Build the JDOM Document
                Document root = builder.build(inFile);

                // Shove things into the Context
                VelocityContext context = new VelocityContext();

                /*
                 *  get the property TEMPLATE_ENCODING
                 *  we know it's a string...
                 */
                String encoding = (String) ve.getProperty( RuntimeConstants.OUTPUT_ENCODING );
                if (encoding == null || encoding.length() == 0
                    || encoding.equals("8859-1") || encoding.equals("8859_1"))
                {
                    encoding = "ISO-8859-1";
                }

                Format f = Format.getRawFormat();
                f.setEncoding(encoding);

                OutputWrapper ow = new OutputWrapper(f);

                context.put ("root", root.getRootElement());
                context.put ("xmlout", ow );
                context.put ("relativePath", getRelativePath(xmlFile));
                context.put ("treeWalk", new TreeWalker());
                context.put ("xpath", new XPathTool() );
                context.put ("escape", new Escape() );
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.org.jdom.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.