org.apache.axiom.om.OMElement.setText()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中org.apache.axiom.om.OMElement.setText()方法的一些代码示例,展示了OMElement.setText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMElement.setText()方法的具体详情如下:
包路径:org.apache.axiom.om.OMElement
类名称:OMElement
方法名:setText

OMElement.setText介绍

[英]Set the content of this element to the given text. If the element has children, then all these children are detached before the content is set. If the parameter is a non empty string, then the element will have a single child of type OMText after the method returns. If the parameter is null or an empty string, then the element will have no children.
[中]

代码示例

代码示例来源:origin: stackoverflow.com

OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement omSecurityElement = omFactory.createOMElement(new QName( "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security", "wsse"), null);

OMElement omusertoken = omFactory.createOMElement(new QName("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", "UsernameToken", "wsu"), null);

OMElement omuserName = omFactory.createOMElement(new QName("", "Username", "wsse"), null);
omuserName.setText("myusername");

OMElement omPassword = omFactory.createOMElement(new QName("", "Password", "wsse"), null);
omPassword.addAttribute("Type","http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText",null );
omPassword.setText("mypassword");

omusertoken.addChild(omuserName);
omusertoken.addChild(omPassword);
omSecurityElement.addChild(omusertoken);
stub._getServiceClient().addHeader(omSecurityElement);

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.registry.extensions

public static OMElement getHistoryInfoElement(String text){
  try {
    String template = "<info></info>";
    OMElement infoElement = AXIOMUtil.stringToOM(template);
    infoElement.setText(text);
    return infoElement;
  } catch (XMLStreamException e) {
    log.error("Unable to build the lifecycle history info element");
  }
  return null;
}

代码示例来源:origin: org.apache.sandesha2/sandesha2-samples

private static OMElement getPingOMBlock(String text) {
  OMFactory fac = OMAbstractFactory.getOMFactory();
  OMNamespace namespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
  OMElement pingElem = fac.createOMElement(ping, namespace);
  OMElement textElem = fac.createOMElement(Text, namespace);
  
  textElem.setText(text);
  pingElem.addChild(textElem);
  return pingElem;
}

代码示例来源:origin: org.apache.axis2/axis2-kernel

public static OMElement getParameter(String name, String value,
                   boolean locked) {
  OMFactory fac = OMAbstractFactory.getOMFactory();
  OMElement parameter = fac.createOMElement("parameter", null);
  parameter.addAttribute("name", name, null);
  parameter.addAttribute("locked", Boolean.toString(locked), null);
  parameter.setText(value);
  return parameter;
}

代码示例来源:origin: org.apache.axis2/axis2-transport-testkit

@Override
protected XMLMessage prepareRequest() throws Exception {
  OMFactory factory = OMAbstractFactory.getOMFactory();
  OMElement orgElement = factory.createOMElement(new QName("root"));
  orgElement.setText(data.getText());
  return new XMLMessage(orgElement, xmlMessageType);
}

代码示例来源:origin: org.apache.synapse/synapse-core

