Examples of XMLOutputter


Examples of org.jdom.output.XMLOutputter

  //============================================================================
  //============================================================================
  private void outputXMLElement(Element element, String message) {
    try {
      XMLOutputter fmt = new XMLOutputter(Format.getPrettyFormat());
      logger.fatal(message);
      logger.fatal("\n" + fmt.outputString(element));
    }
    catch (Exception exc) {
      logger.fatal("Error converting XML Element to String.");
      logger.fatal(exc.getMessage(), exc);
    }
View Full Code Here

Examples of org.jdom.output.XMLOutputter

  *  Returns the messageBody that was built during the initializeInput method call.
  *  this will be a 'String' object built from the message body of the JMS message passed in.
  *  @return  String
  */
  public final String getMessageBody(Document inDoc) {
    XMLOutputter xmlOut = new XMLOutputter();
    return xmlOut.outputString(inDoc);
  }
View Full Code Here

Examples of org.jdom.output.XMLOutputter

    File messageStore = new File(msgDumpDir);
    if (messageStore.exists() == false) {
      messageStore.mkdirs();
    }

    XMLOutputter xmlOut = new XMLOutputter();
    Element eControlArea = getControlArea(doc.getRootElement());
    Element eMessageId = eControlArea.getChild("Sender").getChild("MessageId");
    String senderAppId = eMessageId.getChild("SenderAppId").getText();
    String producerId = eMessageId.getChild("ProducerId").getText();
    String messageSeq = eMessageId.getChild("MessageSeq").getText();
    String fileName = senderAppId + "-" + producerId + "-" + messageSeq + ".xml";
    if (msgDumpDir.lastIndexOf("/") != msgDumpDir.length() - 1) {
      msgDumpDir = msgDumpDir + "/";
    }
    logger.info("Writing message to file: " + msgDumpDir + fileName);
    try {
       xmlOut.output(doc, new FileOutputStream(msgDumpDir + fileName));
    }
    catch (Exception e) {
      String msg = "Error dumping message to a file.  Exception: " + e.getMessage();
      logger.fatal(msg);
      throw new IOException(msg);
View Full Code Here

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

Examples of org.jdom.output.XMLOutputter

    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

Examples of org.jdom.output.XMLOutputter

      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

Examples of org.jdom.output.XMLOutputter

        // (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

Examples of org.jdom.output.XMLOutputter

      //  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

Examples of org.jdom.output.XMLOutputter

  }

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

Examples of org.jdom.output.XMLOutputter

  /** 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
TOP
Copyright © 2018 www.massapi.com. 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.