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

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

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

OMAttribute.setAttributeValue介绍

暂无

代码示例

代码示例来源:origin: org.apache.abdera/abdera-parser

public Attribute setText(String text) {
  attr.setAttributeValue(text);
  return this;
}

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

private void updateFontAttributes(OMElement fontElement, FontStyleDTO style) {
  fontElement.getAttribute(new QName("fontName")).
      setAttributeValue(style.getFontName());
  fontElement.getAttribute(new QName("size")).
      setAttributeValue(String.valueOf(style.getFontSize()));
  fontElement.getAttribute(new QName("isBold")).
      setAttributeValue(String.valueOf(style.isBold()));
  fontElement.getAttribute(new QName("isItalic")).
      setAttributeValue(String.valueOf(style.isItalic()));
  fontElement.getAttribute(new QName("isUnderline")).
      setAttributeValue(String.valueOf(style.isUnderLine()));
  fontElement.getAttribute(new QName("isStrikeThrough")).
      setAttributeValue(String.valueOf(style.isStrikeThough()));
}

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

private void updateSubReportPosition(OMElement subReportElement, int yPos) throws JaxenException {
  AXIOMXPath xpathExpression = new AXIOMXPath("//a:reportElement");
  xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
  List nodeList = xpathExpression.selectNodes(subReportElement);
  OMElement repElement = (OMElement) nodeList.get(0);
  repElement.getAttribute(new QName("y")).setAttributeValue(String.valueOf(yPos));
}

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

private void handleReportName() {
  OMElement documentElement = document.getOMDocumentElement();
  documentElement.getAttribute(new QName("name")).setAttributeValue(report.getReportName());
}

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

private void handleTableOutlines() throws JaxenException {
  AXIOMXPath xpathExpression = new AXIOMXPath("//a:style//a:box//a:pen");
  xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
  OMElement documentElement = document.getOMDocumentElement();
  List nodeList = xpathExpression.selectNodes(documentElement);
  OMElement penElement = (OMElement) nodeList.get(0);
  penElement.getAttribute(new QName("lineWidth")).setAttributeValue(String.format("%.1g%n",
      tableReport.getOutLineThickness()));
  penElement.getAttribute(new QName("lineColor")).setAttributeValue(tableReport.getOutLineColor());
}

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

private void addParam(String dsname, String className) throws JaxenException {
  AXIOMXPath xpathExpression = new AXIOMXPath("//a:parameter");
  xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
  OMElement documentElement = document.getOMDocumentElement();
  List nodeList = xpathExpression.selectNodes(documentElement);
  OMElement element = (OMElement) nodeList.get(0);
  OMElement newParam = element.cloneOMElement();
  newParam.getAttribute(new QName("name")).setAttributeValue(dsname);
  newParam.getAttribute(new QName("class")).setAttributeValue(className);
  documentElement.addChild(newParam);
}

代码示例来源:origin: usnistgov/iheos-toolkit2

void updateDisplayName(OMElement classification, String displayName) {
  OMElement nameElement = XmlUtil.firstChildWithLocalName(classification, "Name");
  if (nameElement == null) return;
  OMElement localizedStringElement = XmlUtil.firstChildWithLocalName(nameElement, "LocalizedString");
  if (localizedStringElement == null) return;
  localizedStringElement.getAttribute(valueQName).setAttributeValue(displayName);
}

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

private void replaceElement(TemplateEndpoint templateEndpoint, OMElement element) {
  Iterator attributesItr = element.getAllAttributes();
  while (attributesItr.hasNext()) {
    OMAttribute attribute = (OMAttribute) attributesItr.next();
    String replace = replace(attribute.getAttributeValue(), templateEndpoint);
    if (replace != null) {
      attribute.setAttributeValue(replace);
    }
  }
  if (element.getText() != null && !"".equals(element.getText())) {
    String replace = replace(element.getText(), templateEndpoint);
    if (replace != null) {
      element.setText(replace);
    }
  }
  Iterator elemItr = element.getChildElements();
  while (elemItr.hasNext()) {
    OMElement childElement = (OMElement) elemItr.next();
    replaceElement(templateEndpoint, childElement);
  }
}

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

protected void handleBackgroundColor() throws JaxenException {
  AXIOMXPath xpathExpression = new AXIOMXPath("//a:background//a:band//a:staticText//a:reportElement");
  xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
  OMElement documentElement = document.getOMDocumentElement();
  List nodeList = xpathExpression.selectNodes(documentElement);
  OMElement element = (OMElement) nodeList.get(0);
  element.getAttribute(new QName("backcolor")).setAttributeValue(report.getBackgroundColour());
}

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

