Examples of AnyNode


Examples of org.exolab.castor.types.AnyNode

     * @param namespace the namespace of the element.
    **/
    public void endElement(String name, String namespace)
        throws XMLException
    {
        AnyNode node = (AnyNode)_nodes.pop();
        if (_nodes.isEmpty()) {
            //-- add to appInfo
            _documentation.add(node);
        }
        else {
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

    public void characters(char[] ch, int start, int length)
        throws XMLException
    {
        //-- Do delagation if necessary
        AnyNode text = new AnyNode(AnyNode.TEXT,
                                   null,  //-- no local name for text nodes
                                   null,  //-- no prefix
                                   null,  //-- no namespace
                                   new String(ch, start, length));
                                  
        if (!_nodes.isEmpty()) {
            AnyNode parent = (AnyNode)_nodes.peek();
            parent.addChild(text);
        }
        else {
            _documentation.add(text);
        }
       
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

            //-- find prefix (elements use default namespace if null)
            if (namespace == null) namespace = "";
            prefix = nsDecls.getNamespacePrefix(namespace);
        }
       
        AnyNode node = new AnyNode(AnyNode.ELEMENT, name, prefix, namespace, null);
        _nodes.push(node);
       
        //-- process namespace nodes
        if (nsDecls != null) {
            Enumeration enumeration = nsDecls.getLocalNamespaces();
            while (enumeration.hasMoreElements()) {
                namespace = (String)enumeration.nextElement();
                prefix = nsDecls.getNamespacePrefix(namespace);
                node.addNamespace ( new AnyNode(AnyNode.NAMESPACE,
                                                null,  //-- no local name for a ns decl.
                                                prefix,
                                                namespace,
                                                null)); //-- no value
            }
        }
        //-- process attributes
        if (atts != null) {
            for (int i = 0; i < atts.getSize(); i++) {
                namespace = atts.getNamespace(i);
                if ((nsDecls != null) && (namespace != null)) {
                    prefix = nsDecls.getNamespacePrefix(namespace);
                }
                else prefix = null;
                node.addAttribute( new AnyNode(AnyNode.ATTRIBUTE,
                                           atts.getName(i),
                                           prefix, namespace,
                                           atts.getValue(i)) );
            }
        }
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

     * @param namespace the namespace of the element.
    **/
    public void endElement(String name, String namespace)
        throws XMLException
    {
        AnyNode node = (AnyNode)_nodes.pop();
        if (_nodes.isEmpty()) {
            //-- add to appInfo
            _appInfo.add(node);
        }
        else {
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

    public void characters(char[] ch, int start, int length)
        throws XMLException
    {
        //-- Do delagation if necessary
        AnyNode text = new AnyNode(AnyNode.TEXT,
                                   null,  //-- no local name for text nodes
                                   null,  //-- no prefix
                                   null,  //-- no namespace
                                   new String(ch, start, length));
                                  
        if (!_nodes.isEmpty()) {
            AnyNode parent = (AnyNode)_nodes.peek();
            parent.addChild(text);
        }
        else {
            _appInfo.add(text);
        }
       
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

    }
    //-------------------------------------------------

    //--Namespace related (SAX2 Events)
    public void startPrefixMapping(String prefix, String uri) throws SAXException {
        AnyNode temp = new AnyNode(AnyNode.NAMESPACE, null, prefix, uri, null);
       _namespaces.push(temp);
       if (_processNamespace) {
           _context = _context.createNamespaces();
           _processNamespace = true;
       }
View Full Code Here

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

                            String qName, Attributes atts)
          throws SAXException
    {
       
        createNodeElement(namespaceURI, localName, qName);
        AnyNode tempNode;
       
        //--SAX2 Parser has not processed the namespaces
        //--so we need to do it.
        if (_processNamespace)
            _context = _context.createNamespaces();
        else
            _processNamespace = true;
       
        //process attributes
        for (int i=0; i<atts.getLength(); ++i) {

            String uri       = atts.getURI(i);
            String attqName  = atts.getQName(i);
            String value     = atts.getValue(i);
            String prefix    = null;
           
            if ((attqName.length() != 0) && (attqName.indexOf(':') != -1 ))
                prefix = attqName.substring(0,attqName.indexOf(':'));
               
            //--Namespace not yet processed?
            if (_processNamespace && attqName.startsWith(XMLNS_PREFIX)) {
                //handles namespace declaration
                // Extract the prefix if any
                prefix = (attqName.equals(XMLNS_PREFIX))?null:attqName.substring(XMLNS_PREFIX_LENGTH);
                tempNode = new AnyNode(AnyNode.NAMESPACE, getLocalPart(attqName), prefix, value, null);
                _context.addNamespace(prefix, value);
                _namespaces.push(tempNode);
            } else {
                tempNode = new AnyNode(AnyNode.ATTRIBUTE, getLocalPart(attqName), prefix, uri, value);
                _node.addAttribute(tempNode);
            }
        }
       
        //--empty the namespace stack and add
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
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.