Package hu.jokeman.xparser.document

Examples of hu.jokeman.xparser.document.XMLNode


        visitChildren (anElement);
       
        LinkedList<XMLNode> childrenToRemove = new LinkedList<XMLNode> ();
        XMLNodeIterator nodeIt = anElement.children ();
        while (nodeIt.hasNext ()) {
            XMLNode child = nodeIt.next ();
            if ((child instanceof XMLCData) &&
                    (((XMLCData) child).getContent ().length () == 0)) {
                childrenToRemove.add (child);
            }
        }
View Full Code Here


        // attrib�tumok kiirat�sa �s megsz�mol�sa
        XMLNodeIterator nodeIt = anElement.children ();
        int attrCount = 0;
        while (nodeIt.hasNext ()) {
            XMLNode child = nodeIt.next ();
            if (child instanceof XMLAttribute ) {
                child.accept (this);
                attrCount++;
            }
        }

        // gyermek elemek kiirat�sa - ha vannak
        buf = new StringBuffer ();
        if (attrCount == anElement.childCount ()) {
            _pp.printSimple (appendCode (buf, XMLNodeColor.Element,
                        " /&gt;").toString () + "\n");
        } else {
            _pp.printSimple (appendCode (buf, XMLNodeColor.Element,
                        "&gt;").toString () + "\n");
            _pp.inc ();

            nodeIt = anElement.children ();
            while (nodeIt.hasNext ()) {
                XMLNode child = nodeIt.next ();
                if (!(child instanceof XMLAttribute)) {
                    child.accept (this);
                }
            }
           
            _pp.pop ();
            buf = new StringBuffer ();
View Full Code Here

                "&lt;?" + aProcessingInstruction.getName ()).toString ());
       
        // attrib�tumok kiirat�sa
        XMLNodeIterator nodeIt = aProcessingInstruction.children ();
        while (nodeIt.hasNext ()) {
            XMLNode child = nodeIt.next ();
            if (child instanceof XMLAttribute) {
                child.accept (this);
            }
        }

        // PI lez�r�sa
        buf = new StringBuffer ();
View Full Code Here

    private XMLNode pop () {
        return (XMLNode) _currentNodes.pop ();
    }

    public void addCData (String content) throws DocumentBuilderException {
        XMLNode currentNode = peek ();
        if (currentNode instanceof Document ||
                currentNode instanceof Element) {
           
            currentNode.addChild (new CData (content));
        } else {
            throw new DocumentBuilderException ("CData isn't allowed here.");
        }
    }
View Full Code Here

            throw new DocumentBuilderException ("CData isn't allowed here.");
        }
    }

    public void addDocType (String docType) throws DocumentBuilderException {
        XMLNode currentNode = peek ();
        if (currentNode instanceof Document) {
            currentNode.addChild (new DocType (docType));
        } else {
            throw new DocumentBuilderException (
                    "Document schema definitions aren't allowed here.");
        }
    }
View Full Code Here

        }
    }

    public void createProcessingInstructionStart (String piName)
            throws DocumentBuilderException {
        XMLNode currentNode = peek ();
        if (currentNode instanceof Document) {
            ProcessingInstruction pi = new ProcessingInstruction (piName);
            currentNode.addChild (pi);
            push (pi);
        } else {
            throw new DocumentBuilderException (
                    "Document schema definitions aren't allowed here.");
        }
View Full Code Here

        }
    }

    public void finishProcessingInstructionStart ()
            throws DocumentBuilderException {
        XMLNode currentNode = peek ();
        if (currentNode instanceof ProcessingInstruction) {
            pop ();
        } else {
            throw new DocumentBuilderException (
                    "Current node is not a processing instruction.");
View Full Code Here

                    "Current node is not a processing instruction.");
        }
    }

    public void createTagStart (String tagName) throws DocumentBuilderException {
        XMLNode currentNode = peek ();
        if (currentNode instanceof Document ||
                currentNode instanceof Element) {
            Element element = new Element (tagName);
            currentNode.addChild (element);
            push (element);
        } else {
            throw new DocumentBuilderException (
                    "Elements not allowed here.");
        }
View Full Code Here

    public void finishTagStart () throws DocumentBuilderException {
    }

    public void addAttribute (String attrName, String attrVal)
            throws DocumentBuilderException {
        XMLNode currentNode = peek ();
        if (currentNode instanceof Element ||
                currentNode instanceof ProcessingInstruction) {
            Attribute attr = new Attribute (attrName);
            attr.setValue (attrVal);
            currentNode.addChild (attr);
        } else {
            throw new DocumentBuilderException (
                    "Attributes not allowed here.");
        }
    }
View Full Code Here

                    "Attributes not allowed here.");
        }
    }

    public void addTagClose (String tagName) throws DocumentBuilderException {
        XMLNode currentNode = peek ();
        if (!(currentNode instanceof Element) ||
                !((Element) currentNode).getName ().equals (tagName)) {
            throw new DocumentBuilderException (
                    "Cannot close element: " + tagName + ".");
        }
View Full Code Here

TOP

Related Classes of hu.jokeman.xparser.document.XMLNode

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.