我正在尝试使用RapidXml解析.x3d文档。不幸的是,它只给出了任何节点属性的前100个字符。我查看了文档,看起来对属性值的长度没有任何限制。
我在Xcode中使用RapidXml;也许动态内存分配不适用于xcode编译器?有人遇到过这种情况么?有没有办法克服这个限制?
myfile.open(location.c_str(), std::ifstream::in);
if (myfile.is_open())
{
while ( myfile.good() )
{
getline (myfile,line);
text += line;
}
myfile.close();
}
text += "\0";
rapidxml::xml_document<> doc;
char *temp = new char[text.length() + 1];
strcpy(temp, text.c_str());
doc.parse<rapidxml::parse_no_data_nodes>(temp);
//why doesnt this work?
rapidxml::xml_node<>* root = doc.first_node();
rapidxml::xml_node<> *indexedfaceset = getChild(root, "IndexedFaceSet");
rapidxml::xml_attribute<> *indices = indexedfaceset->first_attribute("coordIndex");
rapidxml::xml_node<> *coordinate = getChild(indexedfaceset, "Coordinate");;
rapidxml::xml_attribute<> *coords = coordinate->first_attribute("point");
std::string indices_string = indices->value(); //gets cut off
int isize = indices->value_size(); //this is 108, although the string is longer
std::string coords_string = coords->value(); //gets cut off
int csize = indices->value_size(); //this is also 108, different size from indices
谢谢!