Package org.jdom.output

Examples of org.jdom.output.XMLOutputter


            logger.fatal(ele1.getMessage(), ele1);
            throw new JMSException(ele1.getMessage());
          }
          controlArea.addContent(eResult);

          XMLOutputter xOut = new XMLOutputter();
          return xOut.outputString(errorDoc);
        }
        else {
          return null;
        }
      }
    }
    catch (XmlDocumentReaderException e2) {
      logger.fatal(getConsumerName() +
                   " - Error creating document from message passed in");
      logger.fatal(e2.getMessage(), e2);
      throw new JMSException(e2.getMessage());
    }

    Element inControlArea = getControlArea(inDoc.getRootElement());
    String msgAction = null;
    if (inControlArea != null) {
      msgAction = inControlArea.getAttribute("messageAction").getValue();
    }
    else {
      String errMessage =
        getConsumerName() + " - Could not retrieve ControlArea from message passed in.";
      logger.fatal(errMessage);
      throw new JMSException(errMessage);
    }

    if (errorDoc != null) {
      Element controlArea = getControlArea(errorDoc.getRootElement());

      Result aResult = new Result();
      aResult.setStatus("failure");
      aResult.setAction(msgAction);

      org.openeai.moa.objects.resources.Error anError =
        new org.openeai.moa.objects.resources.Error();
      anError.setType(errType);
      anError.setErrorNumber(errNumber);
      anError.setErrorDescription(errDesc);

      ProcessedMessageId processedMsgId = new ProcessedMessageId();
      Element eRequestSender = inControlArea.getChild("Sender");
      Sender reqSender = new Sender();
      try {
        reqSender.buildObjectFromInput(eRequestSender);
      }
      catch (EnterpriseLayoutException ele) {
        logger.fatal(ele.getMessage(), ele);
        throw new JMSException(ele.getMessage());
      }

      processedMsgId.setProducerId(reqSender.getMessageId().getProducerId());
      processedMsgId.setSenderAppId(reqSender.getMessageId().getSenderAppId());
      processedMsgId.setMessageSeq(reqSender.getMessageId().getMessageSeq());

      aResult.setProcessedMessageId(processedMsgId);
      aResult.addError(anError);

      controlArea.removeChild("Result");
      Element eResult = null;
      try {
        eResult = (Element)aResult.buildOutputFromObject();
      }
      catch (EnterpriseLayoutException ele1) {
        logger.fatal(ele1.getMessage(), ele1);
        throw new JMSException(ele1.getMessage());
      }
      controlArea.addContent(eResult);

      XMLOutputter xOut = new XMLOutputter();
      return xOut.outputString(errorDoc);
    }
    return null;
  }
View Full Code Here


    anError.setErrorDescription(errDescription);
    return anError;
  }

  protected String convertToString(Document doc) throws IOException {
    XMLOutputter xmlOut = new XMLOutputter();
    ByteArrayOutputStream bArray = new ByteArrayOutputStream();
    xmlOut.output(doc, bArray);
    return new String(bArray.toByteArray());
  }
View Full Code Here

      Element eResult = (Element)aResult.buildOutputFromObject();
      eControlArea.addContent(eResult);
      syncErrorDoc.getRootElement().removeContent(eControlArea);
      syncErrorDoc.getRootElement().addContent(eControlArea);
      TextMessage syncErrorMessage = getSyncErrorPublisher().createTextMessage();
      XMLOutputter xmlOut = new XMLOutputter();
      syncErrorMessage.setText(xmlOut.outputString(syncErrorDoc));
      if (getSyncErrorPublisher().getDefaultCommandName().length() == 0 ||
        getSyncErrorPublisher().getDefaultCommandName() == null) {
        getSyncErrorPublisher().setDefaultCommandName("EnterpriseSyncErrorSync");
      }
      syncErrorMessage.setStringProperty(MessageProducer.MESSAGE_ID,msgId.toString());
View Full Code Here

        // (OPTIONAL)
        Document doc = invokeService(SERVICE_NAME,
                                     "/org/codehaus/xfire/addressing/testcases/echo/soap12/duplicateFaultToRequest.xml");

       
        XMLOutputter output = new XMLOutputter();
        output.output(doc, System.out);
        addNamespace("wsa", "http://www.w3.org/2005/08/addressing");
        assertValid("/soap:Envelope/soap:Header/wsa:Action[text()='http://www.w3.org/2005/08/addressing/fault']",
                    doc);
        assertValid("/soap:Envelope/soap:Body/soap:Fault/soap:Code/soap:Value[text()='ns1:Sender']",
                    doc);
View Full Code Here

      //  soap11:Envelope/soap11:Header/customer:CustomerKey/@wsa:isReferenceParameter cast as xs:boolean = true()
      //  soap11:Envelope/soap11:Body/soap11:Fault/soap11:faultcode/(resolve-QName(.,.) = xs:QName('echo:EmptyEchoString'))
    Document doc = invokeService(SERVICE_NAME,
                                 "/org/codehaus/xfire/addressing/testcases/echo/soap11/message8.xml");

    XMLOutputter output = new XMLOutputter();
    output.output(doc, System.out);
    assertEquals(data.getInHeaders().getAction(), "http://example.org/action/echoIn");
    assertEquals(data.getInHeaders().getReplyTo().getAddress(),
                 "http://www.w3.org/2005/08/addressing/anonymous");
    Element refParams = data.getInHeaders().getReplyTo().getReferenceParametersElement();
    Element customerKey = refParams.getChild("CustomerKey", Namespace
View Full Code Here

  }

  public void writeGetCoverageDoc( PrintWriter pw )
          throws IOException
  {
    XMLOutputter xmlOutputter = new XMLOutputter( Format.getPrettyFormat() );
    xmlOutputter.output( getGetCoverageDoc(), pw );
  }
View Full Code Here

  /** Write the information as an XML document
   * @return String contining netcdfDatasetInfo XML
   */
  public String writeXML( )  {
    XMLOutputter fmt = new XMLOutputter( Format.getPrettyFormat());
    return fmt.outputString( makeDocument());
  }
View Full Code Here

    }
    return null;
  }

  public void writeXML(OutputStream os) throws IOException {
    XMLOutputter fmt = new XMLOutputter( Format.getPrettyFormat());
    fmt.output( makeDocument(), os);
  }
View Full Code Here

      String ind = pretty.getIndent();
      String mine = "\r\n";
      pretty.setLineSeparator(mine);

      // wierd - cant pretty print ??!!
      XMLOutputter fmt = new XMLOutputter(pretty);
      Writer pw = new FileWriter("C:/docs/bufr/wmo/wordNice.txt");
      fmt.output(doc, pw);

    } catch (JDOMException e) {
      throw new IOException(e.getMessage());
    }
View Full Code Here

      Element nroot = new Element("ndoc");
      ndoc.setRootElement(nroot);

      transform2(tdoc.getRootElement(), nroot);

      XMLOutputter fmt = new XMLOutputter(Format.getPrettyFormat());
      Writer pw = new FileWriter(trans2);
      fmt.output(ndoc, pw);
      pw = new PrintWriter(System.out);
      fmt.output(ndoc, pw);

    } catch (JDOMException e) {
      throw new IOException(e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of org.jdom.output.XMLOutputter

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.