javax.xml.bind.annotation.XmlSchema Java Examples

The following examples show how to use javax.xml.bind.annotation.XmlSchema. 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: TypeInfoSetImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Map<String,String> getXmlNs(String namespaceUri) {
    if(xmlNsCache==null) {
        xmlNsCache = new HashMap<String,Map<String,String>>();

        for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
            XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
            if(xs==null)
                continue;

            String uri = xs.namespace();
            Map<String,String> m = xmlNsCache.get(uri);
            if(m==null)
                xmlNsCache.put(uri,m=new HashMap<String, String>());

            for( XmlNs xns : xs.xmlns() ) {
                m.put(xns.prefix(),xns.namespaceURI());
            }
        }
    }

    Map<String,String> r = xmlNsCache.get(namespaceUri);
    if(r!=null)     return r;
    else            return Collections.emptyMap();
}
 
Example #2
Source File: ElementInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
final QName parseElementName(XmlElementDecl e) {
    String local = e.name();
    String nsUri = e.namespace();
    if(nsUri.equals("##default")) {
        // if defaulted ...
        XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,
            nav().getDeclaringClassForMethod(method),this);
        if(xs!=null)
            nsUri = xs.namespace();
        else {
            nsUri = builder.defaultNsUri;
        }
    }

    return new QName(nsUri.intern(),local.intern());
}
 
Example #3
Source File: TypeInfoSetImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public Map<String,String> getXmlNs(String namespaceUri) {
    if(xmlNsCache==null) {
        xmlNsCache = new HashMap<String,Map<String,String>>();

        for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
            XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
            if(xs==null)
                continue;

            String uri = xs.namespace();
            Map<String,String> m = xmlNsCache.get(uri);
            if(m==null)
                xmlNsCache.put(uri,m=new HashMap<String, String>());

            for( XmlNs xns : xs.xmlns() ) {
                m.put(xns.prefix(),xns.namespaceURI());
            }
        }
    }

    Map<String,String> r = xmlNsCache.get(namespaceUri);
    if(r!=null)     return r;
    else            return Collections.emptyMap();
}
 
Example #4
Source File: JaxWsServiceFactoryBean.java    From cxf with Apache License 2.0 6 votes vote down vote up
protected final void initConfiguration(JaxWsImplementorInfo ii) {
    if (ii.isWebServiceProvider()) {
        jaxWsConfiguration = new WebServiceProviderConfiguration();
        jaxWsConfiguration.setServiceFactory(this);
        getServiceConfigurations().add(0, jaxWsConfiguration);
        setWrapped(false);
        setDataBinding(new SourceDataBinding());
        setMethodDispatcher(new JAXWSProviderMethodDispatcher(implInfo));
    } else {
        jaxWsConfiguration = new JaxWsServiceConfiguration();
        jaxWsConfiguration.setServiceFactory(this);
        getServiceConfigurations().add(0, jaxWsConfiguration);

        Class<?> seiClass = ii.getEndpointClass();
        if (seiClass != null && seiClass.getPackage() != null) {
            XmlSchema schema = seiClass.getPackage().getAnnotation(XmlSchema.class);
            if (schema != null && XmlNsForm.QUALIFIED.equals(schema.elementFormDefault())) {
                setQualifyWrapperSchema(true);
            }
        }
        setMethodDispatcher(new JAXWSMethodDispatcher(implInfo));
    }
    loadWSFeatureAnnotation(ii.getSEIClass(), ii.getImplementorClass());
}
 
Example #5
Source File: ElementInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
final QName parseElementName(XmlElementDecl e) {
    String local = e.name();
    String nsUri = e.namespace();
    if(nsUri.equals("##default")) {
        // if defaulted ...
        XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,
            nav().getDeclaringClassForMethod(method),this);
        if(xs!=null)
            nsUri = xs.namespace();
        else {
            nsUri = builder.defaultNsUri;
        }
    }

    return new QName(nsUri.intern(),local.intern());
}
 
Example #6
Source File: ElementInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
final QName parseElementName(XmlElementDecl e) {
    String local = e.name();
    String nsUri = e.namespace();
    if(nsUri.equals("##default")) {
        // if defaulted ...
        XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,
            nav().getDeclaringClassForMethod(method),this);
        if(xs!=null)
            nsUri = xs.namespace();
        else {
            nsUri = builder.defaultNsUri;
        }
    }

    return new QName(nsUri.intern(),local.intern());
}
 
