예제 #1
0
  private void exportToScope(boolean sealed) {
    xmlPrototype = newXML(XmlNode.createText(options, ""));
    xmlListPrototype = newXMLList();
    namespacePrototype = Namespace.create(this.globalScope, null, XmlNode.Namespace.GLOBAL);
    qnamePrototype =
        QName.create(
            this, this.globalScope, null, XmlNode.QName.create(XmlNode.Namespace.create(""), ""));

    xmlPrototype.exportAsJSClass(sealed);
    xmlListPrototype.exportAsJSClass(sealed);
    namespacePrototype.exportAsJSClass(sealed);
    qnamePrototype.exportAsJSClass(sealed);
  }
예제 #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);
   }
 }