org.apache.ws.commons.schema.utils.NamespacePrefixList Java Examples
The following examples show how to use
org.apache.ws.commons.schema.utils.NamespacePrefixList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XsdAnnotationEmitter.java From legstar-core2 with GNU Affero General Public License v3.0 | 6 votes |
/** * 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); }
Example #2
Source File: Cob2Xsd.java From legstar-core2 with GNU Affero General Public License v3.0 | 5 votes |
/** * 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; }
Example #3
Source File: SchemaCollection.java From cxf with Apache License 2.0 | 4 votes |
public NamespacePrefixList getNamespaceContext() { return schemaCollection.getNamespaceContext(); }
Example #4
Source File: SchemaCollection.java From cxf with Apache License 2.0 | 4 votes |
public void setNamespaceContext(NamespacePrefixList namespaceContext) { schemaCollection.setNamespaceContext(namespaceContext); }