Package com.caucho.xml

Examples of com.caucho.xml.QName


    if (_hasBodyContent != hasBodyContent)
      return false;
   
    for (int i = 0; i < _attributeNames.size(); i++) {
      QName attrName = _attributeNames.get(i);

      if (names.indexOf(attrName) < 0)
        return false;
    }

    for (int i = 0; i < names.size(); i++) {
      QName name = names.get(i);

      if (_attributeNames.indexOf(name) < 0)
        return false;
    }
View Full Code Here


    if (type != null) {
      return type;
    }

    if (! "".equals(name.getNamespaceURI())) {
      type = getEnvironmentType(new QName(name.getLocalName()));

      if (type != null) {
        _attrMap.put(name, type);

        return type;
View Full Code Here

    public ConfigType getConfigType()
    {
      try {
        if (_configType == null) {
          QName qName = new QName(null, _name, _ns);

          Class cl = Class.forName(_className, false, _loader);

          ConfigType type = createType(cl);
View Full Code Here

    _init.addProgram(program);
  }

  public void addBuilderProgram(ConfigProgram program)
  {
    QName name = program.getQName();

    if (name == null) {
      addInitProgram(program);

      return;
    }

    Class<?> cl = createClass(name);

    if (cl == null) {
    }
    else if (Annotation.class.isAssignableFrom(cl)) {
      ConfigType<?> type = TypeFactory.getType(cl);

      Object bean = type.create(null, name);

      Node node = getProgramNode(program);

      if (node != null)
        XmlConfigContext.getCurrent().configureNode(node, bean, type);

      Annotation ann = (Annotation) type.replaceObject(bean);

      addAnnotation(ann);

      return;
    }

    if (name.getNamespaceURI().equals(_name.getNamespaceURI())) {
      Method method;

      if (_configType.getAttribute(name) != null)
        addInitProgram(program);
      else {
        throw new ConfigException(L.l("'{0}' is an unknown field for '{1}'",
                                      name.getLocalName(), _class.getName()));
      }
    }

    else
      throw new ConfigException(L.l("'{0}' is an unknown field name.  Fields must belong to the same namespace as the class",
                                    name.getCanonicalName()));
  }
View Full Code Here

   */
  public void setNode(Node node)
  {
    _node = node;

    setQName(new QName(node.getNodeName(), null));
  }
View Full Code Here

      processTaglib(prefix, JSTL_CORE_URI);
    }

    setLocation(jspPath, filename, line);
    _jspBuilder.startElement(JSTL_CORE_OUT);
    _jspBuilder.attribute(new QName("value"), cb.close());
    _jspBuilder.attribute(new QName("escapeXml"), "false");
    _jspBuilder.endAttributes();
    _jspBuilder.endElement(JSTL_CORE_OUT.getName());

    return ch;
  }
View Full Code Here

    }

    if (name.startsWith("$"))
      name = name.substring(1);

    _jspBuilder.attribute(new QName("var"), name);

    cb.clear();
    parseVelocityExpr(cb, ')');
    String expr = cb.close();

    if (expr.indexOf("..") > 0) {
      int h = 0;
      for (; Character.isWhitespace(expr.charAt(h)); h++) {
      }

      if (expr.charAt(h) != '[')
        throw error(L.l("Expected '[' for #foreach `{0}'.  The velocity-style #foreach syntax is: #foreach ([Type] $a in [min .. max])",
                        badChar(expr.charAt(h))));

      int t = expr.length() - 1;
      for (; Character.isWhitespace(expr.charAt(t)); t--) {
      }

      if (expr.charAt(t) != ']')
        throw error(L.l("Expected ']' for #foreach `{0}'.  The velocity-style #foreach syntax is: #foreach ($a in [min .. max])",
                        badChar(expr.charAt(t))));

      int p = expr.indexOf("..");

      String min = expr.substring(h + 1, p);
      String max = expr.substring(p + 2, t);

      _jspBuilder.attribute(new QName("begin"), "${" + min + "}");
      _jspBuilder.attribute(new QName("end"), "${" + max + "}");
    }
    else {
      _jspBuilder.attribute(new QName("items"), "${" + expr + "}");
    }
    _jspBuilder.endAttributes();

    return skipWhitespaceToEndOfLine(read());
  }