Example #7
Source File: TypeInfoSetImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public Map<String,String> getXmlNs(String namespaceUri) {
    if(xmlNsCache==null) {
        xmlNsCache = new HashMap<String,Map<String,String>>();

        for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
            XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
            if(xs==null)
                continue;

            String uri = xs.namespace();
            Map<String,String> m = xmlNsCache.get(uri);
            if(m==null)
                xmlNsCache.put(uri,m=new HashMap<String, String>());

            for( XmlNs xns : xs.xmlns() ) {
                m.put(xns.prefix(),xns.namespaceURI());
            }
        }
    }

    Map<String,String> r = xmlNsCache.get(namespaceUri);
    if(r!=null)     return r;
    else            return Collections.emptyMap();
}
 
Example #8
Source File: TypeInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses an {@link XmlRootElement} annotation on a class
 * and determine the element name.
 *
 * @return null
 *      if none was found.
 */
protected final QName parseElementName(ClassDeclT clazz) {
    XmlRootElement e = reader().getClassAnnotation(XmlRootElement.class,clazz,this);
    if(e==null)
        return null;

    String local = e.name();
    if(local.equals("##default")) {
        // if defaulted...
        local = NameConverter.standard.toVariableName(nav().getClassShortName(clazz));
    }
    String nsUri = e.namespace();
    if(nsUri.equals("##default")) {
        // if defaulted ...
        XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,clazz,this);
        if(xs!=null)
            nsUri = xs.namespace();
        else {
            nsUri = builder.defaultNsUri;
        }
    }

    return new QName(nsUri.intern(),local.intern());
}
 
Example #9
Source File: XmlTypeUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private static String getPrefix(final Package targetPackage,
		String namespaceURI) {
	String prefix;
	final Map<String, String> namespacePrefixes = new HashMap<String, String>();
	if (targetPackage != null) {
		final XmlSchema xmlSchemaAnnotation = targetPackage
				.getAnnotation(XmlSchema.class);
		if (xmlSchemaAnnotation != null) {
			for (XmlNs xmlns : xmlSchemaAnnotation.xmlns()) {
				namespacePrefixes.put(xmlns.namespaceURI(), xmlns.prefix());
			}
		}
	}

	prefix = namespacePrefixes.get(namespaceURI);
	return prefix;
}
 
Example #10
Source File: TypeInfoSetImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public Map<String,String> getXmlNs(String namespaceUri) {
    if(xmlNsCache==null) {
        xmlNsCache = new HashMap<String,Map<String,String>>();

        for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
            XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
            if(xs==null)
                continue;

            String uri = xs.namespace();
            Map<String,String> m = xmlNsCache.get(uri);
            if(m==null)
                xmlNsCache.put(uri,m=new HashMap<String, String>());

            for( XmlNs xns : xs.xmlns() ) {
                m.put(xns.prefix(),xns.namespaceURI());
            }
        }
    }

    Map<String,String> r = xmlNsCache.get(namespaceUri);
    if(r!=null)     return r;
    else            return Collections.emptyMap();
}
 
Example #11
Source File: XmlTypeUtils.java    From jaxb2-basics with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private static String getNamespace(final Package targetPackage) {
	String namespaceURI;
	if (targetPackage == null) {
		namespaceURI = "";
	} else {
		final XmlSchema xmlSchemaAnnotation = targetPackage
				.getAnnotation(XmlSchema.class);
		if (xmlSchemaAnnotation == null) {
			namespaceURI = "";
		} else {
			final String packageNamespace = xmlSchemaAnnotation.namespace();
			if (packageNamespace == null || "".equals(packageNamespace)) {
				namespaceURI = "";
			} else {
				namespaceURI = packageNamespace;
			}
		}
	}
	return namespaceURI;
}
 
Example #12
Source File: TypeInfoSetImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Map<String,String> getXmlNs(String namespaceUri) {
    if(xmlNsCache==null) {
        xmlNsCache = new HashMap<String,Map<String,String>>();

        for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
            XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
            if(xs==null)
                continue;

            String uri = xs.namespace();
            Map<String,String> m = xmlNsCache.get(uri);
            if(m==null)
                xmlNsCache.put(uri,m=new HashMap<String, String>());

            for( XmlNs xns : xs.xmlns() ) {
                m.put(xns.prefix(),xns.namespaceURI());
            }
        }
    }

    Map<String,String> r = xmlNsCache.get(namespaceUri);
    if(r!=null)     return r;
    else            return Collections.emptyMap();
}
 
