Package com.caucho.xml

Examples of com.caucho.xml.QName


         String qName, Attributes atts)
    throws SAXException
  {
    try {
      setLocation();
      _builder.startElement(new QName(qName, uri));

      for (int i = 0; i < atts.getLength(); i++) {
  setLocation();
  _builder.attribute(new QName(atts.getQName(i), atts.getURI(i)),
         atts.getValue(i));
      }
     
      setLocation();
      _builder.endAttributes();
View Full Code Here


   
      XslNode literal = createChild(top);

      XslTemplate template = new XslTemplate();
      template.setGenerator((JavaGenerator) this);
      template.addAttribute(new QName("match"), "/");
      template.addChild(literal);

      template.generateDeclaration(getOut());
   
      template.generate(getOut());
View Full Code Here

  {
    if (gen == null)
      throw new NullPointerException();
   
    setGenerator(gen);
    setQName(new QName("jsp", "text", JSP_NS));
    setParent(parent);

    _text = text;
  }
View Full Code Here

    try {
      _nameStack.clear();
      _itemStack.clear();
      _eltLocationStack.clear();

      _name = new QName("#top", "");
      _item = _schema.getStartItem();

      _itemStack.add(_item);

      _eltLocation = getLocation();
View Full Code Here

   
    if (_isLogFinest)
      log.finest("element start: " + qName);

    try {
      QName parent = _name;
      _nameStack.add(parent);

      String parentLocation = _eltLocation;
      _eltLocationStack.add(parentLocation);
     
      QName name = new QName(qName, uri);
      _name = name;
      _eltLocation = getLocation();

      Item newItem = getStartElement(_item, name);

      if (newItem == null) {
  Item parentItem = _itemStack.get(_itemStack.size() - 1);
 
        if (parent.getName().equals("#top"))
          throw new RelaxException(L.l("<{0}> is an unexpected top-level tag.{1}",
                                       errorNodeName(name, _item, parentItem),
               errorMessageDetail(_item, parentItem, null, name)));
        else
          throw new RelaxException(L.l("<{0}> is an unexpected tag (parent <{1}> starts at {2}).{3}",
                                       errorNodeName(name, _item, parentItem),
               parent.getName(), parentLocation,
                                       errorMessageDetail(_item, parentItem, parent.getName(), name)));
      }

      _item = newItem;
      _itemStack.add(newItem);

      Item parentItem = newItem;

      int len = attrs.getLength();
      for (int i = 0; i < len; i++) {
        String attrUri = attrs.getURI(i);
        String attrQName = attrs.getQName(i);
        String value = attrs.getValue(i);
       
        if (_isLogFinest)
          log.finest("attribute: " + attrQName + "=\"" + value + "\"");
       
        name = new QName(attrQName, attrUri);

        if (attrQName.startsWith("xml:")) {
        }
        else if (! _item.allowAttribute(name, value)) {
          throw new RelaxException(L.l("{0}=\"{1}\" is an unexpected attribute in <{2}>.{3}",
View Full Code Here

      return;

    if (_isLogFinest)
      log.finest("element end: " + qName);

    QName name = _name;
    QName parent = _nameStack.remove(_nameStack.size() - 1);
    _name = parent;

    Item parentItem = _itemStack.remove(_itemStack.size() - 1);

    String eltOpen = _eltLocation;
View Full Code Here

    if (values.size() > 0) {
      ArrayList<QName> sortedValues = new ArrayList<QName>(values);
      Collections.sort(sortedValues);
     
      for (int i = 0; i < sortedValues.size(); i++) {
        QName name = sortedValues.get(i);

        if (i == 0)
          cb.append("\n\n");
        else if (i == sortedValues.size() - 1)
          cb.append(" or\n");
        else
          cb.append(",\n");

  if (name.getName().equals("#text")) {
    cb.append("text");
  }
        else if (name.getNamespaceURI() == null || qName == null)
          cb.append("<" + name.getName() + ">");
        else if (qName.getNamespaceURI() != name.getNamespaceURI()) {
          if (name.getPrefix() != null)
            cb.append("<" + name.getName() + " xmlns:" + name.getPrefix() + "=\"" + name.getNamespaceURI() + "\">");
          else
            cb.append("<" + name.getName() + " xmlns=\"" + name.getNamespaceURI() + "\">");
        }
        else
          cb.append("<" + name.getName() + ">");
      }

      if (values.size() == 1)
        cb.append(" is expected");
      else
View Full Code Here

    node.setParent(this);
   
    if (node instanceof JspAttribute) {
      JspAttribute attr = (JspAttribute) node;

      QName name = attr.getName();

      addAttribute(name, attr);

      _hasJspAttribute = true;
View Full Code Here

    if (values.size() > 0) {
      ArrayList<QName> sortedValues = new ArrayList<QName>(values);
      Collections.sort(sortedValues);
     
      for (int i = 0; i < sortedValues.size(); i++) {
        QName name = sortedValues.get(i);

        if (i == 0)
          cb.append("\n\n");
        else if (i == sortedValues.size() - 1)
          cb.append(" or ");
        else
          cb.append(", ");

  String uri = name.getNamespaceURI();
        if (uri == null || uri.equals(""))
          cb.append("'" + name.getName() + "'");
        else if (qName == null || qName.getName().equals(name.getName()))
          cb.append("'" + name.getCanonicalName() + "'");
        else
          cb.append("'" + name.getName() + "'");
      }

      if (values.size() == 1)
        cb.append(" is expected.");
      else
View Full Code Here

      mapAttribute = tagInfoImpl.getDynamicAttributesName();
    }
   
    // fill all mentioned attributes
    for (int i = 0; i < _attributeNames.size(); i++) {
      QName attrName = _attributeNames.get(i);
      Object value = _attributeValues.get(i);
     
      TagAttributeInfo attribute = null;
      int j = 0;
      for (j = 0; attrs != null && j < attrs.length; j++) {
  if (attrs[j].getName().equals(attrName.getName())) {
          attribute = attrs[j];
    break;
        }
      }

      if (attribute == null && ! isDynamic)
  throw error(L.l("unexpected attribute `{0}' in <{1}>",
                        attrName.getName(), getTagName()));

      boolean rtexprvalue = true;

      Class cl = null;

      if (attribute != null) {
  cl = _gen.loadBeanClass(attribute.getTypeName());

  rtexprvalue = attribute.canBeRequestTime();
      }
     
      if (cl == null)
  cl = String.class;

      if (attribute == null) {
        /*
  if (mapName == null) {
    mapName = "_jsp_map_" + _gen.uniqueId();
    out.println("java.util.HashMap " + mapName + " = new java.util.HashMap(8);");
    out.println(name + ".setAttribute(\"" + mapAttribute + "\", " + mapName + ");");
  }
  */

  out.print(customTagName + ".setDynamicAttribute(null, \"" + attrName.getName() + "\", ");
      }
      else
  out.print(name + ".setAttribute(\"" + attrName.getName() + "\", ");

      if (value instanceof JspNode) {
  JspFragmentNode frag = (JspFragmentNode) value;

  if (attribute != null &&
      attribute.getTypeName().equals(JspFragment.class.getName())) {
    out.println(generateFragment(frag, "pageContext") + ");");
  }
  else
    out.println(frag.generateValue() + ");");
      }
      else {
  String convValue = generateParameterValue(cl,
              (String) value,
              rtexprvalue,
              attribute,
              _parseState.isELIgnored());
     
  //          attribute.allowRtexpr());

  out.println(toObject(cl, convValue) + ");");

  String localName = attrName.getLocalName();
  String upperName = Character.toUpperCase(localName.charAt(0)) + localName.substring(1);

  if (attribute != null) {
    // needed by TeamCity
          out.println(customTagName + ".set" + upperName + "(" + convValue + ");");
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.