gpt4 book ai didi

org.eclipse.persistence.exceptions.XMLMarshalException.namespaceNotFound()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 10:48:40 26 4
gpt4 key购买 nike

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

XMLMarshalException.namespaceNotFound介绍

暂无

代码示例

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

/**
 * Return a QName representing the value of the xsi:type attribute or null if one is not present
 */
private QName getTypeAttributeQName(Attributes atts) {
  int attributeSize = atts.getLength();
  for (int i = 0; i < attributeSize; i++) {
    String stringValue = atts.getValue(i);
    String uri = atts.getURI(i);
    String attrName = atts.getLocalName(i);
    if (javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI.equals(uri) && XMLConstants.SCHEMA_TYPE_ATTRIBUTE.equals(attrName)) {
      int colonIndex = stringValue.indexOf(':');
      String localPrefix = stringValue.substring(0, colonIndex);
      String localURI = unmarshalNamespaceResolver.getNamespaceURI(localPrefix);
      if (localURI != null) {
        String localName = stringValue.substring(colonIndex + 1, stringValue.length());
        QName theQName = new QName(localURI, localName);
        currentSchemaType = theQName;
        return theQName;
      } else {
        throw XMLMarshalException.namespaceNotFound(localPrefix);
      }
    }
  }
  return null;
}

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

/**
 * Return a QName representing the value of the xsi:type attribute or null if one is not present
 */
private QName getTypeAttributeQName(Attributes atts) {
  int attributeSize = atts.getLength();
  for (int i = 0; i < attributeSize; i++) {
    String stringValue = atts.getValue(i);
    String uri = atts.getURI(i);
    String attrName = atts.getLocalName(i);
    if (javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI.equals(uri) && XMLConstants.SCHEMA_TYPE_ATTRIBUTE.equals(attrName)) {
      int colonIndex = stringValue.indexOf(':');
      String localPrefix = stringValue.substring(0, colonIndex);
      String localURI = unmarshalNamespaceResolver.getNamespaceURI(localPrefix);
      if (localURI != null) {
        String localName = stringValue.substring(colonIndex + 1, stringValue.length());
        QName theQName = new QName(localURI, localName);
        currentSchemaType = theQName;
        return theQName;
      } else {
        throw XMLMarshalException.namespaceNotFound(localPrefix);
      }
    }
  }
  return null;
}

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

/**
 * INTERNAL:
 * Return the namespace uri for the prefix of the given local name
 */
private String resolveNamespace(NamespaceResolver namespaceResolver, String localName) {
  int colonIndex = localName.indexOf(':');
  if (colonIndex < 0) {
    // handle target/default namespace
    if (namespaceResolver != null) {
      return namespaceResolver.resolveNamespacePrefix(Constants.EMPTY_STRING);
    }
    return null;
  } else {
    if (namespaceResolver == null) {
      //throw an exception if the name has a : in it but the namespaceresolver is null
      throw XMLMarshalException.namespaceResolverNotSpecified(localName);
    }
    String prefix = localName.substring(0, colonIndex);
    String uri = namespaceResolver.resolveNamespacePrefix(prefix);
    if (uri == null) {
      //throw an exception if the prefix is not found in the namespaceresolver
      throw XMLMarshalException.namespaceNotFound(prefix);
    }
    return uri;
  }
}

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

/**
 * INTERNAL:
 * Return the namespace uri for the prefix of the given local name
 */
private String resolveNamespace(NamespaceResolver namespaceResolver, String localName) {
  int colonIndex = localName.indexOf(':');
  if (colonIndex < 0) {
    // handle target/default namespace
    if (namespaceResolver != null) {
      return namespaceResolver.resolveNamespacePrefix(XMLConstants.EMPTY_STRING);
    }
    return null;
  } else {
    if (namespaceResolver == null) {
      //throw an exception if the name has a : in it but the namespaceresolver is null
      throw XMLMarshalException.namespaceResolverNotSpecified(localName);
    }
    String prefix = localName.substring(0, colonIndex);
    String uri = namespaceResolver.resolveNamespacePrefix(prefix);
    if (uri == null) {
      //throw an exception if the prefix is not found in the namespaceresolver
      throw XMLMarshalException.namespaceNotFound(prefix);
    }
    return uri;
  }
}

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

