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

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

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

OMAttribute.getOMFactory介绍

暂无

代码示例

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

public Factory getFactory() {
  return (Factory)attr.getOMFactory();
}

代码示例来源:origin: wso2/wso2-synapse

private static void removeNamespaces(OMElement element, boolean processAttrbs) {
  OMNamespace ns = element.getNamespace();
  Iterator i = element.getAllDeclaredNamespaces();
  while (i.hasNext()) {
    i.next();
    i.remove();
  }
  String prefix;
  if (ns != null) {
    prefix = "";//element.getNamespace().getPrefix();
    element.setNamespace(element.getOMFactory().createOMNamespace("", prefix));
  }
  Iterator children = element.getChildElements();
  while (children.hasNext()) {
    removeNamespaces((OMElement) children.next(), processAttrbs);
  }
  if (!processAttrbs) {
    return;
  }
  Iterator attrbs = element.getAllAttributes();
  while (attrbs.hasNext()) {
    OMAttribute attrb = (OMAttribute) attrbs.next();
    prefix = "";//attrb.getQName().getPrefix();
    attrb.setOMNamespace(attrb.getOMFactory().createOMNamespace("", prefix));
    //element.removeAttribute(attrb);
  }
}

代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api

/**
   * In Axiom, a single tree should always contain objects created from the same type of factory
   * (eg: LinkedListImplFactory, DOMFactory, etc.,). This method will convert omAttribute to the
   * given omFactory.
   *
   * @see ElementHelper#importOMElement(OMElement, OMFactory) to convert instances of OMElement
   */
  public static void importOMAttribute(OMAttribute omAttribute, OMElement omElement) {
    // first check whether the given OMAttribute has the same OMFactory
    if (omAttribute.getOMFactory().getMetaFactory() == omElement.getOMFactory().getMetaFactory()) {
      omElement.addAttribute(omAttribute);
    } else {
      OMNamespace ns = omAttribute.getNamespace();
      omElement.addAttribute(omAttribute.getLocalName(), omAttribute.getAttributeValue(),
                  omElement.getOMFactory().createOMNamespace(ns.getNamespaceURI(), ns.getPrefix()));
    }
  }
}

相关文章