Example #13
Source File: TypeInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses an {@link XmlRootElement} annotation on a class
 * and determine the element name.
 *
 * @return null
 *      if none was found.
 */
protected final QName parseElementName(ClassDeclT clazz) {
    XmlRootElement e = reader().getClassAnnotation(XmlRootElement.class,clazz,this);
    if(e==null)
        return null;

    String local = e.name();
    if(local.equals("##default")) {
        // if defaulted...
        local = NameConverter.standard.toVariableName(nav().getClassShortName(clazz));
    }
    String nsUri = e.namespace();
    if(nsUri.equals("##default")) {
        // if defaulted ...
        XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,clazz,this);
        if(xs!=null)
            nsUri = xs.namespace();
        else {
            nsUri = builder.defaultNsUri;
        }
    }

    return new QName(nsUri.intern(),local.intern());
}
 
Example #14
Source File: TypeInfoImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses an {@link XmlRootElement} annotation on a class
 * and determine the element name.
 *
 * @return null
 *      if none was found.
 */
protected final QName parseElementName(ClassDeclT clazz) {
    XmlRootElement e = reader().getClassAnnotation(XmlRootElement.class,clazz,this);
    if(e==null)
        return null;

    String local = e.name();
    if(local.equals("##default")) {
        // if defaulted...
        local = NameConverter.standard.toVariableName(nav().getClassShortName(clazz));
    }
    String nsUri = e.namespace();
    if(nsUri.equals("##default")) {
        // if defaulted ...
        XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,clazz,this);
        if(xs!=null)
            nsUri = xs.namespace();
        else {
            nsUri = builder.defaultNsUri;
        }
    }

    return new QName(nsUri.intern(),local.intern());
}
 
Example #15
Source File: TypeInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Parses an {@link XmlRootElement} annotation on a class
 * and determine the element name.
 *
 * @return null
 *      if none was found.
 */
protected final QName parseElementName(ClassDeclT clazz) {
    XmlRootElement e = reader().getClassAnnotation(XmlRootElement.class,clazz,this);
    if(e==null)
        return null;

    String local = e.name();
    if(local.equals("##default")) {
        // if defaulted...
        local = NameConverter.standard.toVariableName(nav().getClassShortName(clazz));
    }
    String nsUri = e.namespace();
    if(nsUri.equals("##default")) {
        // if defaulted ...
        XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,clazz,this);
        if(xs!=null)
            nsUri = xs.namespace();
        else {
            nsUri = builder.defaultNsUri;
        }
    }

    return new QName(nsUri.intern(),local.intern());
}
 
Example #16
Source File: JaxbConverter.java    From conf4j with MIT License 5 votes vote down vote up
/**
 * Returns XSD schema by annotation of given class or null when schemat doesn not exist within the class
 *
 * @param clazz class to read schema
 * @return XSD schema or null
 */
Schema readXsdSchema(Class<?> clazz) throws SAXException {
    XmlSchema xmlSchema = clazz.getPackage().getAnnotation(XmlSchema.class);
    String schemaLocation = xmlSchema != null ? xmlSchema.location() : null;
    if (schemaLocation == null) {
        return null;
    }
    SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

    return schemaFactory.newSchema(getResource(schemaLocation));
}
 
Example #17
Source File: XmlUtils.java    From tutorial-soap-spring-boot-cxf with MIT License 5 votes vote down vote up
public static <T> String getNamespaceUriFromJaxbClass(Class<T> jaxbClass) throws XmlUtilsException {
    for(Annotation annotation: jaxbClass.getPackage().getAnnotations()){
        if(annotation.annotationType() == XmlSchema.class){
            return ((XmlSchema)annotation).namespace();
        }
    }
    throw new XmlUtilsException("namespaceUri not found -> Is it really a JAXB-Class, thats used to call the method?");
}
 
Example #18
Source File: TypeInfoSetImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Map<String,String> getSchemaLocations() {
    Map<String, String> r = new HashMap<String,String>();
    for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
        XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
        if(xs==null)
            continue;

        String loc = xs.location();
        if(loc.equals(XmlSchema.NO_LOCATION))
            continue;   // unspecified

        r.put(xs.namespace(),loc);
    }
    return r;
}
 
