public void add(String prefix, String namespaceURI) { put(prefix, namespaceURI); }
public void add(String prefix, String namespaceURI) { put(prefix, namespaceURI); }
public void add(String prefix, String namespaceURI) { put(prefix, namespaceURI); }
/** * Creates a schema from a DataService object, to be used later in WSDL generation. */ @SuppressWarnings ("unchecked") private void createDSSchema(AxisService axisService, DataService dataService) throws DataServiceFault { NamespaceMap map = new NamespaceMap(); map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX, Java2WSDLConstants.URI_2001_SCHEMA_XSD); axisService.setNamespaceMap(map); DataServiceDocLitWrappedSchemaGenerator.populateServiceSchema(axisService); }
protected XmlSchema getXmlSchema(String targetNamespace) { XmlSchema xmlSchema; if ((xmlSchema = schemaMap.get(targetNamespace)) == null) { String targetNamespacePrefix; if (targetNamespace.equals(schemaTargetNameSpace) && schema_namespace_prefix != null) { targetNamespacePrefix = schema_namespace_prefix; } else { targetNamespacePrefix = generatePrefix(); } xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix); schemaMap.put(targetNamespace, xmlSchema); NamespaceMap prefixmap = new NamespaceMap(); prefixmap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX, URI_2001_SCHEMA_XSD); prefixmap.put(targetNamespacePrefix, targetNamespace); xmlSchema.setNamespaceContext(prefixmap); } return xmlSchema; }
protected XmlSchema getXmlSchema(String targetNamespace) { XmlSchema xmlSchema; if ((xmlSchema = schemaMap.get(targetNamespace)) == null) { String targetNamespacePrefix; if (targetNamespace.equals(schemaTargetNameSpace) && schema_namespace_prefix != null) { targetNamespacePrefix = schema_namespace_prefix; } else { targetNamespacePrefix = generatePrefix(); } xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix); schemaMap.put(targetNamespace, xmlSchema); NamespaceMap prefixmap = new NamespaceMap(); prefixmap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX, URI_2001_SCHEMA_XSD); prefixmap.put(targetNamespacePrefix, targetNamespace); xmlSchema.setNamespaceContext(prefixmap); } return xmlSchema; }
@Override protected XmlSchema getXmlSchema(String targetNamespace) { XmlSchema xmlSchema; if ((xmlSchema = schemaMap.get(targetNamespace)) == null) { String targetNamespacePrefix; if (targetNamespace.equals(schemaTargetNameSpace) && schema_namespace_prefix != null) { targetNamespacePrefix = schema_namespace_prefix; } else { targetNamespacePrefix = generatePrefix(); } xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix); schemaMap.put(targetNamespace, xmlSchema); NamespaceMap prefixmap = new NamespaceMap(); prefixmap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX, URI_2001_SCHEMA_XSD); prefixmap.put(targetNamespacePrefix, targetNamespace); xmlSchema.setNamespaceContext(prefixmap); } return xmlSchema; }
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(xmlSchema); importElement.setNamespace(schemaTypeName.getNamespaceURI()); if (!xmlSchema.getItems().contains(importElement)) { xmlSchema.getItems().add(importElement); } ((NamespaceMap) xmlSchema.getNamespaceContext()). put(generatePrefix(), schemaTypeName.getNamespaceURI()); } }
@Override protected XmlSchema getXmlSchema(String targetNamespace) { XmlSchema xmlSchema; if ((xmlSchema = schemaMap.get(targetNamespace)) == null) { String targetNamespacePrefix; if (targetNamespace.equals(schemaTargetNameSpace) && schema_namespace_prefix != null) { targetNamespacePrefix = schema_namespace_prefix; } else { targetNamespacePrefix = generatePrefix(); } xmlSchema = new XmlSchema(targetNamespace, xmlSchemaCollection); xmlSchema.setAttributeFormDefault(getAttrFormDefaultSetting()); xmlSchema.setElementFormDefault(getElementFormDefaultSetting()); targetNamespacePrefixMap.put(targetNamespace, targetNamespacePrefix); schemaMap.put(targetNamespace, xmlSchema); NamespaceMap prefixmap = new NamespaceMap(); prefixmap.put(DEFAULT_SCHEMA_NAMESPACE_PREFIX, URI_2001_SCHEMA_XSD); prefixmap.put(targetNamespacePrefix, targetNamespace); xmlSchema.setNamespaceContext(prefixmap); } return xmlSchema; }
private void addSchemaNameSpace(XmlSchema schema) { String targetNameSpace = schema.getTargetNamespace(); String prefix = schema.getNamespaceContext().getPrefix(targetNameSpace); if (namespaceMap == null) { namespaceMap = new NamespaceMap(); } if (!namespaceMap.values().contains(targetNameSpace)) { // i.e this target namespace not exists in the namesapce map // find a non exists prefix to add this target namesapce while ((prefix == null) || namespaceMap.keySet().contains(prefix)) { prefix = "ns" + nsCount++; } namespaceMap.put(prefix, targetNameSpace); } }
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(xmlSchema); importElement.setNamespace(schemaTypeName.getNamespaceURI()); if (!xmlSchema.getItems().contains(importElement)) { xmlSchema.getItems().add(importElement); } ((NamespaceMap) xmlSchema.getNamespaceContext()). put(generatePrefix(), schemaTypeName.getNamespaceURI()); } }
private void addSchemaNameSpace(XmlSchema schema) { String targetNameSpace = schema.getTargetNamespace(); String prefix = schema.getNamespaceContext().getPrefix(targetNameSpace); if (namespaceMap == null) { namespaceMap = new NamespaceMap(); } if (!namespaceMap.values().contains(targetNameSpace)) { // i.e this target namespace not exists in the namesapce map // find a non exists prefix to add this target namesapce while ((prefix == null) || namespaceMap.keySet().contains(prefix)) { prefix = "ns" + nsCount++; } namespaceMap.put(prefix, targetNameSpace); } }
xmlSchema.getItems().add(importElement); ((NamespaceMap) xmlSchema.getNamespaceContext()). put(generatePrefix(), tgtNamespace);
/** * recursively drills down to get namespace pairs in nested imported elements * * @param descriptionElement - a description element from where import elements * and types can be found */ private void createNamespaceMap(DescriptionElement descriptionElement) { ImportElement[] importElements = descriptionElement.getImportElements(); for (int i = 0; i < importElements.length; i++) { DescriptionElement descElem = importElements[i].getDescriptionElement(); NamespaceDeclaration[] namespaceDeclarations = descElem.getDeclaredNamespaces(); for (int j = 0; j < namespaceDeclarations.length; j++) { NamespaceDeclaration importedNamespaceDeclaration = namespaceDeclarations[j]; if (!stringBasedNamespaceMap.containsKey(importedNamespaceDeclaration.getPrefix())) { stringBasedNamespaceMap.put(importedNamespaceDeclaration.getPrefix(), importedNamespaceDeclaration.getNamespaceURI().toString()); } } createNamespaceMap(descElem); // recursively drill down } }
/** * recursively drills down to get namespace pairs in nested imported elements * * @param descriptionElement - a description element from where import elements * and types can be found */ private void createNamespaceMap(DescriptionElement descriptionElement) { ImportElement[] importElements = descriptionElement.getImportElements(); for (int i = 0; i < importElements.length; i++) { DescriptionElement descElem = importElements[i].getDescriptionElement(); NamespaceDeclaration[] namespaceDeclarations = descElem.getDeclaredNamespaces(); for (int j = 0; j < namespaceDeclarations.length; j++) { NamespaceDeclaration importedNamespaceDeclaration = namespaceDeclarations[j]; if (!stringBasedNamespaceMap.containsKey(importedNamespaceDeclaration.getPrefix())) { stringBasedNamespaceMap.put(importedNamespaceDeclaration.getPrefix(), importedNamespaceDeclaration.getNamespaceURI().toString()); } } createNamespaceMap(descElem); // recursively drill down } }
for (int i = 0; i < namespacemap.length; i++) { NamespaceDeclaration namespaceDeclaration = namespacemap[i]; stringBasedNamespaceMap.put(namespaceDeclaration.getPrefix(), namespaceDeclaration.getNamespaceURI().toString());
for (int i = 0; i < namespacemap.length; i++) { NamespaceDeclaration namespaceDeclaration = namespacemap[i]; stringBasedNamespaceMap.put(namespaceDeclaration.getPrefix(), namespaceDeclaration.getNamespaceURI().toString());
xmlSchema.getItems().add(importElement); ((NamespaceMap) xmlSchema.getNamespaceContext()). put(generatePrefix(), typeTable.getComplexSchemaType(propertyName).getNamespaceURI());