本文整理汇总了Java中org.mozilla.javascript.xml.XMLLib类的典型用法代码示例。如果您正苦于以下问题:Java XMLLib类的具体用法?Java XMLLib怎么用?Java XMLLib使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XMLLib类属于org.mozilla.javascript.xml包,在下文中一共展示了XMLLib类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setDefaultNamespace
import org.mozilla.javascript.xml.XMLLib; //导入依赖的package包/类
public static Object setDefaultNamespace(Object namespace, Context cx)
{
Scriptable scope = cx.currentActivationCall;
if (scope == null) {
scope = getTopCallScope(cx);
}
XMLLib xmlLib = currentXMLLib(cx);
Object ns = xmlLib.toDefaultXmlNamespace(cx, namespace);
// XXX : this should be in separated namesapce from Scriptable.get/put
if (!scope.has(DEFAULT_NS_TAG, scope)) {
// XXX: this is racy of cause
ScriptableObject.defineProperty(scope, DEFAULT_NS_TAG, ns,
ScriptableObject.PERMANENT
| ScriptableObject.DONTENUM);
} else {
scope.put(DEFAULT_NS_TAG, scope, ns);
}
return Undefined.instance;
}
示例2: currentXMLLib
import org.mozilla.javascript.xml.XMLLib; //导入依赖的package包/类
private static XMLLib currentXMLLib(Context cx)
{
// Scripts should be running to access this
if (cx.topCallScope == null)
throw new IllegalStateException();
XMLLib xmlLib = cx.cachedXMLLib;
if (xmlLib == null) {
xmlLib = XMLLib.extractFromScope(cx.topCallScope);
if (xmlLib == null)
throw new IllegalStateException();
cx.cachedXMLLib = xmlLib;
}
return xmlLib;
}
示例3: nameRef
import org.mozilla.javascript.xml.XMLLib; //导入依赖的package包/类
public static Ref nameRef(Object name, Context cx,
Scriptable scope, int memberTypeFlags)
{
XMLLib xmlLib = currentXMLLib(cx);
return xmlLib.nameRef(cx, name, scope, memberTypeFlags);
}