private void handleChartBackgroundColor(String chartText) throws JaxenException {
  AXIOMXPath xpathExpression = new AXIOMXPath("//a:title//a:band//a:" + chartText + "//a:chart//a:reportElement");
  xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
  OMElement documentElement = document.getOMDocumentElement();
  List nodeList = xpathExpression.selectNodes(documentElement);
  OMElement element = (OMElement) nodeList.get(0);
  element.getAttribute(new QName("backcolor")).setAttributeValue(chart.getChartBackColor());
}

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

private static OMElement updateWSDLImports(OMElement omElement,boolean isMasterArtifact) throws JaxenException {
  AXIOMXPath xPath = new AXIOMXPath("//wsd:import[@location]");
  xPath.addNamespace("wsd", "http://schemas.xmlsoap.org/wsdl/");
  Object result = xPath.evaluate(omElement);
  if(!(result instanceof ArrayList)){
   return omElement;
  }
  List list = (ArrayList) result;
  for (Object obj : list) {
    OMElement _import = (OMElement) obj;
    OMAttribute attribute = _import.getAttribute(new QName("location"));
    String newValue = isMasterArtifact ? "dependencies" + attribute.getAttributeValue().substring(attribute.getAttributeValue().lastIndexOf("/"))
        :attribute.getAttributeValue().substring(attribute.getAttributeValue().lastIndexOf("/")+1);
    attribute.setAttributeValue(newValue);
  }
 return omElement;
}

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

private static OMElement updateSchemaImports(OMElement omElement, boolean isMasterArtifact, String xpath)
      throws JaxenException {

    AXIOMXPath xPath = new AXIOMXPath(xpath);
//        "http://schemas.xmlsoap.org/wsdl/"
    xPath.addNamespace("xs", "http://www.w3.org/2001/XMLSchema");
    Object result = xPath.evaluate(omElement);
    if(!(result instanceof ArrayList)){
     return omElement;
    }
    List list = (ArrayList)result;
    for (Object obj : list) {
      OMElement _import = (OMElement) obj;
      OMAttribute attribute = _import.getAttribute(new QName("schemaLocation"));
      String newValue = isMasterArtifact ? "dependencies" + attribute.getAttributeValue().substring(attribute.getAttributeValue().lastIndexOf("/"))
          :attribute.getAttributeValue().substring(attribute.getAttributeValue().lastIndexOf("/")+1);
      attribute.setAttributeValue(newValue);
    }
   return omElement;
  }

代码示例来源:origin: org.apache.abdera/abdera-parser

public <T extends Element> T setAttributeValue(QName qname, String value) {
  OMAttribute attr = this.getAttribute(qname);
  if (attr != null && value != null) {
    attr.setAttributeValue(value);
  } else {
    if (value != null) {
      String uri = qname.getNamespaceURI();
      String prefix = qname.getPrefix();
      if (uri != null) {
        OMNamespace ns = findNamespace(uri, prefix);
        if (ns == null)
          ns = factory.createOMNamespace(uri, prefix);
        attr = factory.createOMAttribute(qname.getLocalPart(), ns, value);
      } else {
        attr = factory.createOMAttribute(qname.getLocalPart(), null, value);
      }
      if (attr != null)
        addAttribute(attr);
    } else if (attr != null) {
      removeAttribute(attr);
    }
  }
  return (T)this;
}

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

private void updateTableTextAlignment() throws JaxenException {
  AXIOMXPath xpathExpression = new AXIOMXPath("//a:title//a:band//a:componentElement//b:table//b:column" +
      "//a:textElement");
  xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
  xpathExpression.addNamespace("b", "http://jasperreports.sourceforge.net/jasperreports/components");
  OMElement documentElement = document.getOMDocumentElement();
  List nodeList = xpathExpression.selectNodes(documentElement);
  int colNo = 0;
  for (int i = 0; i < nodeList.size(); i++) {
    OMElement textElement = (OMElement) nodeList.get(i);
    textElement.getAttribute(new QName("textAlignment")).setAttributeValue(tableReport.getColumns()[colNo].
        getColumHeader().getAlignment());
    i++;
    textElement = (OMElement) nodeList.get(i);
    textElement.getAttribute(new QName("textAlignment")).setAttributeValue(tableReport.getColumns()[colNo].
        getColumnFooter().getAlignment());
    i++;
    textElement = (OMElement) nodeList.get(i);
    textElement.getAttribute(new QName("textAlignment")).setAttributeValue(tableReport.getColumns()[colNo].
        getTableCell().getAlignment());
    colNo++;
  }
}