/**
 * INTERNAL:
 * Return the namespace uri for the prefix of the given local name
 */
private String resolveNamespace(NamespaceResolver namespaceResolver, String localName) {
  if(localName == null) {
    return null;
  }
  int colonIndex = localName.indexOf(XMLConstants.COLON);
  if (colonIndex < 0) {
    // handle target/default namespace
    if (namespaceResolver != null) {
      return namespaceResolver.getDefaultNamespaceURI();
    }
    return null;
  } else {
    if (namespaceResolver == null) {
      //throw an exception if the name has a : in it but the namespaceresolver is null
      throw XMLMarshalException.namespaceResolverNotSpecified(localName);
    }
    String prefix = localName.substring(0, colonIndex);
    String uri = namespaceResolver.resolveNamespacePrefix(prefix);
    if (uri == null) {
      //throw an exception if the prefix is not found in the namespaceresolver
      throw XMLMarshalException.namespaceNotFound(prefix);
    }
    return uri;
  }
}

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

/**
 * INTERNAL:
 * Return the namespace uri for the prefix of the given local name
 */
private String resolveNamespace(NamespaceResolver namespaceResolver, String localName) {
  int colonIndex = localName.indexOf(':');
  if (colonIndex < 0) {
    // handle target/default namespace
    if (namespaceResolver != null) {
      return namespaceResolver.resolveNamespacePrefix(Constants.EMPTY_STRING);
    }
    return null;
  } else {
    if (namespaceResolver == null) {
      //throw an exception if the name has a : in it but the namespaceresolver is null
      throw XMLMarshalException.namespaceResolverNotSpecified(localName);
    }
    String prefix = localName.substring(0, colonIndex);
    String uri = namespaceResolver.resolveNamespacePrefix(prefix);
    if (uri == null) {
      //throw an exception if the prefix is not found in the namespaceresolver
      throw XMLMarshalException.namespaceNotFound(prefix);
    }
    return uri;
  }
}

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

/**
 * INTERNAL:
 * Return the namespace uri for the prefix of the given local name
 */
private String resolveNamespace(NamespaceResolver namespaceResolver, String localName) {
  if(localName == null) {
    return null;
  }
  int colonIndex = localName.indexOf(XMLConstants.COLON);
  if (colonIndex < 0) {
    // handle target/default namespace
    if (namespaceResolver != null) {
      return namespaceResolver.getDefaultNamespaceURI();
    }
    return null;
  } else {
    if (namespaceResolver == null) {
      //throw an exception if the name has a : in it but the namespaceresolver is null
      throw XMLMarshalException.namespaceResolverNotSpecified(localName);
    }
    String prefix = localName.substring(0, colonIndex);
    String uri = namespaceResolver.resolveNamespacePrefix(prefix);
    if (uri == null) {
      //throw an exception if the prefix is not found in the namespaceresolver
      throw XMLMarshalException.namespaceNotFound(prefix);
    }
    return uri;
  }
}

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

/**
 * INTERNAL:
 * Return the namespace uri for the prefix of the given local name
 */
private String resolveNamespace(NamespaceResolver namespaceResolver, String localName) {
  if(localName == null) {
    return null;
  }
  int colonIndex = localName.indexOf(XMLConstants.COLON);
  if (colonIndex < 0) {
    // handle target/default namespace
    if (namespaceResolver != null) {
      return namespaceResolver.getDefaultNamespaceURI();
    }
    return null;
  } else {
    if (namespaceResolver == null) {
      //throw an exception if the name has a : in it but the namespaceresolver is null
      throw XMLMarshalException.namespaceResolverNotSpecified(localName);
    }
    String prefix = localName.substring(0, colonIndex);
    String uri = namespaceResolver.resolveNamespacePrefix(prefix);
    if (uri == null) {
      //throw an exception if the prefix is not found in the namespaceresolver
      throw XMLMarshalException.namespaceNotFound(prefix);
    }
    return uri;
  }
}

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

