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

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

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

OMAttribute.setOMNamespace介绍

暂无

代码示例

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

void fix_v2_ns_recursive(OMElement ele, OMNamespace ns) {
  ele.setNamespace(ns);
  for (@SuppressWarnings("unchecked")
     Iterator<OMAttribute> it = ele.getAllAttributes(); it.hasNext();) {
    OMAttribute a = it.next();
    if (a.getLocalName().equals("lang"))
      a.setOMNamespace(MetadataSupport.xml_namespace);
  }
  for (@SuppressWarnings("unchecked")
     Iterator<OMElement> it = ele.getChildElements(); it.hasNext();) {
    OMElement child = (OMElement) it.next();
    fix_v2_ns_recursive(child, MetadataSupport.ebRIMns2);
  }
}

代码示例来源: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);
  }
}

相关文章