gpt4 book ai didi

org.eclipse.persistence.platform.xml.XMLPlatform.resolveNamespacePrefix()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 03:07:05 24 4
gpt4 key购买 nike

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

XMLPlatform.resolveNamespacePrefix介绍

[英]Return the namespace URI for the specified namespace prefix relative to the context node.
[中]返回相对于上下文节点的指定命名空间前缀的命名空间URI。

代码示例

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

public String getDefaultNamespaceURI() {
  if(null != defaultNamespaceURI) {
    return defaultNamespaceURI;
  } else if(dom != null) {
    return XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(dom, null);
  }
  return null;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

public String resolveNamespacePrefix(String prefix) {
  XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
  return xmlPlatform.resolveNamespacePrefix(currentNode, prefix);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
* Returns the namespace URI associated with a specified namespace prefix
 *
 * @param  prefix The prefix to lookup a namespace URI for
 * @return The namespace URI associated with the specified prefix
 */
@Override
public String resolveNamespacePrefix(String prefix) {
  if (null == prefix || prefix.length() == 0) {
    return defaultNamespaceURI;
  }
  String uri = null;
  if(null != prefixesToNamespaces) {
    uri = prefixesToNamespaces.get(prefix);
  }
  if(null != uri) {
    return uri;
  } else if (javax.xml.XMLConstants.XML_NS_PREFIX.equals(prefix)) {
    return javax.xml.XMLConstants.XML_NS_URI;
  } else if (javax.xml.XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
    return javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
  }
  if(dom != null) {
    return XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(dom, prefix);
  }
  return null;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
* Returns the namespace URI associated with a specified namespace prefix
 *
 * @param  prefix The prefix to lookup a namespace URI for
 * @return The namespace URI associated with the specified prefix
 */
public String resolveNamespacePrefix(String prefix) {
  if (null == prefix || prefix.length() == 0) {
    return defaultNamespaceURI;
  }
  String uri = null;
  if(null != prefixesToNamespaces) {
    uri = prefixesToNamespaces.get(prefix);
  }
  if(null != uri) {
    return uri;
  } else if (javax.xml.XMLConstants.XML_NS_PREFIX.equals(prefix)) {
    return javax.xml.XMLConstants.XML_NS_URI;
  } else if (javax.xml.XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
    return javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
  }
  if(dom != null) {
    return XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(dom, prefix);
  }
  return null;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

public String getDefaultNamespaceURI() {
  if(null != defaultNamespaceURI) {
    return defaultNamespaceURI;
  } else if(dom != null) {
    return XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(dom, null);
  }
  return null;
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

public String resolveNamespacePrefix(String prefix) {
    XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
    return xmlPlatform.resolveNamespacePrefix(currentNode, prefix);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

protected void handleXsiTypeAttribute(Attr attr) throws SAXException {
  String value = attr.getValue();
  int colon = value.indexOf(':');
  if(colon != -1) {
    String prefix = value.substring(0, colon);
    String uri = this.resolveNamespacePrefix(prefix);
    if(uri == null) {
      uri = XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(attr.getOwnerElement(), prefix);
      if(uri != null) {
        this.contentHandler.startPrefixMapping(prefix, uri);
      }
      
    }
  }
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

public String resolveNamespacePrefix(String prefix) {
  XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
  return xmlPlatform.resolveNamespacePrefix(currentNode, prefix);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

protected void handleXsiTypeAttribute(Attr attr) throws SAXException {
  String value = attr.getValue();
  int colon = value.indexOf(':');
  if(colon != -1) {
    String prefix = value.substring(0, colon);
    String uri = this.resolveNamespacePrefix(prefix);
    if(uri == null) {
      uri = XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(attr.getOwnerElement(), prefix);
      if(uri != null) {
        this.contentHandler.startPrefixMapping(prefix, uri);
      }
    }
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.oracle

namespaceDeclaration = next.getAttributeNode(XMLConstants.XMLNS +":" + prefix);
if ((null == namespaceDeclaration) && !declaredPrefixes.contains(prefix)) {
  String uri = XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(next, prefix);
  (next).setAttributeNS(XMLConstants.XMLNS_URL, XMLConstants.XMLNS + ":" + prefix, uri);
  declaredPrefixes.add(prefix);

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

namespaceDeclaration = next.getAttributeNode(javax.xml.XMLConstants.XMLNS_ATTRIBUTE +":" + prefix);
if ((null == namespaceDeclaration) && !declaredPrefixes.contains(prefix)) {                                
  String uri = XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(next, prefix);
  (next).setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI, javax.xml.XMLConstants.XMLNS_ATTRIBUTE + ":" + prefix, uri);
  declaredPrefixes.add(prefix);

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

namespaceDeclaration = next.getAttributeNode(XMLConstants.XMLNS +":" + prefix);
if ((null == namespaceDeclaration) && !declaredPrefixes.contains(prefix)) {                                
  String uri = XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(next, prefix);
  (next).setAttributeNS(XMLConstants.XMLNS_URL, XMLConstants.XMLNS + ":" + prefix, uri);
  declaredPrefixes.add(prefix);

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * Adds a namespace declaration to the parent element if the textValue represents a
 * prefixed qualified name. The determination of a qname is based on the existance of a
 * colon character and the ability to resolve the characters before the colon to a 
 * namespace uri. 
 * @param textValue
 * @param parentNode
 */
private void processNamespacesForText(String textValue, Element parentNode) {
  //If the text value is a qname, we may need to do namespace processing
  int colon = textValue.indexOf(':');
  if(colon != -1) {
    String prefix = textValue.substring(0, colon);
    XMLPlatform platform = XMLPlatformFactory.getInstance().getXMLPlatform();
    String uri = platform.resolveNamespacePrefix(parentNode, prefix);
    if(uri == null) {
      uri = this.owningRecord.resolveNamespacePrefix(prefix);
      if(uri != null) {
        //add namespace declaration
        addNamespaceDeclaration(parentNode, prefix, uri);
      }
    }
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * Adds a namespace declaration to the parent element if the textValue represents a
 * prefixed qualified name. The determination of a qname is based on the existance of a
 * colon character and the ability to resolve the characters before the colon to a
 * namespace uri.
 * @param textValue
 * @param parentNode
 */
private void processNamespacesForText(String textValue, Element parentNode) {
  //If the text value is a qname, we may need to do namespace processing
  int colon = textValue.indexOf(':');
  if(colon != -1) {
    String prefix = textValue.substring(0, colon);
    XMLPlatform platform = XMLPlatformFactory.getInstance().getXMLPlatform();
    String uri = platform.resolveNamespacePrefix(parentNode, prefix);
    if(uri == null) {
      uri = this.owningRecord.resolveNamespacePrefix(prefix);
      if(uri != null) {
        //add namespace declaration
        addNamespaceDeclaration(parentNode, prefix, uri);
      }
    }
  }
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

private Object convertValue(Element node, Field key, Object value) {
  XMLConversionManager xmlCnvMgr = (XMLConversionManager) session.getDatasourcePlatform().getConversionManager();
  if (key.isTypedTextField() && (node != null)) {
    String schemaType = node.getAttributeNS(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
    if ((null != schemaType) && (schemaType.length() > 0)) {
      QName qname = null;
      int index = schemaType.indexOf(XMLConstants.COLON);
      if (index == -1) {
        qname = new QName(schemaType);
        Class convertClass = key.getJavaClass(qname, xmlCnvMgr);
        return xmlCnvMgr.convertObject(value, convertClass);
      } else {
        String prefix = schemaType.substring(0, index);
        String localPart = schemaType.substring(index + 1);
        XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
        String url = xmlPlatform.resolveNamespacePrefix(node, prefix);
        qname = new QName(url, localPart);
        Class convertClass = key.getJavaClass(qname, xmlCnvMgr);
        return xmlCnvMgr.convertObject(value, convertClass, qname);
      }
    }
  }
  currentNode = node;
  Object convertedValue = key.convertValueBasedOnSchemaType(value, xmlCnvMgr, this);
  currentNode = getDOM();
  return convertedValue;
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

private Object convertValue(Element node, Field key, Object value) {
  XMLConversionManager xmlCnvMgr = (XMLConversionManager) session.getDatasourcePlatform().getConversionManager();
  if (key.isTypedTextField() && (node != null)) {
    String schemaType = node.getAttributeNS(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
    if ((null != schemaType) && (schemaType.length() > 0)) {
      QName qname = null;
      int index = schemaType.indexOf(XMLConstants.COLON);
      if (index == -1) {
        qname = new QName(schemaType);
        Class convertClass = key.getJavaClass(qname, xmlCnvMgr);
        return xmlCnvMgr.convertObject(value, convertClass);
      } else {
        String prefix = schemaType.substring(0, index);
        String localPart = schemaType.substring(index + 1);
        XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
        String url = xmlPlatform.resolveNamespacePrefix(node, prefix);
        qname = new QName(url, localPart);
        Class convertClass = key.getJavaClass(qname, xmlCnvMgr);
        return xmlCnvMgr.convertObject(value, convertClass, qname);
      }
    }
  }
  currentNode = node;
  Object convertedValue = key.convertValueBasedOnSchemaType(value, xmlCnvMgr, this);
  currentNode = getDOM();
  return convertedValue;
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

private Object convertValue(Element node, XMLField key, Object value) {
  XMLConversionManager xmlCnvMgr = (XMLConversionManager) session.getDatasourcePlatform().getConversionManager();
  if (key.isTypedTextField() && (node != null)) {
    String schemaType = node.getAttributeNS(XMLConstants.SCHEMA_INSTANCE_URL, XMLConstants.SCHEMA_TYPE_ATTRIBUTE);
    if ((null != schemaType) && (schemaType.length() > 0)) {
      QName qname = null;
      int index = schemaType.indexOf(XMLConstants.COLON);
      if (index == -1) {
        qname = new QName(schemaType);
        Class convertClass = key.getJavaClass(qname);
        return xmlCnvMgr.convertObject(value, convertClass);
      } else {
        String prefix = schemaType.substring(0, index);
        String localPart = schemaType.substring(index + 1);
        XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
        String url = xmlPlatform.resolveNamespacePrefix(node, prefix);
        qname = new QName(url, localPart);
        Class convertClass = key.getJavaClass(qname);
        return xmlCnvMgr.convertObject(value, convertClass, qname);
      }
    }
  }
  currentNode = node;
  Object convertedValue = key.convertValueBasedOnSchemaType(value, xmlCnvMgr, this);
  currentNode = getDOM();
  return convertedValue;
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

String prefix = frag.getPrefix();
XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform();
String url = xmlPlatform.resolveNamespacePrefix(next, prefix);
frag.setNamespaceURI(url);
schemaTypeQName = new QName(url, frag.getLocalName());

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

namespace = unmarshalRecord.resolveNamespacePrefix(prefix);
if(null == namespace) {
  namespace = XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(element, prefix);

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

namespace = unmarshalRecord.resolveNamespacePrefix(prefix);
if(null == namespace) {
  namespace = XMLPlatformFactory.getInstance().getXMLPlatform().resolveNamespacePrefix(element, prefix);

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com