本文整理汇总了C++中Toplevel::xmlListClass方法的典型用法代码示例。如果您正苦于以下问题:C++ Toplevel::xmlListClass方法的具体用法?C++ Toplevel::xmlListClass怎么用?C++ Toplevel::xmlListClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Toplevel
的用法示例。
在下文中一共展示了Toplevel::xmlListClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToXMLList
// E4X 10.4, pg 36
Atom XMLListClass::ToXMLList(Atom arg)
{
AvmCore* core = this->core();
if (AvmCore::isNullOrUndefined(arg))
{
toplevel()->throwTypeError(
(arg == undefinedAtom) ? kConvertUndefinedToObjectError :
kConvertNullToObjectError);
return arg;
}
if (AvmCore::isXMLList(arg))
{
return arg;
}
else if (AvmCore::isXML(arg))
{
XMLObject *x = AvmCore::atomToXMLObject(arg);
Multiname m;
bool bFound = x->getQName (&m);
Atom parent = x->parent();
if (parent == undefinedAtom)
parent = nullObjectAtom;
XMLListObject *xl = XMLListObject::create(core->GetGC(), toplevel()->xmlListClass(), parent, bFound ? &m : 0);
xl->_append (arg);
return xl->atom();
}
else
{
Toplevel* toplevel = this->toplevel();
Stringp s = core->string(arg);
if (s->matchesLatin1("<>", 2, 0) && s->matchesLatin1("</>", 3, s->length()-3))
s = s->substr(2, s->length() - 5);
Namespace *defaultNamespace = toplevel->getDefaultNamespace();
// We handle this step in the XMLObject constructor to avoid concatenation huge strings together
// parentString = <parent xnlns=defaultNamespace> s </parent>
// 3. Parse parentString as a W3C element information info e
// 4. If the parse fails, throw a SyntaxError exception
// 5. x = toXML(e);
//StringBuffer parentString (core);
//parentString << "<parent xmlns=\"";
//parentString << defaultNamespace->getURI();
//parentString << "\">";
//parentString << s;
//parentString << "</parent>";
XMLObject *x = XMLObject::create(core->GetGC(), toplevel->xmlClass(), s, defaultNamespace);
XMLListObject *xl = XMLListObject::create(core->GetGC(), toplevel->xmlListClass());
for (uint32_t i = 0; i < x->getNode()->_length(); i++)
{
E4XNode *c = x->getNode()->_getAt (i);
c->setParent (NULL);
// [email protected] trying to emulate rhino behavior here
// Add the default namespace to our top element.
Namespace *ns = toplevel->getDefaultNamespace();
c->_addInScopeNamespace (core, ns, core->findPublicNamespace());
xl->_appendNode (c);
}
return xl->atom();
}
}