- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.eclipse.persistence.exceptions.XMLMarshalException.namespaceNotFound()
方法的一些代码示例,展示了XMLMarshalException.namespaceNotFound()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLMarshalException.namespaceNotFound()
方法的具体详情如下:
包路径:org.eclipse.persistence.exceptions.XMLMarshalException
类名称: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);
}
}
本文整理了Java中org.eclipse.persistence.exceptions.XMLMarshalException.namespaceNotFound()方法的一些代码示例,展示了XML
我是一名优秀的程序员,十分优秀!