Package org.jdom

Examples of org.jdom.Namespace


    //      if (curNS.getPrefix().equals(prefix)) {
    //        ns = curNS;
    //        break;
    //      }
    //    }
    Namespace ns = (prefix == null) ? element.getNamespace("") : element
        .getNamespace(prefix);
    return ns;
  }
View Full Code Here


   * @param prefix the prefix.
   *
   * @return the Namespace.
   */
  private static Namespace getNamespace(final Element element, final String prefix) {
    Namespace namespace = (prefix == null) ? element.getNamespace("") : element.getNamespace(prefix);
    return (namespace == null) ? Namespace.NO_NAMESPACE : namespace;
  }
View Full Code Here

        List list = null;
        if (op != null)
            list = evaluateElementOperation(op, nodes);
        else {
            String localName = name;
            Namespace namespace = Namespace.NO_NAMESPACE;
            int colon = name.indexOf(':');
            if (colon != -1) {
                localName = name.substring(colon + 1);
                String nsPrefix = name.substring(0, colon);
                synchronized(namespaces)
View Full Code Here

    // create XML outputter with indent: 2 spaces, print new lines.
    Format format = Format.getPrettyFormat();
    format.setEncoding(encoding);
    XMLOutputter outputter = new XMLOutputter(format);

    Namespace defNs = Namespace.getNamespace(NS_DEFAULT);
    Namespace rdfNs = Namespace.getNamespace("rdf", NS_RDF);
    Namespace dcNs = Namespace.getNamespace("dc", NS_DC);
    Namespace syNs = Namespace.getNamespace("sy", NS_SY);
   
    // ----
    Element rootElem = new Element("RDF", rdfNs);
    rootElem.addNamespaceDeclaration(defNs);
    rootElem.addNamespaceDeclaration(dcNs);
View Full Code Here

        // create XML outputter with indent: 2 spaces, print new lines.
        Format format = Format.getPrettyFormat();
        format.setEncoding(encoding);
        XMLOutputter outputter = new XMLOutputter(format);
       
        Namespace dcNs = Namespace.getNamespace("dc", NS_DC);
        Namespace syNs = Namespace.getNamespace("sy", NS_SY);
        Namespace adminNs = Namespace.getNamespace("admin", NS_ADMIN);
        //Namespace rdfNs = Namespace.getNamespace("rdf", NS_RDF);

        Element rootElem = new Element("rss");
        rootElem.addNamespaceDeclaration(dcNs);
        rootElem.addNamespaceDeclaration(syNs);
View Full Code Here

    SUPPORTED_SCORM_NAMESPACES.put(ADLCP_NAMESPACE_12, ADL_SCORM_1_2);
    }

    protected static boolean canHandle(Document doc) throws DocumentHandlerException {
        // The first thing we do is to see if there is a root Namespace in the Document
    Namespace nameSpace = XMLUtils.getDocumentNamespace(doc);
   
    // No Namespace, sorry we don't know what it is!
    if(nameSpace == null || nameSpace.equals(Namespace.NO_NAMESPACE)) {
        throw new DocumentHandlerException("No Namespace in Document so cannot determine what it is!");
    }
   
    // Does it have the correct root Namespace?
    if(SUPPORTED_NAMESPACES.containsKey(nameSpace) == false) return false;
   
    // Now find out if it is a SCORM Document and if so whether we support it
    // We'll search all elements for the ADL Namespace
        Namespace nsSCORM = getSCORM_Namespace(doc);
        if(nsSCORM == null) return false;
       
        // Do we support this version of SCORM?
        return SUPPORTED_SCORM_NAMESPACES.containsKey(nsSCORM);
  }
View Full Code Here

                attributes.append("xmlns" + "=\"" + _ns + "\"");
            }

            // additinal namespaces
            for (Iterator it = _dom.getAdditinalNamespaces().iterator(); it.hasNext();) {
                Namespace ns = (Namespace) it.next();
                if (!ns.getPrefix().equals("xsi")) {
                    attributes.append(sep);
                    attributes.append("xmlns:" + ns.getPrefix() + "=\"" + ns.getURI() + "\"");
                }
            }
        }

        // _sb.append((doBreak ? _indent : "") + "<" + qName +
View Full Code Here

                attributes.append("xmlns" + "=\"" + _ns + "\"");
            }

            // additinal namespaces
            for (Iterator it = _dom.getAdditinalNamespaces().iterator(); it.hasNext();) {
                Namespace ns = (Namespace) it.next();
                if (!ns.getPrefix().equals("xsi")) {
                    attributes.append(sep);
                    attributes.append("xmlns:" + ns.getPrefix() + "=\"" + ns.getURI() + "\"");
                }
            }
        }

        // _sb.append((doBreak ? _indent : "") + "<" + qName +
View Full Code Here

                {
                    return prefix;
                }
                synchronized(namespaces)
                {
                    Namespace ns = (Namespace)namespaces.get(prefix);
                    return ns == null ? null : ns.getURI();
                }  
            }
View Full Code Here

            collectNamespaces((Element) parent.getNode());
        }
    }

    private void collectNamespaces(Element element) {
        Namespace ns = element.getNamespace();
        if (ns != null && !prefixes.contains(ns.getPrefix())) {
            namespaces.add(ns);
            prefixes.add(ns.getPrefix());
        }
        List others = element.getAdditionalNamespaces();
        for (int i = 0; i < others.size(); i++) {
            ns = (Namespace) others.get(i);
            if (ns != null && !prefixes.contains(ns.getPrefix())) {
                namespaces.add(ns);
                prefixes.add(ns.getPrefix());
            }
        }
        Element parent = element.getParent();
        if (parent != null) {
            collectNamespaces(parent);
View Full Code Here

TOP

Related Classes of org.jdom.Namespace

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.