Examples of AnyNode


Examples of com.strobel.decompiler.patterns.AnyNode

                pattern.getParameters().add(new NamedNode("size", size).toParameterDeclaration());

                final ArrayCreationExpression arrayCreation = new ArrayCreationExpression(Expression.MYSTERY_OFFSET);

                arrayCreation.getDimensions().add(new IdentifierExpressionBackReference("size").toExpression());
                arrayCreation.setType(new NamedNode("type", new AnyNode()).toType());

                pattern.setBody(arrayCreation);

                final Match match = pattern.match(node);
View Full Code Here

Examples of com.strobel.decompiler.patterns.AnyNode

        _resolver = new JavaResolver(context);

        final TryCatchStatement tryPattern = new TryCatchStatement(Expression.MYSTERY_OFFSET);

        tryPattern.setTryBlock(new AnyNode("tryContent").toBlockStatement());

        final CatchClause catchClause = new CatchClause(
            new BlockStatement(
                new ExpressionStatement(
                    new AssignmentExpression(
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

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
            _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

              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

   * @throws XMLException if unmarshalling fails.
   *
  **/
  public void endElement(final String name, final String namespace)
      throws XMLException {
      AnyNode node = (AnyNode) _nodes.pop();
      if (_nodes.isEmpty()) {
          //- unmarshall JDO appinfo content
          if (node.getNamespaceURI().equals(JDOConstants.JDO_NAMESPACE)
                  && (node.getLocalName().equals(JDOConstants.ANNOTATIONS_TABLE_NAME)
                          || node.getLocalName().equals(JDOConstants.ANNOTATIONS_COLUMN_NAME)
                          || node.getLocalName().equals(JDOConstants.ANNOTATIONS_ONE_TO_ONE_NAME)
                          || node.getLocalName().equals(JDOConstants.ANNOTATIONS_ONE_TO_MANY))) {
              XMLContext context = new XMLContext();
              context.addPackage(JDOConstants.GENERATED_ANNOTATION_CLASSES_PACKAGE);
              Unmarshaller unmarshaller = context.createUnmarshaller();              
              unmarshaller.setClassLoader(getClass().getClassLoader());
              _appInfo.getJdoContent().add(unmarshaller.unmarshal(node));
View Full Code Here

Examples of org.exolab.castor.types.AnyNode

  }

  public void characters(char[] ch, int start, int length)
      throws XMLException {
      //-- Do delegation 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

        if (node.getNodeType() == AnyNode.ELEMENT) {
            String name = node.getLocalName();

            //-- retrieve the attributes and handle them
            AttributeListImpl atts = new AttributeListImpl();
            AnyNode tempNode = node.getFirstAttribute();
            String xmlName = null;
            String value = null;
            String attUri = null;
            String attPrefix = null;

            while (tempNode != null) {
                xmlName = tempNode.getLocalName();
                //--retrieve a prefix?
                attUri = tempNode.getNamespaceURI();
                if (attUri != null) {
                    attPrefix = _context.getNamespacePrefix(attUri);
                }
                if (attPrefix != null && attPrefix.length() > 0) {
                    xmlName = attPrefix + ':' + xmlName;
                }
                value = tempNode.getStringValue();
                atts.addAttribute(xmlName, "CDATA", value);
                tempNode = tempNode.getNextSibling();
            } //attributes

            //-- namespace management
            _context = _context.createNamespaces();
            String nsPrefix = node.getNamespacePrefix();
            String nsURI = node.getNamespaceURI();

             //-- retrieve the namespaces declaration and handle them
            tempNode = node.getFirstNamespace();
            String prefix = null;
            while (tempNode != null) {
                prefix = tempNode.getNamespacePrefix();
                value = tempNode.getNamespaceURI();
                if (value != null && value.length() > 0) {
                    _context.addNamespace(prefix, value);
                }
                tempNode = tempNode.getNextSibling();
            } //namespaceNode

            String qName = null;
            //maybe the namespace is already bound to a prefix in the
            //namespace context
            if (nsURI != null && nsURI.length() > 0) {
                String tempPrefix = _context.getNamespacePrefix(nsURI);
                if (tempPrefix != null) {
                    nsPrefix = tempPrefix;
                } else {
                    _context.addNamespace(nsPrefix, nsURI);
                }
            }

            if (nsPrefix != null) {
                int len = nsPrefix.length();
                if (len > 0) {
                    StringBuffer sb = new StringBuffer(len+name.length()+1);
                    sb.append(nsPrefix);
                    sb.append(':');
                    sb.append(name);
                    qName = sb.toString();
                } else {
                    qName = name;
                }
            } else {
                qName = name;
            }

            try {
                _context.declareAsAttributes(atts,true);
                handler.startElement(qName, atts);
            } catch (SAXException sx) {
                throw new SAXException(sx);
            }

            //-- handle child&daughter elements
            tempNode = node.getFirstChild();
            while (tempNode != null) {
                processAnyNode(tempNode, handler);
                tempNode = tempNode.getNextSibling();
            }

            //-- finish element
            try {
                handler.endElement(qName);
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.