本文整理汇总了C++中xmlpp::TextReader::get_node_type方法的典型用法代码示例。如果您正苦于以下问题:C++ TextReader::get_node_type方法的具体用法?C++ TextReader::get_node_type怎么用?C++ TextReader::get_node_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlpp::TextReader
的用法示例。
在下文中一共展示了TextReader::get_node_type方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
PRUlayer::PRUlayer(xmlpp::TextReader &reader) {
if (reader.has_attributes()) {
reader.move_to_first_attribute();
do {
if (reader.get_name() == "id")
name = reader.get_value();
} while (reader.move_to_next_attribute());
reader.move_to_element();
}
while(reader.read()) {
string name = reader.get_name();
if ((reader.get_node_type() == xmlpp::TextReader::EndElement) &&
(name == "Layer"))
break;
if (reader.get_node_type() != xmlpp::TextReader::Element )
continue;
if (name == "StateVariable") {
if (reader.has_attributes()) {
reader.move_to_first_attribute();
do {
if (reader.get_name() == "id")
stateVariables.push_back(reader.get_value());
} while (reader.move_to_next_attribute());
reader.move_to_element();
}
} else if (name == "Action") {
modules.push_back(new PRUmodule(reader));
} else
std::cerr << "Unexpected tag " << name << "!" << std::endl;
} // while reader.read()
} // PRUlayer(reader)
示例2: buscarElemento
/*----------------------------------------------------------------------------*/
void XmlParser::buscarElemento(xmlpp::TextReader& reader)
{
int nodeType = (int)reader.get_node_type();
//Busca un nodo tipo Elemento.
while(nodeType!=1 && nodeType!=0)
{
reader.read();
nodeType = (int)reader.get_node_type();
}
}
示例3: if
PRUmodule::PRUmodule(xmlpp::TextReader &reader) {
if (reader.has_attributes()) {
reader.move_to_first_attribute();
do {
if (reader.get_name() == "id")
actionName = reader.get_value();
} while (reader.move_to_next_attribute());
reader.move_to_element();
}
while(reader.read()) {
string name = reader.get_name();
if ((reader.get_node_type() == xmlpp::TextReader::EndElement) &&
(name == "Action"))
break;
if (reader.get_node_type() != xmlpp::TextReader::Element )
continue;
if (name == "Parameter") {
string pName = "";
string pDom = "";
if (reader.has_attributes()) {
reader.move_to_first_attribute();
do {
if (reader.get_name() == "id")
pName = reader.get_value();
else if (reader.get_name() == "domain")
pDom = reader.get_value();
} while (reader.move_to_next_attribute());
reader.move_to_element();
}
if (pName == "")
throw "Parameter with no name!";
domain_type dom;
if (pDom != "") {
if (PRUplus::actionsDomain[pDom].empty())
std::cerr << "Empty action domain: " << pDom << std::endl;
else for (domain_type::const_iterator it=PRUplus::actionsDomain[pDom].begin();
it!=PRUplus::actionsDomain[pDom].end(); ++it){
dom.insert(*it);
}
}
if (reader.has_value())
dom.insert(reader.get_value());
else
readVector(dom,reader);
parameters[pName] = dom;
domains[pName] = pDom;
} else if (name == "Outcome") {
outcomes.push_back(new PRUoutcome(reader));
} else
std::cerr << "Unexpected tag " << name << "!" << std::endl;
} // while reader.read()
} // PRUmodule(reader)
示例4: read_skip_comment
inline void read_skip_comment(xmlpp::TextReader &reader)
{
const int line = xml_line(reader.get_current_node());
do
{
if(!reader.read())
throw xml_eof(line);
}
while(reader.get_node_type() == xmlpp::TextReader::Comment);
}
示例5: readXML
void PRUplus::readXML(xmlpp::TextReader &reader) {
while(reader.read()) {
string name = reader.get_name();
if ((reader.get_node_type() == xmlpp::TextReader::EndElement) &&
(name == "pru"))
break;
if (reader.get_node_type() != xmlpp::TextReader::Element )
continue;
if (name == "pru") {
} else if (name == "Start") {
} else if (name == "SVU")
readVector(stateVariablesInitialAssignments, reader);
else if (name == "Next")
readVector(firstEnabledModules, reader, "\n ");
else if (name == "Layer")
layers.push_back(new PRUlayer(reader));
else if (name == "Constraint")
constraints.push_back(new PRUconstraint(reader));
else
std::cerr << "Unexpected tag " << name << "!" << std::endl;
} // while reader.read()
} // PRUplus(reader)
示例6: xml_read
void polyline_road::xml_read(xmlpp::TextReader &reader, const vec3f &scale)
{
assert(is_opening_element(reader, "line_rep"));
read_to_open(reader, "points");
std::cout<<"abcd"<<std::endl;
do
{
read_skip_comment(reader);
if(reader.get_node_type() == xmlpp::TextReader::Text ||
reader.get_node_type() == xmlpp::TextReader::SignificantWhitespace)
{
//std::cout<<"BE CAREFUL, NEED TEST! (hwm_xml_read.cpp)"<<std::endl;
std::string res(reader.get_value());
std::stringstream s1(res);
std::string line;
while(getline(s1, line, '\n')) {
std::istringstream s2(line);
vec3f pos;
s2 >> pos[0];
s2 >> pos[1];
s2 >> pos[2];
if((std::abs(pos[0] - 0) < 1e-6 && std::abs(pos[1] - 0) < 1e-6 && std::abs(pos[2] - 0) < 1e-6))
continue;
points_.push_back(vec3f(pos*scale));
}
}
}
while(!is_closing_element(reader, "points"));
if(!initialize())
throw xml_error(reader, "Failed to initialize polyine");
read_to_close(reader, "line_rep");
}