private static OMElement getSerializedDescription(MessageProcessor processor) {
  OMElement descriptionElem = fac.createOMElement(
      new QName(SynapseConstants.SYNAPSE_NAMESPACE, "description"));
  if (processor.getDescription() != null) {
    descriptionElem.setText(processor.getDescription());
    return descriptionElem;
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.synapse/synapse-core

private static OMElement getSerializedDescription(MessageStore messageStore) {
  OMElement descriptionElem = fac.createOMElement(
      new QName(SynapseConstants.SYNAPSE_NAMESPACE, "description"));
  if (messageStore.getDescription() != null) {
    descriptionElem.setText(messageStore.getDescription());
    return descriptionElem;
  } else {
    return null;
  }
}

代码示例来源:origin: org.apache.airavata/airavata-messenger-client

private OMElement createMessageEl(String msgboxid) throws AxisFault {
  OMElement message = factory.createOMElement("destroyMsgBox", NameSpaceConstants.MSG_BOX);
  OMElement msgBoxId = factory.createOMElement("MsgBoxId", NameSpaceConstants.MSG_BOX);
  msgBoxId.setText(msgboxid);
  message.addChild(msgBoxId);
  message.declareNamespace(NameSpaceConstants.MSG_BOX);
  return message;
}

代码示例来源:origin: org.wso2.ei/org.wso2.ei.samples

public void addDummyElements(long numElements) {
  OMElement dummies = fac.createOMElement("Dummies", null);
  msg.addChild(dummies);
  for (long i = 0; i < numElements; i++) {
    OMElement dummy = fac.createOMElement("Dummy", null);
    dummy.setText("This is the dummy element " + i);
    dummies.addChild(dummy);
  }
}

代码示例来源:origin: org.apache.synapse/synapse-core

private OMElement getSerializedDescription(Endpoint endpoint) {
  OMElement descriptionElem = fac.createOMElement(
      "description", SynapseConstants.SYNAPSE_OMNAMESPACE);
  if (endpoint.getDescription() != null) {
    descriptionElem.setText(endpoint.getDescription());
    return descriptionElem;
  } else {
    return null;
  }
}

代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.reporting.template.core

private OMElement getDataElement(DataDTO data, String elementName) {
  OMFactory fac = OMAbstractFactory.getOMFactory();
  OMElement dataElement = fac.createOMElement(new QName(elementName));
  dataElement.addAttribute(ID, data.getFieldId(), null);
  OMElement table = fac.createOMElement(new QName(TABLE));
  table.setText(data.getDsTableName());
  dataElement.addChild(table);
  OMElement field = fac.createOMElement(new QName(COLUMN));
  field.setText(data.getDsColumnName());
  dataElement.addChild(field);
  return dataElement;
}

代码示例来源:origin: org.springframework.ws/org.springframework.ws

public void addText(String text) {
  try {
    getAxiomElement().setText(text);
  }
  catch (OMException ex) {
    throw new AxiomSoapFaultException(ex);
  }
}

代码示例来源:origin: spring-projects/spring-ws

@Override
public void addText(String text) {
  try {
    getAxiomElement().setText(text);
  }
  catch (OMException ex) {
    throw new AxiomSoapFaultException(ex);
  }
}

代码示例来源:origin: org.springframework.ws/spring-ws-core

@Override
public void addText(String text) {
  try {
    getAxiomElement().setText(text);
  }
  catch (OMException ex) {
    throw new AxiomSoapFaultException(ex);
  }
}

代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.list

@Override
public void setPayload(OMElement bodyContent) throws XMLStreamException {
  OMFactory factory = bodyContent.getOMFactory();
  OMElement returnElement = factory.createOMElement(new QName(bodyContent.getNamespace().getPrefix() + ":return"));
  returnElement.setText(String.valueOf(succeed));
  bodyContent.addChild(returnElement);
}

代码示例来源:origin: org.apache.sandesha2/sandesha2-core

public OMElement toOMElement(OMElement element, OMNamespace rmNamespace) throws OMException {
  if (messageNumber <= 0 ){
    throw new OMException(SandeshaMessageHelper.getMessage(
        SandeshaMessageKeys.setAValidMsgNumber,
        Long.toString(messageNumber)));
  }
  
  OMFactory factory = element.getOMFactory();
  
  OMElement messageNoElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.LAST_MSG_NUMBER,rmNamespace);
  messageNoElement.setText(Long.toString(messageNumber));
  element.addChild(messageNoElement);
  
  return element;
}

代码示例来源:origin: org.apache.sandesha2/sandesha2-core

public OMElement toOMElement(OMElement element, OMNamespace wsrmNamespace) throws OMException {
  if (identifier == null || identifier == "") {
    throw new OMException(SandeshaMessageHelper.getMessage(
        SandeshaMessageKeys.invalidIdentifier,
        element.toString()));
  }
  
  OMFactory factory = element.getOMFactory();
  OMElement identifierElement = factory.createOMElement(Sandesha2Constants.WSRM_COMMON.IDENTIFIER, wsrmNamespace);
  identifierElement.setText(identifier);
  element.addChild(identifierElement);
  return element;
}

代码示例来源:origin: org.wso2.carbon.data/org.wso2.carbon.dataservices.core

private static void serializeSQLQueryProps(SQLQuery sqlQuery, OMElement queryEl, OMFactory fac) {
  OMElement sqlEl = fac.createOMElement(new QName(DBSFields.SQL));
  sqlEl.setText(sqlQuery.getQuery());
  queryEl.addChild(sqlEl);
  if (sqlQuery.isReturnGeneratedKeys()) {
    queryEl.addAttribute(DBSFields.RETURN_GENERATED_KEYS, Boolean.TRUE.toString(), null);
  } else if (sqlQuery.isReturnUpdatedRowCount()) {
    queryEl.addAttribute(DBSFields.RETURN_UPDATED_ROW_COUNT, Boolean.TRUE.toString(), null);
  }
}

代码示例来源:origin: com.betfair.cougar/baseline-security

@Override
public void rewrite(List<IdentityToken> credentials, OMElement output) {
  OMFactory factory = output.getOMFactory();
  for (IdentityToken ik: credentials) {
    OMElement e = factory.createOMElement(ik.getName(), output.getNamespace());
    e.setText(ik.getValue());
    output.addChild(e);
  }
}

代码示例来源:origin: org.wso2.carbon.commons/org.wso2.carbon.reporting.template.core

private void updateSubReportParamName(OMElement subReportElement, String paramName) throws JaxenException {
  AXIOMXPath xpathExpression = new AXIOMXPath("//a:subreportParameter//a:subreportParameterExpression");
  xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
  List nodeList = xpathExpression.selectNodes(subReportElement);
  OMElement repExp = (OMElement) nodeList.get(0);
  repExp.setText("");
  OMFactory factory = document.getOMFactory();
  OMText cdataField = factory.createOMText(repExp, "$P{" + paramName + "}", OMText.CDATA_SECTION_NODE);
  repExp.addChild(cdataField);
}

相关文章

微信公众号

最新文章

更多