Added javascript XPath escape string method.
git-svn-id: http://yate.null.ro/svn/yate/trunk@6540 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
8c9c4b2664
commit
10bdfb1bfe
|
@ -844,6 +844,8 @@ public:
|
|||
construct->params().addParam(new ExpOperation((int64_t)XPath::StrictParse,"StrictParse"));
|
||||
construct->params().addParam(new ExpOperation((int64_t)XPath::IgnoreEmptyResult,"IgnoreEmptyResult"));
|
||||
construct->params().addParam(new ExpOperation((int64_t)XPath::NoXmlNameCheck,"NoXmlNameCheck"));
|
||||
// Static functions
|
||||
construct->params().addParam(new ExpFunction("escapeString"));
|
||||
}
|
||||
virtual const XPath& path() const
|
||||
{ return m_path; }
|
||||
|
@ -4383,6 +4385,18 @@ bool JsXPath::runNative(ObjList& stack, const ExpOperation& oper, GenObject* con
|
|||
else
|
||||
ExpEvaluator::pushOne(stack,new ExpWrapper(0));
|
||||
}
|
||||
else if (oper.name() == YSTRING("escapeString")) {
|
||||
// XPath.escapeString(str[quot[,literal=true]])
|
||||
ExpOperation* str = 0;
|
||||
ExpOperation* quot = 0;
|
||||
ExpOperation* literal = 0;
|
||||
if (!extractStackArgs(1,this,stack,oper,context,args,&str,",&literal))
|
||||
return false;
|
||||
char q = quot ? (*(String*)quot)[0] : '"';
|
||||
String tmp;
|
||||
XPath::escape(tmp,*str,q,literal ? literal->valBoolean() : true);
|
||||
ExpEvaluator::pushOne(stack,new ExpOperation(tmp,"error"));
|
||||
}
|
||||
else
|
||||
return JsObject::runNative(stack,oper,context);
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue