本文整理汇总了C++中IPropertyTree::queryBranch方法的典型用法代码示例。如果您正苦于以下问题:C++ IPropertyTree::queryBranch方法的具体用法?C++ IPropertyTree::queryBranch怎么用?C++ IPropertyTree::queryBranch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyTree
的用法示例。
在下文中一共展示了IPropertyTree::queryBranch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: genRoxieMessage
void MessageGenerator::genRoxieMessage(const char* templatemsg, StringBuffer& message)
{
Owned<IPropertyTree> tmplat;
StringBuffer root;
if (templatemsg)
{
tmplat.setown(createPTreeFromXMLString(templatemsg));
if(!tmplat.get())
throw MakeStringException(-1, "can't generate property tree from input, please make sure it's valid xml.");
root = tmplat->queryName();
tmplat.setown(tmplat->getPropTree(VStringBuffer("//Results/Result")));
if (!tmplat.get())
throw MakeStringException(-1, "can't find Results/Result in input XML");
}
else
root = "Unknown"; // TODO: find out the root?
message.appendf("<!-- <%s> --> %s", root.str(), LT);
message.appendf(" <!-- <Results> --> %s", LT);
message.appendf(" <Result>%s", LT);
Owned<IPropertyTreeIterator> it = m_roxieSchemaRoot->getElements(VStringBuffer("XmlSchema"));
for (it->first(); it->isValid(); it->next())
{
IPropertyTree* ds = &it->query();
const char* name = ds->queryProp("@name");
if (!name)
{
ERRLOG("XmlSchema without name");
continue;
}
IPropertyTree* p = ds->queryBranch(VStringBuffer("%s:schema", xsdNs()));
m_schemaTree.setown(LINK(p));
IXmlSchema* xs = createXmlSchemaFromPTree(m_schemaTree);
IXmlType* type = xs->queryElementType("Dataset");
if (!type)
{
ERRLOG("Can not find type '%s'", name);
continue;
}
// get the Row type
type = type->queryFieldType(0);
if (!type)
{
ERRLOG("The root element for %s is not an array", name);
continue;
}
IPropertyTree* dsTmplat = tmplat.get() ? tmplat->queryPropTree(VStringBuffer("Dataset[@name='%s']",name)) : NULL;
if (dsTmplat && dsTmplat->numChildren()>0)
{
message.appendf(" <Dataset name=\"%s\">%s", name, LT);
Owned<IPropertyTreeIterator> row = dsTmplat->getElements("Row");
for (row->first(); row->isValid(); row->next())
{
message.appendf(" <Row>%s", LT);
StringStack parent;
doType(parent,5,"Row",type, &row->query(), message);
message.appendf(" </Row>%s", LT);
}
message.appendf(" </Dataset>%s", LT);
}
else if (m_genAllDatasets)
{
message.appendf(" <Dataset name=\"%s\">%s", name, LT);
for (int i=0; i < m_items; i++)
{
message.appendf(" <Row>%s", LT);
StringStack parent;
doType(parent,6,"Row",type,message);
message.appendf(" </Row>%s", LT);
}
if (m_ecl2esp)
message.appendf(" <Row/>%s", LT);
message.appendf(" </Dataset>%s", LT);
}
}
message.appendf(" </Result>%s", LT);
message.appendf(" <!-- </Results> --> %s", LT);
message.appendf("<!-- </%s> --> %s", root.str(), LT);
}