Package com.caucho.xml

Examples of com.caucho.xml.QName


    }
    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


    unread(ch);

    parseAttributes(keys, values, prefixes, uris);

    QName qname = getElementQName(name);

    setLocation(_jspPath, _filename, _lineStart);
    _lineStart = _line;

    _jspBuilder.startElement(qname);


    for (int i = 0; i < keys.size(); i++) {
      QName key = keys.get(i);
      String value = values.get(i);

      _jspBuilder.attribute(key, value);
    }
View Full Code Here

      String url = Namespace.find(_namespaces, prefix);

      _prefixes.add(prefix);

      if (url != null)
        return new QName(prefix, name.substring(p + 1), url);
      else
        return new QName("", name, "");
    }
    else {
      String url = Namespace.find(_namespaces, "");

      if (url != null)
        return new QName("", name, url);
      else
        return new QName("", name, "");
    }
  }
View Full Code Here

    if (p > 0) {
      String prefix = name.substring(0, p);
      String url = Namespace.find(_namespaces, prefix);

      if (url != null)
        return new QName(prefix, name.substring(p + 1), url);
      else
        return new QName("", name, "");
    }
    else
      return new QName("", name, "");
  }
View Full Code Here

    }
    else
      out.addText("<" + _name);

    for (int i = 0; i < _attrNames.size(); i++) {
      QName name = _attrNames.get(i);
      JspAttribute value = _attrValues.get(i);

      out.addText(" " + name.getName() + "=\"");

      if (value.isStatic())
        out.addText(value.getStaticText());
      else
        out.print("out.print(" + value.generateValue() + ");");
View Full Code Here

      child = new TagInstance(gen, this, tagInfo, tagName, cl);

    child.setBodyContent(hasBodyContent);

    for (int i = 0; i < names.size(); i++) {
      QName name = names.get(i);
      Object value = values.get(i);
     
      if (value instanceof String) {
        String strValue = (String) value;
View Full Code Here

      child = new TagInstance(gen, this, tagInfo, tagName, cl);

    child.setBodyContent(hasBodyContent);

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

      if (value.startsWith("<%=") || value.startsWith("%="))
        value = null;
View Full Code Here

   * Sets the attribute.  Null values can't be pre-cached.
   */
  public void addAttribute(QName name, Object value)
  {
    for (int i = 0; i < _attributeNames.size(); i++) {
      QName attrName = _attributeNames.get(i);
     
      if (attrName.equals(name)) {
        Object oldValue = _attributeValues.get(i);
        if (value == null || oldValue == null || ! value.equals(oldValue))
          _attributeValues.set(i, null);

        return;
View Full Code Here

    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

  public QName getQName(String name)
  {
    int p = name.indexOf(':');

    if (p < 0)
      return new QName(name);
    else {
      String prefix = name.substring(0, p);
      String uri = Namespace.find(_namespaces, prefix);

      if (uri != null)
        return new QName(name, uri);
      else
        return new QName(name);
    }
  }
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.