private void initializeXPathFragment(XPathFragment xPathFragment) {    
  String localName = xPathFragment.getLocalName();
  if(localName !=null && !localName.equals(XMLConstants.EMPTY_STRING)){
    if(null == xPathFragment.getNamespaceURI()) {
      if(xPathFragment.hasNamespace()) {
        if(null == namespaceResolver) {
          throw XMLMarshalException.namespaceNotFound(xPathFragment.getShortName());
        } else {
          String uri = namespaceResolver.resolveNamespacePrefix(xPathFragment.getPrefix());
          if(null == uri && null != xPathFragment.getPrefix()) {
            throw XMLMarshalException.namespaceNotFound(xPathFragment.getShortName());
          }
          xPathFragment.setNamespaceURI(uri);
        }
      }
      else if(!xPathFragment.isAttribute() && null != namespaceResolver) {
        xPathFragment.setNamespaceURI(namespaceResolver.getDefaultNamespaceURI());
      }
    }
  }
  XPathFragment nextXPathFragment = xPathFragment.getNextFragment();
  if(null != nextXPathFragment) {
    initializeXPathFragment(nextXPathFragment);
  }
}

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

private void initializeXPathFragment(XPathFragment xPathFragment) {
  XPathPredicate predicate = xPathFragment.getPredicate();
  if(null != predicate) {
    initializeXPathFragment(predicate.getXPathFragment());
  }
  String localName = xPathFragment.getLocalName();
  if(localName !=null && !localName.equals(XMLConstants.EMPTY_STRING)){
    if(null == xPathFragment.getNamespaceURI()) {
      if(xPathFragment.hasNamespace()) {
        if(null == namespaceResolver) {
          throw XMLMarshalException.namespaceNotFound(xPathFragment.getShortName());
        } else {
          String uri = namespaceResolver.resolveNamespacePrefix(xPathFragment.getPrefix());
          if(null == uri && null != xPathFragment.getPrefix()) {
            throw XMLMarshalException.namespaceNotFound(xPathFragment.getShortName());
          }
          xPathFragment.setNamespaceURI(uri);
        }
      }
      else if(!xPathFragment.isAttribute() && null != namespaceResolver) {
        xPathFragment.setNamespaceURI(namespaceResolver.getDefaultNamespaceURI());
      }
    }
  }
  XPathFragment nextXPathFragment = xPathFragment.getNextFragment();
  if(null != nextXPathFragment) {
    initializeXPathFragment(nextXPathFragment);
  }
}

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

private void initializeXPathFragment(XPathFragment xPathFragment) {
  XPathPredicate predicate = xPathFragment.getPredicate(); 
  if(null != predicate) {
    initializeXPathFragment(predicate.getXPathFragment());
  }
  String localName = xPathFragment.getLocalName();
  if(localName !=null && !localName.equals(XMLConstants.EMPTY_STRING)){
    if(null == xPathFragment.getNamespaceURI()) {
      if(xPathFragment.hasNamespace()) {
        if(null == namespaceResolver) {
          throw XMLMarshalException.namespaceNotFound(xPathFragment.getShortName());
        } else {
          String uri = namespaceResolver.resolveNamespacePrefix(xPathFragment.getPrefix());
          if(null == uri && null != xPathFragment.getPrefix()) {
            throw XMLMarshalException.namespaceNotFound(xPathFragment.getShortName());
          }
          xPathFragment.setNamespaceURI(uri);
        }
      }
      else if(!xPathFragment.isAttribute() && null != namespaceResolver) {
        xPathFragment.setNamespaceURI(namespaceResolver.getDefaultNamespaceURI());
      }
    }
  }
  XPathFragment nextXPathFragment = xPathFragment.getNextFragment();
  if(null != nextXPathFragment) {
    initializeXPathFragment(nextXPathFragment);
  }
}

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