Package org.apache.shale.clay.parser

Examples of org.apache.shale.clay.parser.Node


     * @param messages error messages
     */
    private void checkForInvalidNestedTags(String prefix, Node clayNode, List messages) {
        List children = clayNode.getChildren();
        next: for (int i = 0; i < children.size(); i++) {
            Node child = (Node) children.get(i);
            if ((!child.isComment() && !child.isCdata()) && child.isWellFormed()) {
                if (child.getQname() != null && child.getName() != null) {

                    if (child.getQname().equals("jsp") && child.getName().equals("text")) {
                        continue next;
                    else if (!child.getName().equals("symbol") || !prefix.equals(child.getQname())) {
                        messages.add(getMessage(prefix, clayNode, child));
                    }
                }

            }
View Full Code Here


           return;
       }

       List children = node.getChildren();
       for (int i = 0; i < children.size(); i++) {
          Node child = (Node) children.get(i);
          validateClayTags(prefix, child, messages);
       }

    }
View Full Code Here

                StringBuffer buff = loadTemplate(page);
                Parser p = new Parser();
                List roots = p.parse(buff);

                for (int i = 0;  i < roots.size(); i++) {
                    Node node = (Node) roots.get(i);
                    validateClayTags(prefix, node, messages);
                }

            } catch (IOException e) {
                messages.add(new ValidationMessage(null, e.getMessage()));
View Full Code Here

        StringBuffer buffer = loadTemplate(templateURL);

        List roots = new Parser().parse(buffer);
        Iterator ri = roots.iterator();
        while (ri.hasNext()) {
            Node node = (Node) ri.next();
            Builder renderer = getBuilder(node);
            ElementBean child = renderer.createElement(node);

            root.addChild(child);
            if (renderer.isChildrenAllowed()) {
View Full Code Here

     * @param commentBody concatenated raw text of all the children
     */
    protected void captureComment(Node node, StringBuffer commentBody) {
        Iterator ni = node.getChildren().iterator();
        while (ni.hasNext()) {
           Node child = (Node) ni.next();
           commentBody.append(child.getToken().getRawText());
           captureComment(child, commentBody);
           if (child.isStart() && !child.isEnd() && child.isWellFormed()) {
              commentBody.append("</").append(child.getName()).append(">");
           }
        }
    }
View Full Code Here

            ComponentBean root) {

        if (!getBuildNodeBody(node, target)) {
            Iterator ci = node.getChildren().iterator();
            while (ci.hasNext()) {
                Node child = (Node) ci.next();
                Builder childRenderer = getBuilder(child);

                ElementBean targetChild = childRenderer.createElement(child);
                root.addChild(targetChild);
                //if the child component allows children, pass it to the render as
View Full Code Here

            createAttribute(attr, value, target);
        }
        if (target.getAttributes().containsKey("itemLabel")
            && node.getChildren().size() == 1) {

            Node child = (Node) node.getChildren().get(0);
            String value = child.getToken().getRawText();
            AttributeBean attr = target.getAttribute("itemLabel");
            createAttribute(attr, value, target);
        }

    }
View Full Code Here

       
        Parser p = new Parser();
        List nodes = p.parse(writer.getBuffer());
        assertEquals("1 root node", 1, nodes.size());

        Node comment = findComment((Node) nodes.get(0));
        assertNotNull("comment found", comment);      
        assertTrue("is a comment", comment.isComment());
       
        StringBuffer buff = concatCommentText(comment);     
        assertEquals("<!-- <span jsfid=\"outputText\"/> -->", buff.toString());
       
        writer.close();
View Full Code Here

       
        Parser p = new Parser();
        List nodes = p.parse(writer.getBuffer());
        assertEquals("1 root node", 1, nodes.size());
       
        Node comment = findComment((Node) nodes.get(0));
        assertNotNull("comment found", comment);      
        assertTrue("is a comment", comment.isComment());
       
        StringBuffer buff = concatCommentText(comment);     
        assertEquals("<!-- <span jsfid=\"outputText\"/> -->", buff.toString());
     
        writer.close();
View Full Code Here

        if (node.isComment())
           return node;
       
        Iterator ci = node.getChildren().iterator();
        while (ci.hasNext()) {
           Node child = (Node) ci.next();
           Node comment = findComment(child);
           if (comment != null)
              return comment;    
        }
       
        return null;
View Full Code Here

TOP

Related Classes of org.apache.shale.clay.parser.Node

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.