Example #19
Source File: TypeInfoSetImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public final XmlNsForm getAttributeFormDefault(String nsUri) {
    for (ClassInfoImpl<T,C,F,M> ci : beans().values()) {
        XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
        if(xs==null)
            continue;

        if(!xs.namespace().equals(nsUri))
            continue;

        XmlNsForm xnf = xs.attributeFormDefault();
        if(xnf!=XmlNsForm.UNSET)
            return xnf;
    }
    return XmlNsForm.UNSET;
}
 
Example #20
Source File: ReferencePropertyInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private String getEffectiveNamespaceFor(XmlElementRef r) {
    String nsUri = r.namespace();

    XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this );
    if(xs!=null && xs.attributeFormDefault()== XmlNsForm.QUALIFIED) {
        // JAX-RPC doesn't want the default namespace URI swapping to take effect to
        // local "unqualified" elements. UGLY.
        if(nsUri.length()==0)
            nsUri = parent.builder.defaultNsUri;
    }

    return nsUri;
}
 
Example #21
Source File: AttributePropertyInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private QName calcXmlName(XmlAttribute att) {
    String uri;
    String local;

    uri = att.namespace();
    local = att.name();

    // compute the default
    if(local.equals("##default"))
        local = NameConverter.standard.toVariableName(getName());
    if(uri.equals("##default")) {
        XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this );
        // JAX-RPC doesn't want the default namespace URI swapping to take effect to
        // local "unqualified" elements. UGLY.
        if(xs!=null) {
            switch(xs.attributeFormDefault()) {
            case QUALIFIED:
                uri = parent.getTypeName().getNamespaceURI();
                if(uri.length()==0)
                    uri = parent.builder.defaultNsUri;
                break;
            case UNQUALIFIED:
            case UNSET:
                uri = "";
            }
        } else
            uri = "";
    }

    return new QName(uri.intern(),local.intern());
}
 
Example #22
Source File: AttributePropertyInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private QName calcXmlName(XmlAttribute att) {
    String uri;
    String local;

    uri = att.namespace();
    local = att.name();

    // compute the default
    if(local.equals("##default"))
        local = NameConverter.standard.toVariableName(getName());
    if(uri.equals("##default")) {
        XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this );
        // JAX-RPC doesn't want the default namespace URI swapping to take effect to
        // local "unqualified" elements. UGLY.
        if(xs!=null) {
            switch(xs.attributeFormDefault()) {
            case QUALIFIED:
                uri = parent.getTypeName().getNamespaceURI();
                if(uri.length()==0)
                    uri = parent.builder.defaultNsUri;
                break;
            case UNQUALIFIED:
            case UNSET:
                uri = "";
            }
        } else
            uri = "";
    }

    return new QName(uri.intern(),local.intern());
}
 
Example #23
Source File: AttributePropertyInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private QName calcXmlName(XmlAttribute att) {
    String uri;
    String local;

    uri = att.namespace();
    local = att.name();

    // compute the default
    if(local.equals("##default"))
        local = NameConverter.standard.toVariableName(getName());
    if(uri.equals("##default")) {
        XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this );
        // JAX-RPC doesn't want the default namespace URI swapping to take effect to
        // local "unqualified" elements. UGLY.
        if(xs!=null) {
            switch(xs.attributeFormDefault()) {
            case QUALIFIED:
                uri = parent.getTypeName().getNamespaceURI();
                if(uri.length()==0)
                    uri = parent.builder.defaultNsUri;
                break;
            case UNQUALIFIED:
            case UNSET:
                uri = "";
            }
        } else
            uri = "";
    }

    return new QName(uri.intern(),local.intern());
}
 
Example #24
Source File: TypeInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Parses a (potentially-null) {@link XmlType} annotation on a class
 * and determine the actual value.
 *
 * @param clazz
 *      The class on which the XmlType annotation is checked.
 * @param t
 *      The {@link XmlType} annotation on the clazz. This value
 *      is taken as a parameter to improve the performance for the case where
 *      't' is pre-computed.
 */
