Example usage for org.dom4j Element getNamespace

List of usage examples for org.dom4j Element getNamespace

Introduction

In this page you can find the example usage for org.dom4j Element getNamespace.

Prototype

Namespace getNamespace();

Source Link

Document

Returns the Namespace of this element if one exists otherwise Namespace.NO_NAMESPACE is returned.

Usage

From source file:org.zenonpagetemplates.onePhaseImpl.PageTemplateImpl.java

License:Open Source License

static private boolean getZPTOmitTag(EvaluationHelper evaluationHelper, Expressions expressions,
        Element element) throws PageTemplateException {

    boolean zptOmitTag = false;

    // Omit tag when it is from TAL name space
    if (TAL_NAMESPACE_URI.equals(element.getNamespace().getURI())) {
        return true;
    }//  w  ww .j  ava2 s .  com

    // Omit tag depending on the value of omitTag attribute
    if (expressions.omitTag != null) {
        if (expressions.omitTag.equals(VOID_STRING)) {
            zptOmitTag = true;
        } else {
            zptOmitTag = Expression.evaluateBoolean(expressions.omitTag, evaluationHelper);
        }
    }
    return zptOmitTag;
}

From source file:org.zenonpagetemplates.twoPhasesImpl.ZPTDocumentFactory.java

License:Open Source License

static protected ZPTElement getNewZPTElement(Element element, ZPTDocument zptDocument,
        Stack<Map<String, Slot>> slotStack) throws SAXException, PageTemplateException, IOException {

    // Create a new zptElement and set its name
    ZPTElement result = new ZPTElement(element.getName(), element.getNamespace().getPrefix());

    // Map first namespaces to make all namespaces prefixes available
    mapNamespaces(element, result, zptDocument);

    // Get attributes
    mapAttributes(element, result, zptDocument);

    // Continue processing if it is not define tal:content or i18n:content
    if (processContentIsOn(result, zptDocument)) {
        mapContent(element, result, zptDocument, slotStack);
    }/* w w  w .j ava 2 s.  c  o m*/

    return result;
}

From source file:se.kb.oai.ore.impl.AtomFactory.java

License:Apache License

private void addTypesAndMetadata(AggregateBase aggregate, List<Node> nodes) {
    for (Node node : nodes) {
        Element element = (Element) node;
        if (element.getNamespace().equals(DC_NS)) {
            aggregate.addMetadata((new Metadata(Namespace.DC, element.getName(), element.getText())));
        } else if (element.getNamespace().equals(DCTERMS_NS)) {
            aggregate.addMetadata((new Metadata(Namespace.DCTERMS, element.getName(), element.getText())));
        } else if (element.getNamespace().equals(RDF_NS) && element.getName().equals("type")) {
            aggregate.addType(new Type(element.getText()));
        }/*from w ww.ja  v a 2s . c o m*/
    }
}

From source file:servlets.LoaderSoa10g.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    System.out.println("Ciauz");
    String path = request.getParameter("indirizzo").trim();

    File dir = new File(path);
    File[] directoryListing = dir.listFiles();
    if (directoryListing != null) {
        for (File child : directoryListing) {
            try {
                SAXReader reader = new SAXReader();
                reader.setValidation(false);
                Document document = reader.read(path + "/" + child.getName());
                Element root = document.getRootElement();
                System.out.println(root.getNamespace());
            } catch (DocumentException e) {
                e.printStackTrace();//from w  w w.j av a 2s. c  om
            }
        }
    } else {
        // Handle the case where dir is not really a directory.
        // Checking dir.isDirectry() above would not be sufficient
        // to avoid race conditions with another process that deletes
        // directories.
    }
}