Examples of AnyNode


Examples of org.exolab.castor.types.AnyNode

           throws SAXException
    {
        _character = false;
        String qName;
        String value;
        AnyNode tempNode = null;

        //Namespace handling code to be moved once we integrate
        //the new event API
        /////////////////NAMESPACE HANDLING/////////////////////
        _context = _context.createNamespaces();
        String prefix = "";
        String namespaceURI = null;
        int idx = name.indexOf(':');
        if (idx >= 0) {
             prefix = name.substring(0,idx);
        }
        namespaceURI = _context.getNamespaceURI(prefix);
        //--Overhead here since we process attributes twice
        for (int i=0; i<atts.getLength(); ++i) {
            qName = atts.getName(i);
            value = atts.getValue(i);
            String nsPrefix = null;

            if (qName.startsWith(XMLNS_PREFIX)) {
                //handles namespace declaration
                // Extract the prefix if any
                nsPrefix = (qName.equals(XMLNS_PREFIX))?null:qName.substring(XMLNS_PREFIX_LENGTH);
                tempNode = new AnyNode(AnyNode.NAMESPACE, getLocalPart(qName), nsPrefix, value, null);
                _context.addNamespace(nsPrefix, value);
                _namespaces.push(tempNode);
                if (prefix.equals(nsPrefix))
                    namespaceURI = value;
            }
        }
        ////////////////////////END OF NAMESPACE HANDLING///////////////

        createNodeElement(namespaceURI, getLocalPart(name), name);
        while (!_namespaces.empty()) {
           tempNode = (AnyNode)_namespaces.pop();
           _node.addNamespace(tempNode);
        }

        //process attributes
        for (int i=0; i<atts.getLength(); ++i) {

            qName = atts.getName(i);
            value = atts.getValue(i);

            //Namespace handling already done
            if (!qName.startsWith(XMLNS_PREFIX)) {
                tempNode = new AnyNode(AnyNode.ATTRIBUTE, getLocalPart(qName), null, null, value);
                _node.addAttribute(tempNode);
            }
        }
        tempNode = null;
    }
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

          throws SAXException
    {
        createNodeElement(namespaceURI, localName, qName);
        //empty the namespaces stack
        //that must have been filled by startPrefixMapping()
        AnyNode tempNode = null;
        while (!_namespaces.empty()) {
           tempNode = (AnyNode)_namespaces.pop();
           _node.addNamespace(tempNode);
        }
        //process attributes
        for (int i=0; i<atts.getLength(); ++i) {

            String uri       = atts.getURI(i);
            String qname     = atts.getQName(i);
            String localname = atts.getLocalName(i);
            String value     = atts.getValue(i);
            tempNode = new AnyNode(AnyNode.ATTRIBUTE, localname, null, uri, value);
            _node.addAttribute(tempNode);
        }
        tempNode = null;
    }
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

        if (_nodeStack.empty()) {
            _startingNode.addChild(_node);
            _node = _startingNode;
        }
        else {
            AnyNode previousNode = (AnyNode) _nodeStack.peek();
            previousNode.addChild(_node);
            //--the node processing is finished -> come back to the previous node
            _node = previousNode;
         }
    }
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

        String temp = new String(ch, start, length);
        //skip whitespaces
        if (isWhitespace(temp) & !_character)
            return;
        else {
            AnyNode tempNode = new AnyNode(AnyNode.TEXT, null, null, null, temp);
            _node.addChild(tempNode);
           _character = true;
        }
    }
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

            prefix = qName.substring(0,qName.indexOf(':'));

        //creates the starting ELEMENT node
        //or a default ELEMENT node
        if ( (_nodeStack.empty()) && (_startingNode == null)) {
           _startingNode = new AnyNode(AnyNode.ELEMENT, localName, prefix, namespaceURI, null);
           _node = _startingNode;
        } else {
          _node = new AnyNode(AnyNode.ELEMENT, localName, prefix, namespaceURI, null);
          //push the node in the stack
          _nodeStack.push(_node);
        }
   }
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

     * @param buffer the StringBuffer to append to.
     */
    static final void getStringValue(AnyNode node, StringBuffer buffer) {
        switch(node.getNodeType()) {
            case AnyNode.ELEMENT:
                AnyNode child = node.getFirstChild();
                while (child != null) {
                    getStringValue(child, buffer);
                    child = child.getNextSibling();
                }
                break;
            case AnyNode.TEXT:
                buffer.append(node.getStringValue());
                break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.