protected final QName parseTypeName(ClassDeclT clazz, XmlType t) {
    String nsUri="##default";
    String local="##default";
    if(t!=null) {
        nsUri = t.namespace();
        local = t.name();
    }

    if(local.length()==0)
        return null; // anonymous


    if(local.equals("##default"))
        // if defaulted ...
        local = NameConverter.standard.toVariableName(nav().getClassShortName(clazz));

    if(nsUri.equals("##default")) {
        // if defaulted ...
        XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,clazz,this);
        if(xs!=null)
            nsUri = xs.namespace();
        else {
            nsUri = builder.defaultNsUri;
        }
    }

    return new QName(nsUri.intern(),local.intern());
}
 
Example #25
Source File: JAXBContextCacheKey.java    From ph-commons with Apache License 2.0 5 votes vote down vote up
@Nonnull
private JAXBContext _createFromPackageAndClassLoader (final boolean bSilentMode)
{
  final ClassLoader aClassLoader = _getClassLoader ();

  if (!bSilentMode)
    if (LOGGER.isInfoEnabled ())
      LOGGER.info ("Creating JAXB context for package " +
                   m_aPackage.getName () +
                   " using ClassLoader " +
                   aClassLoader.toString ());

  try
  {
    // When using "-npa" on JAXB no package-info class is created!
    if (m_aPackage.getAnnotation (XmlSchema.class) == null &&
        GenericReflection.getClassFromNameSafe (m_aPackage.getName () + ".ObjectFactory") == null)
    {
      LOGGER.warn ("The package " +
                   m_aPackage.getName () +
                   " does not seem to be JAXB generated! Trying to create a JAXBContext anyway.");
    }

    return JAXBContext.newInstance (m_aPackage.getName (), aClassLoader);
  }
  catch (final JAXBException ex)
  {
    final String sMsg = "Failed to create JAXB context for package '" +
                        m_aPackage.getName () +
                        "'" +
                        " using ClassLoader " +
                        aClassLoader;
    LOGGER.error (sMsg + ": " + ex.getMessage ());
    throw new IllegalArgumentException (sMsg, ex);
  }
}
 
Example #26
Source File: TypeInfoSetImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Map<String,String> getSchemaLocations() {
    Map<String, String> r = new HashMap<String,String>();
    for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
        XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
        if(xs==null)
            continue;

        String loc = xs.location();
        if(loc.equals(XmlSchema.NO_LOCATION))
            continue;   // unspecified

        r.put(xs.namespace(),loc);
    }
    return r;
}
 
Example #27
Source File: XmlUtils.java    From tutorial-soap-spring-boot-cxf with MIT License 5 votes vote down vote up
public static <T> String getNamespaceUriFromJaxbClass(Class<T> jaxbClass) throws XmlUtilsException {
    for(Annotation annotation: jaxbClass.getPackage().getAnnotations()){
        if(annotation.annotationType() == XmlSchema.class){
            return ((XmlSchema)annotation).namespace();
        }
    }
    throw new XmlUtilsException("namespaceUri not found -> Is it really a JAXB-Class, thats used to call the method?");
}
 
Example #28
Source File: TypeInfoSetImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public final XmlNsForm getElementFormDefault(String nsUri) {
    for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
        XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
        if(xs==null)
            continue;

        if(!xs.namespace().equals(nsUri))
            continue;

        XmlNsForm xnf = xs.elementFormDefault();
        if(xnf!=XmlNsForm.UNSET)
            return xnf;
    }
    return XmlNsForm.UNSET;
}
 
Example #29
Source File: TypeInfoSetImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public Map<String,String> getSchemaLocations() {
    Map<String, String> r = new HashMap<String,String>();
    for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
        XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
        if(xs==null)
            continue;

        String loc = xs.location();
        if(loc.equals(XmlSchema.NO_LOCATION))
            continue;   // unspecified

        r.put(xs.namespace(),loc);
    }
    return r;
}
 
Example #30
Source File: TypeInfoSetImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public final XmlNsForm getElementFormDefault(String nsUri) {
    for (ClassInfoImpl<T, C, F, M> ci : beans().values()) {
        XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null );
        if(xs==null)
            continue;

        if(!xs.namespace().equals(nsUri))
            continue;

        XmlNsForm xnf = xs.elementFormDefault();
        if(xnf!=XmlNsForm.UNSET)
            return xnf;
    }
    return XmlNsForm.UNSET;
}