我正在尝试使用 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
谢谢!