Package org.dom4j.dom

Examples of org.dom4j.dom.DOMElement


    {
        HierarchicalModel<Element> model = null;
        if (value instanceof Iterable)
        {
            String name = getClassName( ( ( Iterable<?> ) value ).iterator().next() );
            model = new XmlHierarchyModelImpl( new DOMElement( "result" ), name );
        }
        else
        {
            model = new XmlHierarchyModelImpl( new DOMElement( getClassName( value ) ) );
        }

        _resultTraverser.traverse( value, context.getSelector(), model, context );
        XmlYogaViewUtil.write( model.getUnderlyingModel(), os );
    }
View Full Code Here


{
    @Override
    public void render( Object value, YogaRequestContext context, OutputStream os )
            throws IOException
    {
        Element rootElement = new DOMElement( "html" );
        initHead( rootElement );
        HierarchicalModel<Element> model = getModel( value, rootElement );
        _resultTraverser.traverse( value, context.getSelector(), model, context );
        XmlYogaViewUtil.write( rootElement, os );
    }
View Full Code Here

        if (branch == null) {
            branch = (org.dom4j.Document)getDocument();
        }
   
    Element element = new DOMElement(qName);
        branch.add(element);

        // add all declared namespaces
        addDeclaredNamespaces(element);
View Full Code Here

        // However, Jetspeed is supporting Java 1.5 from v2.2, we need to provide this
        // to allow the methods invocations.
        // Also, because dom4j DOMElement does not support getOwnerDocument(),
        // we need to provide the method to allow portlet codes to create nodes with document.
       
        return new DOMElement(tagName)
        {
            private static final long serialVersionUID = 1L;
           
            private Document document;
           
View Full Code Here

        return (org.w3c.dom.Element) convertElement(element);
    }
   
    public static org.dom4j.Element convertElement(org.w3c.dom.Element element)
    {
        DOMElement domElement = (DOMElement) createSerializableElement(element.getNodeName());
       
        NamedNodeMap attrs = element.getAttributes();
       
        for (int i = 0; i < attrs.getLength(); i++)
        {
            Attr attr = (Attr) attrs.item(i);
            domElement.setAttribute(attr.getName(), attr.getValue());
        }
       
        NodeList children = element.getChildNodes();
        boolean hasChildren = (children.getLength() > 0);

        if (hasChildren)
        {
            for (int i = 0; i < children.getLength(); i++)
            {
                Node child = children.item(i);

                switch (child.getNodeType())
                {
                case Node.ELEMENT_NODE:
                    domElement.add(convertElement((org.w3c.dom.Element) child));
                    break;
                case Node.TEXT_NODE:
                    domElement.add(new DOMText(child.getNodeValue()));
                    break;
                case Node.COMMENT_NODE:
                    domElement.add(new DOMComment(child.getNodeValue()));
                    break;
                case Node.CDATA_SECTION_NODE:
                    domElement.add(new DOMCDATA(child.getNodeValue()));
                    break;
                default:
                    // Do not support entity reference node and processing instruction node.
                }
            }
View Full Code Here

TOP

Related Classes of org.dom4j.dom.DOMElement

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.