*  @param ns a list of namespaces to filter by, empty = all namespaces.
     *  @return the list of templates used on that page in that namespace
     *  @throws IOException if a network error occurs
     *  @since 0.16
     */
    public String[] getTemplates(String title, int... ns) throws IOException
    {
        StringBuilder url = new StringBuilder(query);
        url.append("prop=templates&tllimit=max&titles=");
        url.append(URLEncoder.encode(normalize(title), "UTF-8"));
        constructNamespaceString(url, "tl", ns);
        String line = fetch(url.toString(), "getTemplates");

        // xml form: <tl ns="10" title="Template:POTD" />
        ArrayList<String> templates = new ArrayList<String>(750);
        for (int a = line.indexOf("<tl "); a > 0; a = line.indexOf("<tl ", ++a))
            templates.add(decode(parseAttribute(line, "title", a)));
        
        int size = templates.size();
        log(Level.INFO, "Successfully retrieved templates used on " + title + " (" + size + " templates)", "getTemplates");
        return templates.toArray(new String[size]);
    }