View Full Code Here

    _jspBuilder.startElement(JSTL_CORE_WHEN);
    _lineStart = _line;

    CharBuffer cb = CharBuffer.allocate();
    parseVelocityExpr(cb, ')');
    _jspBuilder.attribute(new QName("test"), "${" + cb.close() + "}");
    _jspBuilder.endAttributes();

    return skipWhitespaceToEndOfLine(read());
  }
View Full Code Here

    _lineStart = _line;

    int ch = read();

    // probably should be a qname
    QName eltName = null;

    switch (ch) {
    case '=':
      eltName = JSP_EXPRESSION;
      ch = read();
      break;

    case '!':
      eltName = JSP_DECLARATION;
      ch = read();
      break;

    case '@':
      parseDirective();
      return;

    case '-':
      if ((ch = read()) == '-') {
        parseComment();
        return;
      }
      else {
        eltName = JSP_SCRIPTLET;
        addText('-');
      }
      break;

    default:
      eltName = JSP_SCRIPTLET;
      break;
    }

    setLocation(_jspPath, _filename, _lineStart);
    _jspBuilder.startElement(eltName);
    _jspBuilder.endAttributes();

    while (ch >= 0) {
      switch (ch) {
      case '\\':
        addText('\\');
        ch = read();
        if (ch >= 0)
          addText((char) ch);
        ch = read();
        break;

      case '%':
        ch = read();
        if (ch == '>') {
          createText();
          setLocation();
          _jspBuilder.endElement(eltName.getName());
          return;
        }
        else if (ch == '\\') {
          ch = read();
          if (ch == '>') {
            addText("%");
          }
          else
            addText("%\\");
        }
        else
          addText('%');
        break;

      default:
        addText((char) ch);
        ch = read();
        break;
      }
    }

    createText();
    setLocation();
    _jspBuilder.endElement(eltName.getName());
  }
View Full Code Here

    }
    else
      throw error(L.l("Expected jsp directive name at '{0}'.  JSP directive syntax is <%@ name attr1='value1' ... %>",
                      badChar(ch)));

    QName qname;

    if (directive.equals("page"))
      qname = JSP_DIRECTIVE_PAGE;
    else if (directive.equals("include"))
      qname = JSP_DIRECTIVE_INCLUDE;
    else if (directive.equals("taglib"))
      qname = JSP_DIRECTIVE_TAGLIB;
    else if (directive.equals("cache"))
      qname = JSP_DIRECTIVE_CACHE;
    else if (directive.equals("attribute"))
      qname = JSP_DIRECTIVE_ATTRIBUTE;
    else if (directive.equals("variable"))
      qname = JSP_DIRECTIVE_VARIABLE;
    else if (directive.equals("tag"))
      qname = JSP_DIRECTIVE_TAG;
    else
      throw error(L.l("'{0}' is an unknown jsp directive.  Only <%@ page ... %>, <%@ include ... %>, <%@ taglib ... %>, and <%@ cache ... %> are known.", directive));

    unread(ch);

    ArrayList<QName> keys = new ArrayList<QName>();
    ArrayList<String> values = new ArrayList<String>();
    ArrayList<String> prefixes = new ArrayList<String>();
    ArrayList<String> uris = new ArrayList<String>();

    parseAttributes(keys, values, prefixes, uris);

    ch = skipWhitespace(read());

    if (ch != '%' || (ch = read()) != '>') {
      throw error(L.l("expected '%>' at {0}.  JSP directive syntax is '<%@ name attr1='value1' ... %>'.  (Started at line {1})",
                      badChar(ch), _lineStart));
    }

    setLocation(_jspPath, _filename, _lineStart);
    _lineStart = _line;
    _jspBuilder.startElement(qname);

    for (int i = 0; i < keys.size(); i++) {
      _jspBuilder.attribute(keys.get(i), values.get(i));
    }
    _jspBuilder.endAttributes();

    if (qname.equals(JSP_DIRECTIVE_TAGLIB))
      processTaglibDirective(keys, values);

    setLocation();
    _jspBuilder.endElement(qname.getName());

    if (qname.equals(JSP_DIRECTIVE_PAGE)
        || qname.equals(JSP_DIRECTIVE_TAG)) {
      String contentEncoding = _parseState.getPageEncoding();
      if (contentEncoding == null)
        contentEncoding = _parseState.getCharEncoding();

      if (contentEncoding != null) {
View Full Code Here

TOP

Related Classes of com.caucho.xml.QName

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.