代码示例来源:origin: org.bluestemsoftware.open.eoa.ext/open-eoa-aspect-axiom

/**
 * @param attributeName
 * @param attrValue
 * @param soapEnvelopeNamespaceURI
 */
protected void setAttribute(String attributeName,
              String attrValue,
              String soapEnvelopeNamespaceURI) {
  OMAttribute omAttribute = this.getAttribute(
      new QName(soapEnvelopeNamespaceURI, attributeName));
  if (omAttribute != null) {
    omAttribute.setAttributeValue(attrValue);
  } else {
    OMAttribute attribute = new AttrImpl(this.ownerNode, attributeName,
                       new NamespaceImpl(soapEnvelopeNamespaceURI,
                                SOAPConstants.SOAP_DEFAULT_NAMESPACE_PREFIX),
                       attrValue, this.factory);
    this.addAttribute(attribute);
  }
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

private void deployOutSequence(WebApp api, int tenantId, String tenantDomain, Environment environment)
    throws AppManagementException, AxisFault {
  String outSeqExt  = AppManagerUtil.getSequenceExtensionName(api) + "--Out";
  String outSequenceName = api.getOutSequence();
  OMElement outSequence = AppManagerUtil.getCustomSequence(outSequenceName, tenantId, "out");
  AppGatewayAdminClient appGatewayAdminClient = new AppGatewayAdminClient(api.getId(), environment);
  if (outSequence != null) {
    outSequence.getAttribute(new QName("name")).setAttributeValue(outSeqExt);
    appGatewayAdminClient.addSequence(outSequence, tenantDomain);
  }
}

代码示例来源:origin: org.wso2.carbon.appmgt/org.wso2.carbon.appmgt.impl

private void deployInSequence(WebApp api, int tenantId, String tenantDomain, Environment environment)
    throws AppManagementException, AxisFault {
  String inSeqExt = AppManagerUtil.getSequenceExtensionName(api) + "--In";
  String inSequenceName = api.getInSequence();
  OMElement inSequence = AppManagerUtil.getCustomSequence(inSequenceName, tenantId, "in");
  AppGatewayAdminClient appGatewayAdminClient = new AppGatewayAdminClient(api.getId(), environment);
  if (inSequence != null) {
    inSequence.getAttribute(new QName("name")).setAttributeValue(inSeqExt);
    appGatewayAdminClient.addSequence(inSequence, tenantDomain);
  }
}

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

private void handleFields() throws JaxenException {
  AXIOMXPath xpathExpression = new AXIOMXPath("//a:subDataset//a:field");
  xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
  OMElement documentElement = document.getOMDocumentElement();
  List nodeList = xpathExpression.selectNodes(documentElement);
  OMElement aField = (OMElement) nodeList.get(0);
  int reportFields = nodeList.size();
  int requiredFields = tableReport.getColumns().length;
  xpathExpression = new AXIOMXPath("//a:subDataset");
  xpathExpression.addNamespace("a", "http://jasperreports.sourceforge.net/jasperreports");
  xpathExpression.addNamespace("b", "http://jasperreports.sourceforge.net/jasperreports/components");
  nodeList = xpathExpression.selectNodes(documentElement);
  OMElement subDatasetNode = (OMElement) nodeList.get(0);
  int additionalFields = requiredFields - reportFields;
  for (int i = 0; i < additionalFields; i++) {
    OMElement anotherField = aField.cloneOMElement();
    anotherField.getAttribute(new QName("name")).setAttributeValue(String.valueOf(reportFields + i + 1));
    subDatasetNode.addChild(anotherField);
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

public void setLocationPrefix(String prefix) {
  OMElement ele = registryErrorList();
  for (OMElement e : XmlUtil.decendentsWithLocalName(ele, "RegistryError")) {
    OMAttribute at = e.getAttribute(MetadataSupport.location_qname);
    if (at == null) {
      at = MetadataSupport.om_factory.createOMAttribute("location", null, "");
      e.addAttribute(at);
    }
    at.setAttributeValue(prefix + at.getAttributeValue());
  }
}

代码示例来源:origin: usnistgov/iheos-toolkit2

void updateClassification(OMElement classification, Code code) {
  classification.getAttribute(nodeRepresentationQName).setAttributeValue(code.getCode());
  OMElement codeSystemElement = codeSystemElement(classification);
  if (codeSystemElement != null) codeSystemElement.setText(code.getScheme());
  updateDisplayName(classification, code.getDisplay());
}

相关文章