예제 #1
0
 private XML parse(String frag) {
   try {
     return newXML(
         XmlNode.createElement(
             options, getDefaultNamespaceURI(Context.getCurrentContext()), frag));
   } catch (SAXException e) {
     throw ScriptRuntime.typeError("Cannot parse XML: " + e.getMessage());
   }
 }
예제 #2
0
  Namespace getDefaultNamespace(Context cx) {
    if (cx == null) {
      cx = Context.getCurrentContext();
      if (cx == null) {
        return namespacePrototype;
      }
    }

    Object ns = ScriptRuntime.searchDefaultNamespace(cx);
    if (ns == null) {
      return namespacePrototype;
    } else {
      if (ns instanceof Namespace) {
        return (Namespace) ns;
      } else {
        //    TODO    Clarify or remove the following comment
        // Should not happen but for now it could
        // due to bad searchDefaultNamespace implementation.
        return namespacePrototype;
      }
    }
  }