FileDocCategorySizeDatePackage
NamespaceContextImpl.javaAPI DocGlassfish v2 API5239Fri May 04 22:36:16 BST 2007com.sun.enterprise.webservice.monitoring

NamespaceContextImpl

public class NamespaceContextImpl extends Object implements NamespaceContext
This class is a name space resolver for the XPath expressions.
author
Jerome Dochez

Fields Summary
Constructors Summary
public NamespaceContextImpl(Document wsdlDoc)
Creates a new instance of NamespaceContextImpl

        // get all the namespaces declarations 
       NamedNodeMap attributes = wsdlDoc.getAttributes();
       if (attributes==null) 
           return;
       for (int i=0;i<attributes.getLength();i++) {
           Node attribute = attributes.item(i);
           System.out.println("attribute " + attribute.getNodeName() + " value " + attribute.getNodeValue());
       }
    
Methods Summary
public java.lang.StringgetNamespaceURI(java.lang.String prefix)

Get Namespace URI bound to a prefix in the current scope

param
prefix to look up
return
Namespace URI

        if (prefix==null) {
            throw new IllegalArgumentException("prefix is null");
        }
        if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
            return "http://schemas.xmlsoap.org/wsdl/";
        } 
        if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
            return XMLConstants.XML_NS_URI;
        } 
        if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
            return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
        }
        if ("soap".equals(prefix)) {
            return "http://schemas.xmlsoap.org/wsdl/soap/";
        }
        if ("soap12".equals(prefix)) {
            return "http://schemas.xmlsoap.org/wsdl/soap12/";
        }
        return XMLConstants.NULL_NS_URI;
    
public java.lang.StringgetPrefix(java.lang.String namespace)

Get Prefix bound to Namespace URI in the current scope

param
URI of Namespace to look up
return
bound prefix

        if (namespace==null) {
            throw new IllegalArgumentException("namespace is null");
        }
        if ("http://schemas.xmlsoap.org/wsdl/".equals(namespace)) {
            return XMLConstants.DEFAULT_NS_PREFIX;            
        } 
        if (XMLConstants.XML_NS_URI.equals(namespace)) {
            return XMLConstants.XML_NS_PREFIX;
        } 
        if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespace)) {
            return XMLConstants.XMLNS_ATTRIBUTE;
        }
        if ("http://schemas.xmlsoap.org/wsdl/soap/".equals(namespace)) {
            return "soap";
        }
        if(("http://schemas.xmlsoap.org/wsdl/soap12/").equals(namespace)) {
            return "soap12";
        }
        return null;        
    
public java.util.IteratorgetPrefixes(java.lang.String namespaceURI)

Get all prefixes bound to a Namespace URI in the current scope

param
Namespace URI to look up
return
Iterator on all the prefixes

        Vector v = new Vector();
        String prefix = getPrefix(namespaceURI);
        if (prefix!=null) {
            v.add(prefix);
        }
        return v.iterator();