Exemplo n.º 1
0
  @Override
  public Ref nameRef(
      Context cx, Object namespace, Object name, Scriptable scope, int memberTypeFlags) {
    XMLName xmlName = XMLName.create(toNodeQName(cx, namespace, name), false, false);

    //    No idea what is coming in from the parser in this case; is it detecting the "@"?
    if ((memberTypeFlags & Node.ATTRIBUTE_FLAG) != 0) {
      if (!xmlName.isAttributeName()) {
        xmlName.setAttributeName();
      }
    }

    return xmlPrimaryReference(cx, xmlName, scope);
  }
Exemplo n.º 2
0
 /** @deprecated */
 XMLName toAttributeName(Context cx, Object nameValue) {
   if (nameValue instanceof XMLName) {
     //    TODO    Will this always be an XMLName of type attribute name?
     return (XMLName) nameValue;
   } else if (nameValue instanceof QName) {
     return XMLName.create(((QName) nameValue).getDelegate(), true, false);
   } else if (nameValue instanceof Boolean
       || nameValue instanceof Number
       || nameValue == Undefined.instance
       || nameValue == null) {
     throw badXMLName(nameValue);
   } else {
     //    TODO    Not 100% sure that putting these in global namespace is the right thing to do
     String localName = null;
     if (nameValue instanceof String) {
       localName = (String) nameValue;
     } else {
       localName = ScriptRuntime.toString(nameValue);
     }
     if (localName != null && localName.equals("*")) localName = null;
     return XMLName.create(
         XmlNode.QName.create(XmlNode.Namespace.create(""), localName), true, false);
   }
 }
Exemplo n.º 3
0
 XMLName toXMLNameFromString(Context cx, String name) {
   return XMLName.create(getDefaultNamespaceURI(cx), name);
 }