Package com.caucho.xml

Examples of com.caucho.xml.QName


  }

  private int getAttributeIndex(String name)
  {
    for (int i = 0; i < _attributeNames.size(); i++) {
      QName attrName = _attributeNames.get(i);

      if (isNameMatch(name, attrName))
  return i;
    }
View Full Code Here


  /**
   * Adds to the first set, the set of element names possible.
   */
  public void firstSet(HashSet<QName> set)
  {
    set.add(new QName("*", _ns));
  }
View Full Code Here

  /**
   * Returns the first set, the set of element names possible.
   */
  public void firstSet(HashSet<QName> set)
  {
    set.add(new QName("#data", ""));
  }
View Full Code Here

   */
  public static void setAttribute(Object obj, String attr, Object value)
  {
    ConfigType<?> type = TypeFactory.getType(obj.getClass());

    QName attrName = new QName(attr);
    Attribute attrStrategy = type.getAttribute(attrName);
    if (attrStrategy == null)
      throw new ConfigException(L.l("{0}: '{1}' is an unknown attribute.",
                                    obj.getClass().getName(),
                                    attrName.getName()));

    value = attrStrategy.getConfigType().valueOf(value);

    attrStrategy.setValue(obj, attrName, value);
  }
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

  /**
   * Returns the first set, the set of element names possible.
   */
  public void firstSet(HashSet<QName> set)
  {
    set.add(new QName("#data", ""));
  }
View Full Code Here

   */
  public static void setAttribute(Object obj, String attr, Object value)
  {
    ConfigType<?> type = TypeFactory.getType(obj.getClass());

    QName attrName = new QName(attr);
    Attribute attrStrategy = type.getAttribute(attrName);
    if (attrStrategy == null)
      throw new ConfigException(L.l("{0}: '{1}' is an unknown attribute.",
                                    obj.getClass().getName(),
                                    attrName.getName()));

    value = attrStrategy.getConfigType().valueOf(value);

    attrStrategy.setValue(obj, attrName, value);
  }
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())) {
      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

    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

    }
  }

  private NamePattern createNamePattern(String localName, String namespace)
  {
    return new NamePattern(new QName(localName, namespace));
  }
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.