本文整理汇总了Java中org.apache.ws.commons.schema.utils.NamespacePrefixList类的典型用法代码示例。如果您正苦于以下问题:Java NamespacePrefixList类的具体用法?Java NamespacePrefixList怎么用?Java NamespacePrefixList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NamespacePrefixList类属于org.apache.ws.commons.schema.utils包,在下文中一共展示了NamespacePrefixList类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addNamespaceContext
import org.apache.ws.commons.schema.utils.NamespacePrefixList; //导入依赖的package包/类
/**
* Adds the COXB namespace and associated prefixes to the XML schema.
*/
protected void addNamespaceContext() {
NamespaceMap prefixmap = new NamespaceMap();
NamespacePrefixList npl = getXsd().getNamespaceContext();
if (npl == null) {
/* We get an NPE if we don't add this. */
prefixmap.add("", XMLConstants.W3C_XML_SCHEMA_NS_URI);
} else {
for (int i = 0; i < npl.getDeclaredPrefixes().length; i++) {
prefixmap.add(npl.getDeclaredPrefixes()[i], npl
.getNamespaceURI(
npl.getDeclaredPrefixes()[i]));
}
}
prefixmap.add(getCOXBNamespacePrefix(), getCOXBNamespace());
getXsd().setNamespaceContext(prefixmap);
}
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:21,代码来源:XsdAnnotationEmitter.java
示例2: addNamespaceContext
import org.apache.ws.commons.schema.utils.NamespacePrefixList; //导入依赖的package包/类
/**
* Adds the COXB namespace and associated prefixes to the XML schema.
*/
protected void addNamespaceContext() {
NamespaceMap prefixmap = new NamespaceMap();
NamespacePrefixList npl = getXsd().getNamespaceContext();
if (npl == null) {
/* We get an NPE if we don't add this. */
prefixmap.add("", XMLConstants.W3C_XML_SCHEMA_NS_URI);
} else {
for (int i = 0; i < npl.getDeclaredPrefixes().length; i++) {
prefixmap.add(npl.getDeclaredPrefixes()[i],
npl.getNamespaceURI(npl.getDeclaredPrefixes()[i]));
}
}
prefixmap.add(getCOXBNamespacePrefix(), getCOXBNamespace());
getXsd().setNamespaceContext(prefixmap);
}
开发者ID:legsem,项目名称:legstar-core2,代码行数:20,代码来源:XsdAnnotationEmitter.java
示例3: addImport
import org.apache.ws.commons.schema.utils.NamespacePrefixList; //导入依赖的package包/类
protected void addImport(XmlSchema xmlSchema, QName schemaTypeName) {
NamespacePrefixList map = xmlSchema.getNamespaceContext();
if (map == null ||
((map instanceof NamespaceMap) && ((NamespaceMap) map).values() == null) ||
schemaTypeName == null) {
return;
}
if (map instanceof NamespaceMap && !((NamespaceMap) map).values().
contains(schemaTypeName.getNamespaceURI())) {
XmlSchemaImport importElement = new XmlSchemaImport();
importElement.setNamespace(schemaTypeName.getNamespaceURI());
xmlSchema.getItems().add(importElement);
((NamespaceMap) xmlSchema.getNamespaceContext()).
put(generatePrefix(), schemaTypeName.getNamespaceURI());
}
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:17,代码来源:DefaultSchemaGenerator.java
示例4: getNamespaceMap
import org.apache.ws.commons.schema.utils.NamespacePrefixList; //导入依赖的package包/类
public static NamespaceMap getNamespaceMap(XmlSchema xmlSchema) {
NamespaceMap namespacesMap = new NamespaceMap();
NamespacePrefixList namespacePrefixList = xmlSchema.getNamespaceContext();
if (namespacePrefixList != null) {
String[] prefixes = namespacePrefixList.getDeclaredPrefixes();
for (int i=0; i<prefixes.length; i++) {
String prefix = prefixes[i];
String ns = namespacePrefixList.getNamespaceURI(prefix);
namespacesMap.add(prefix, ns);
}
}
return namespacesMap;
}
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:14,代码来源:SchemaUtils.java
示例5: createXmlSchema
import org.apache.ws.commons.schema.utils.NamespacePrefixList; //导入依赖的package包/类
/**
* Create an empty XML Schema.
* <p>
* If no targetNamespace, make sure there is no default namespace otherwise
* our complex types would be considered part of that default namespace
* (usually XML Schema namespace).
*
* @param encoding the character set used to encode this XML Schema
* @return a new empty XML schema using the model
*/
protected XmlSchema createXmlSchema(final String encoding) {
XmlSchema xsd = new XmlSchema(getModel().getTargetNamespace(),
new XmlSchemaCollection());
if (getModel().getTargetNamespace() != null) {
xsd.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
}
xsd.setAttributeFormDefault(null);
xsd.setInputEncoding(encoding);
if (getModel().getTargetNamespace() == null) {
NamespaceMap prefixmap = new NamespaceMap();
NamespacePrefixList npl = xsd.getNamespaceContext();
if (npl == null) {
prefixmap.add("xsd", XMLConstants.W3C_XML_SCHEMA_NS_URI);
} else {
for (int i = 0; i < npl.getDeclaredPrefixes().length; i++) {
String prefix = npl.getDeclaredPrefixes()[i];
String namespace = npl.getNamespaceURI(prefix);
if (namespace.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
if (prefix.equals("")) {
prefix = "xsd";
}
}
prefixmap.add(prefix, namespace);
}
}
xsd.setNamespaceContext(prefixmap);
}
return xsd;
}
开发者ID:legsem,项目名称:legstar-cob2xsd,代码行数:40,代码来源:Cob2Xsd.java
示例6: createXmlSchema
import org.apache.ws.commons.schema.utils.NamespacePrefixList; //导入依赖的package包/类
/**
* Create an empty XML Schema.
* <p/>
* If no targetNamespace, make sure there is no default namespace otherwise
* our complex types would be considered part of that default namespace
* (usually XML Schema namespace).
*
* @param encoding the character set used to encode this XML Schema
* @param targetNamespace the target namespace to use (null for no namespace)
* @return a new empty XML schema using the model
*/
protected XmlSchema createXmlSchema(final String encoding, final String targetNamespace) {
XmlSchema xsd = new XmlSchema(targetNamespace,
new XmlSchemaCollection());
if (targetNamespace != null) {
xsd.setElementFormDefault(XmlSchemaForm.QUALIFIED);
}
xsd.setAttributeFormDefault(null);
xsd.setInputEncoding(encoding);
if (targetNamespace == null) {
NamespaceMap prefixmap = new NamespaceMap();
NamespacePrefixList npl = xsd.getNamespaceContext();
if (npl == null) {
prefixmap.add("xsd", XMLConstants.W3C_XML_SCHEMA_NS_URI);
} else {
for (int i = 0; i < npl.getDeclaredPrefixes().length; i++) {
String prefix = npl.getDeclaredPrefixes()[i];
String namespace = npl.getNamespaceURI(prefix);
if (namespace.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
if (prefix.equals("")) {
prefix = "xsd";
}
}
prefixmap.add(prefix, namespace);
}
}
xsd.setNamespaceContext(prefixmap);
}
return xsd;
}
开发者ID:legsem,项目名称:legstar-core2,代码行数:41,代码来源:Cob2Xsd.java
示例7: addNameSpaces
import org.apache.ws.commons.schema.utils.NamespacePrefixList; //导入依赖的package包/类
private XmlSchema addNameSpaces(int i) {
XmlSchema schema = (XmlSchema) schemaList.get(i);
NamespaceMap map = (NamespaceMap) namespaceMap.clone();
NamespacePrefixList namespaceContext = schema.getNamespaceContext();
String prefixes[] = namespaceContext.getDeclaredPrefixes();
for (int j = 0; j < prefixes.length; j++) {
String prefix = prefixes[j];
map.add(prefix, namespaceContext.getNamespaceURI(prefix));
}
schema.setNamespaceContext(map);
return schema;
}
开发者ID:wso2,项目名称:wso2-axis2,代码行数:13,代码来源:AxisService.java
示例8: initNSMap
import org.apache.ws.commons.schema.utils.NamespacePrefixList; //导入依赖的package包/类
private void initNSMap() {
nsMap = new NamespaceMap();
NamespacePrefixList nsCtx = schemaColl.getNamespaceContext();
populateNSMap(nsCtx);
XmlSchema[] xmlSchemas = schemaColl.getXmlSchemas();
if (xmlSchemas != null && xmlSchemas.length > 0) {
for (XmlSchema schema : xmlSchemas) {
nsCtx = schema.getNamespaceContext();
populateNSMap(nsCtx);
}
}
logger.debug(MessageFormat.format("namespace map contains {0} entries", nsMap.size()));
}
开发者ID:mkris,项目名称:xsd2xml,代码行数:15,代码来源:SchemaTypeXmlGenerator.java
示例9: populateNSMap
import org.apache.ws.commons.schema.utils.NamespacePrefixList; //导入依赖的package包/类
private void populateNSMap(NamespacePrefixList nsCtx) {
if (nsCtx != null) {
String[] prefixes = nsCtx.getDeclaredPrefixes();
if (prefixes != null) {
for (String prefix : prefixes) {
if (StringUtils.isNotEmpty(prefix))
nsMap.add(prefix, nsCtx.getNamespaceURI(prefix));
}
}
}
}
开发者ID:mkris,项目名称:xsd2xml,代码行数:12,代码来源:SchemaTypeXmlGenerator.java
注:本文中的org.apache.ws.commons.schema.utils.NamespacePrefixList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论