Package org.apache.xindice.xml

Examples of org.apache.xindice.xml.NamespaceMap


            throws XMLDBException {
               
        checkOpen();
        try {
            // Copy the namespaces into a NamespaceMap.
            NamespaceMap namespaces = new NamespaceMap();
            Enumeration keys = nsMap.keys();
            while (keys.hasMoreElements()) {
               String key = (String) keys.nextElement();
               namespaces.put(key, nsMap.get(key));
            }

            NodeSet result;
            if (name != null) {               
               result = col.queryDocument(queryLang, query, namespaces, name);
View Full Code Here


    *
    * @param namespaces
    * @return A NamespaceMap
    */
   protected NamespaceMap mapNamespaces( Hashtable namespaces ) {
      NamespaceMap nsMap = null;
      if ( namespaces.size() > 0 ) {
         nsMap = new NamespaceMap();

         Enumeration keys = namespaces.keys();
         while ( keys.hasMoreElements() ) {
            String key = ( String ) keys.nextElement();
            nsMap.setNamespace( key, ( String ) namespaces.get( key ) );
         }
      }

      return nsMap;
   }
View Full Code Here

     * Sets the query string to be used when executing update
     */
    public void setQString(String query) throws SAXException {
       super.setQString(query);
       if (nsMap == null) {
          nsMap = new NamespaceMap();
       }
       nsMap.includeNamespaces(_namespaces, !API_NS_PRECEDENCE);
    }
View Full Code Here

     *
     * @param namespaces
     * @return A NamespaceMap
     */
    protected NamespaceMap mapNamespaces(Hashtable namespaces) {
        NamespaceMap nsMap = null;
        if (namespaces.size() > 0) {
            nsMap = new NamespaceMap();

            Enumeration keys = namespaces.keys();
            while (keys.hasMoreElements()) {
                String key = (String) keys.nextElement();
                nsMap.setNamespace(key, (String) namespaces.get(key));
            }
        }

        return nsMap;
    }
View Full Code Here

     * Sets the query string to be used when executing update
     */
    public void setQString(String query) throws SAXException {
        super.setQString(query);
        if (nsMap == null) {
            nsMap = new NamespaceMap();
        }
        nsMap.includeNamespaces(_namespaces, !API_NS_PRECEDENCE);
    }
View Full Code Here

        root.setAttribute("count", Integer.toString(count));
        return doc;
    }

    private NamespaceMap createNamespaceMap(Hashtable namespaces) {
        NamespaceMap nsMap = null;

        if (namespaces.size() > 0) {
            nsMap = new NamespaceMap();

            Enumeration keys = namespaces.keys();
            while (keys.hasMoreElements()) {
                String key = (String) keys.nextElement();
                nsMap.setNamespace(key, (String) namespaces.get(key));
            }
        }

        return nsMap;
    }
View Full Code Here

     * Maps a Hashtable containing namespace definitions into a Xindice
     * NamespaceMap.
     */
    public static NamespaceMap mapNamespaces(Hashtable namespaces) {
        if (namespaces != null && namespaces.size() > 0) {
            return new NamespaceMap(namespaces);
        }

        return null;
    }
View Full Code Here

        if (query == null) {
            throw new Exception(MISSING_QUERY_PARAM);
        }

        Collection col = getCollection((String) message.get(COLLECTION));
        NamespaceMap nsMap = QueryUtil.mapNamespaces((Hashtable) message.get(NAMESPACES));

        NodeSet ns;
        if (message.containsKey(NAME)) {
            ns = col.queryDocument(type, query, nsMap, message.get(NAME));
        } else {
View Full Code Here

     * Sets the query string to be used when executing update
     */
    public void setQString(String query) throws SAXException {
        super.setQString(query);
        if (nsMap == null) {
            nsMap = new NamespaceMap();
        }
        nsMap.includeNamespaces(super.namespaces, !API_NS_PRECEDENCE);
    }
View Full Code Here

        }
        return editSelect;
    }

    protected NamespaceMap getNamespaceMap(String namespaces) {
        NamespaceMap nsMap = new NamespaceMap();
        String[] namespace = namespaces.split("[\\s]+");
        for (int i = 0; i < namespace.length; i++) {
            String[] prefixAndUri = namespace[i].split("=");
            String prefix = prefixAndUri[0];
            String uri = prefixAndUri[1].replaceAll("\"", "");
           
            int colonIndex = prefix.indexOf(":");
            if (colonIndex == -1) {
                nsMap.setDefaultNamespace(uri);
            } else {
                prefix = prefix.substring(colonIndex + 1);
                if (!nsMap.containsKey(prefix)) {
                    nsMap.setNamespace(prefix, uri);
                }
            }
        }
        return nsMap;
    }
View Full Code Here

TOP

Related Classes of org.apache.xindice.xml.NamespaceMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.