Package com.caucho.xml

Examples of com.caucho.xml.QName


  /**
   * Returns true if the namespace decl has been printed.
   */
  public boolean hasNamespace(String prefix, String uri)
  {
    QName name = getQName();

    if (prefix == null || uri == null)
      return true;
    else if (prefix.equals(name.getPrefix()) &&
       uri.equals(name.getNamespaceURI()))
      return true;
    else
      return _parent.hasNamespace(prefix, uri);
  }
View Full Code Here


    throws IOException
  {
    os.print("<" + getTagName());

    for (int i = 0; i < _attrNames.size(); i++) {
      QName name = _attrNames.get(i);
      String value = _attrValues.get(i);
     
      os.print(" " + name.getName() + "=\"");
     
      printXmlText(os, value);
     
      os.print("\"");
    }
View Full Code Here

    throws Exception
  {
    out.addText("<");
    out.addText(getTagName());

    QName qName = getQName();

    HashSet<String> prefixes = new HashSet<String>();
   
    if (qName.getNamespaceURI() != null &&
  ! _parent.hasNamespace(qName)) {
      prefixes.add(qName.getPrefix());
     
      out.addText(" ");
      if (qName.getPrefix() == null || qName.getPrefix().equals(""))
  out.addText("xmlns=\"");
      else
  out.addText("xmlns:" + qName.getPrefix() + "=\"");
      out.addText(qName.getNamespaceURI());
      out.addText("\"");
    }

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

      if (name.getNamespaceURI() != null &&
    ! prefixes.contains(name.getPrefix()) &&
    ! _parent.hasNamespace(name)) {
  prefixes.add(name.getPrefix());
  out.addText(" ");
  if (name.getPrefix() == null || name.getPrefix().equals(""))
    out.addText("xmlns=\"");
  else
    out.addText("xmlns:" + name.getPrefix() + "=\"");
  out.addText(name.getNamespaceURI());
  out.addText("\"");
      }
     
      out.addText(" ");
      out.addText(name.getName());

      if (value == null || value.equals("")) {
  // XXX: possibly differ for html/text
 
  out.addText("=\"\"");
View Full Code Here

  {
    if (_parent instanceof JsfFacetNode) {
      _facetName = ((JsfFacetNode) _parent).getName();
    }
    else if (_parent instanceof CustomTag) {
      final QName qName = _parent.getQName();

      if ((qName.getNamespaceURI().indexOf("http://java.sun.com/jsf/core") > -1)
    && "facet".equals(qName.getLocalName())) {

  final Object facetName = ((CustomTag) _parent).getAttribute("name");
 
  if (facetName instanceof String) {
    _facetName = facetName.toString();
View Full Code Here

      out.println(var + "_adapter = new javax.servlet.jsp.tagext.TagAdapter(" + var + ");");
    }

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

      String value = _tag.getAttribute(name);
      if (value == null)
        continue;

      generateSetAttribute(out, var, name, value, false, false,
         _tag.getAttributeInfo(name.getLocalName()));
    }
  }
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

    throws JspParseException
  {
    if (node instanceof JspAttribute) {
      JspAttribute attr = (JspAttribute) node;

      QName name = attr.getName();

      addAttribute(name, attr);
    }
  }
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

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.