org.apache.tuscany.sca.interfacedef.util.XMLType.isElement()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(120)

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

XMLType.isElement介绍

暂无

代码示例

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding

if (xmlType.isElement() && !xmlType.getElementName().equals(name)) {
  QName newName = xmlType.getElementName();
  String prefix = newName.getPrefix();

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

if (xmlType.isElement() && !xmlType.getElementName().equals(name)) {
  QName newName = xmlType.getElementName();
  String prefix = newName.getPrefix();

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-axiom

/**
 * @param context
 * @param element
 */
public static void adjustElementName(TransformationContext context, OMElement element) {
  if (context != null) {
    DataType dataType = context.getTargetDataType();
    Object logical = dataType == null ? null : dataType.getLogical();
    if (!(logical instanceof XMLType)) {
      return;
    }
    XMLType xmlType = (XMLType)logical;
    if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
      // FIXME:: Throw exception or switch to the new Element?
      OMFactory factory = OMAbstractFactory.getOMFactory();
      QName name = xmlType.getElementName();
      OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
      element.setNamespace(namespace);
      element.setLocalName(name.getLocalPart());
    }
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-sdo-axiom

/**
 * @param context
 * @param element
 */
public static void adjustElementName(TransformationContext context, OMElement element) {
  if (context != null) {
    DataType dataType = context.getTargetDataType();
    Object logical = dataType == null ? null : dataType.getLogical();
    if (!(logical instanceof XMLType)) {
      return;
    }
    XMLType xmlType = (XMLType)logical;
    if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
      // FIXME:: Throw exception or switch to the new Element?
      OMFactory factory = OMAbstractFactory.getOMFactory();
      QName name = xmlType.getElementName();
      OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
      element.setNamespace(namespace);
      element.setLocalName(name.getLocalPart());
    }
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

if( returnXMLType.isElement() ) {
  namespace = returnXMLType.getElementName().getNamespaceURI();
} else {

代码示例来源:origin: org.apache.tuscany.sca/tuscany-interface-java

if( returnXMLType.isElement() ) {
  namespace = returnXMLType.getElementName().getNamespaceURI();
} else {

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-json

public OMElement transform(Object source, TransformationContext context) {
  try {
    JSONObject json = JSONHelper.toJettison(source);
    if (json == null) {
      return null;
    }
    String ns = JSONDataBinding.ROOT_ELEMENT.getNamespaceURI();
    String name = JSONDataBinding.ROOT_ELEMENT.getLocalPart();
    if (context != null) {
      DataType<?> dataType = context.getTargetDataType();
      Object logical = dataType.getLogical();
      if (logical instanceof XMLType) {
        XMLType xmlType = (XMLType)logical;
        if (xmlType.isElement()) {
          ns = xmlType.getElementName().getNamespaceURI();
          name = xmlType.getElementName().getLocalPart();
        }
      }
    }
    JSONBadgerfishDataSource ds = new JSONBadgerfishDataSource(json);
    OMNamespace namespace = factory.createOMNamespace(ns, "");
    return factory.createOMElement(ds, name, namespace);
  } catch (Exception e) {
    throw new TransformationException(e);
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-sdo-axiom

public OMElement transform(DataObject source, TransformationContext context) {
  HelperContext helperContext = SDOContextHelper.getHelperContext(context, true);
  OMFactory factory = OMAbstractFactory.getOMFactory();
  QName name  = ROOT_ELEMENT;
  if (context != null) {
    DataType dataType = context.getTargetDataType();
    Object logical = dataType == null ? null : dataType.getLogical();
    if (logical instanceof XMLType) {
      XMLType xmlType = (XMLType)logical;
      if (xmlType.isElement()) {
        name = xmlType.getElementName();
      }
    }
  }
  XMLDocument document = helperContext.getXMLHelper().createDocument(source,
                                    name.getNamespaceURI(),
                                    name.getLocalPart());
  SDODataSource dataSource = new SDODataSource(document, helperContext);
  OMElement element = AxiomHelper.createOMElement(factory, name, dataSource);
  return element;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

if (logical instanceof XMLType) {
  XMLType xmlType = (XMLType)logical;
  if (xmlType.isElement()) {
    name = xmlType.getElementName();
  } else {

代码示例来源:origin: org.apache.tuscany.sca/tuscany-databinding-jaxb

if (logical instanceof XMLType) {
  XMLType xmlType = (XMLType)logical;
  if (xmlType.isElement()) {
    name = xmlType.getElementName();
  } else {

相关文章