/** Handle start tag */ static void handle_starttag( PPOS* ppos ) { XML_NODE* node; char* name; assert(ppos != NULL); if ((name = get_name(ppos)) == NULL) { xml_error(ppos, "Missing name in tagstart"); ppos->state = STATE_ERROR; } else { if (NULL == (node = xml_new_node(name, ppos->lineno))) { xml_error(ppos, "Can't create new node"); ppos->state = STATE_ERROR; } else { xml_append_child(top_pstack(ppos), node); if ( push_pstack(ppos, node) ) ppos->state = STATE_IN_TAG; else ppos->state = STATE_ERROR; } BMSfreeMemoryArray(&name); } }
/** * nmp_get_node: parse an XML in-memory document and build a tree. * * @doc: input, a pointer to document tree * @xpath: input, addressing parts of an XML document * @return: the resulting document tree, else NULL */ xmlXPathObjectPtr nmp_get_node(xmlDocPtr doc, const xmlChar *xpath) { xmlXPathContextPtr context; xmlXPathObjectPtr result; context = xmlXPathNewContext(doc); if (context == NULL) { xml_error("context is NULL\n"); return NULL; } result = xmlXPathEvalExpression(xpath, context); xmlXPathFreeContext(context); if (result == NULL) { xml_error("xmlXPathEvalExpression return NULL\n"); return NULL; } if (xmlXPathNodeSetIsEmpty(result->nodesetval)) { xmlXPathFreeObject(result); xml_error("nodeset is empty\n"); return NULL; } return result; }
// Attempt to parse the content of the node as a bounded integer // returning the result or throwing. long parse_integer(xml_node<>* node, std::string description, long min_value, long max_value) { // Node must be non-NULL - caller should check for this prior to calling // this method. assert(node != NULL); const char* nptr = node->value(); char* endptr = NULL; long int n = strtol(nptr, &endptr, 10); if ((*nptr == '\0') || (*endptr != '\0')) { throw xml_error("Can't parse " + description + " as integer"); } if ((n < min_value) || (n > max_value)) { throw xml_error(description + " out of allowable range " + std::to_string(min_value) + ".." + std::to_string(max_value)); } return n; }
bool is_valid() { if (!m_type) throw xml_error("Missing 'type' attribute in Relation member"); if (!m_ref) throw xml_error("Missing 'ref' attribute in Relation member"); return (m_ref && m_type); }
/** * nmp_parse_xml: process XML document tree * * @doc: iutput, XML document tree * @seq: input, sequence of message * @return: succeed NmpMsgInfo, else NULL */ NmpMsgInfo * nmp_parse_xml(NmpCmdType *self, xmlDocPtr doc, unsigned int seq) { xmlNodePtr cur; char *cmd; char msg_id[MAX_CMD_ID_LEN]={0}; NmpParseXml parse_xml; NmpMsgInfo *sys_msg; int i; cur = xmlDocGetRootElement(doc); //确定文档根元素 if (cur == NULL) { xml_error("empty document\n"); return NULL; } while ( cur && xmlIsBlankNode ( cur ) ) { cur = cur->next; } while (cur != NULL) { if (!xmlStrcmp(cur->name, (const xmlChar *) "message")) { cmd = (char *)xmlGetProp(cur, (const xmlChar *)"type"); xml_error("1---parse cmd =%s\n",cmd); if (!cmd) { return NULL; } msg_id[MAX_CMD_ID_LEN - 1] = 0; strncpy(msg_id, cmd, MAX_CMD_ID_LEN - 1); xmlFree(cmd); for (i = 0; i < CMD_TYPE_COUNTS(self); i++) { if (!CMD_CMP(msg_id,GET_CMD_BYINDEX(self,i))) continue; parse_xml = GET_PARSE_XML_BYINDEX(self,i); sys_msg = (*parse_xml)(doc, cur, msg_id); // invoke function to parse return sys_msg; } } cur = cur->next; while ( cur && xmlIsBlankNode ( cur ) ) { cur = cur->next; } } xml_error(" message not exists \n"); return NULL; }
/* OS_ReadXML v0.1 * Read a XML file and generate the necessary structs. */ int OS_ReadXML(const char *file, OS_XML *_lxml) { int r; unsigned int i; FILE *fp; /* init xml strcuture */ _lxml->cur = 0; _lxml->fol = 0; _lxml->el = NULL; _lxml->ct = NULL; _lxml->tp = NULL; _lxml->rl = NULL; _lxml->ck = NULL; _lxml->ln = NULL; _lxml->err_line = 0; memset(_lxml->err,'\0',XML_ERR_LENGTH); fp = fopen(file,"r"); if(!fp) { xml_error(_lxml, "XMLERR: File '%s' not found.",file); return(-2); } /* Zeroing the line */ _line = 1; if((r = _ReadElem(fp,0,_lxml)) < 0) /* First position */ { if(r != LEOF) { fclose(fp); return(-1); } } for(i=0;i<_lxml->cur;i++) { if(_lxml->ck[i] == 0) { xml_error(_lxml,"XMLERR: Element '%s' not closed.", _lxml->el[i]); fclose(fp); return(-1); } } fclose(fp); return(0); }
void prepare_xml_file (char *filename) { int rc; rc = xml_load_file (& xml_root, PATH, filename, FALSE); if (rc == XML_NOERROR) { xml_source = xml_first_child (xml_root); if (xml_source) { xml_put_attr (xml_switches, "filename", filename); xml_put_attr (xml_switches, "template", "1"); } else xml_free (xml_root); } else { coprintf ("%s E: Error processing %s...", me, filename); coprintf (xml_error ()); raise_exception (anomaly_event); } }
/** * nmp_create_xml: generate XML docment tree according to command type and * its parameter * * @doc: output, a pointer to document tree * @sys_msg: input, struct, system message information * @return: succeed 0, else -1 */ int nmp_create_xml(NmpCmdType *self, xmlDocPtr doc, NmpMsgInfo *sys_msg) { NmpCreateXml create_xml; int i,ret; for (i = 0; i < CMD_TYPE_COUNTS(self); i++) { if (!CMD_CMP(sys_msg->msg_id,GET_CMD_BYINDEX(self,i))) continue; create_xml = GET_CREATE_XML_BYINDEX(self,i); if(create_xml) { ret = (*create_xml)(doc, sys_msg); if(ret < 0) { xml_error("create xml error, no:%d \n", ret); return ret; } } else return -E_NOXMLFUN; return 0; } return -E_NOXMLFUN; }
/** Skip comment * * Return FALSE if an error occurs. */ static int do_comment( PPOS* ppos ) { int result = TRUE; int c; int state = 0; assert(ppos != NULL); for(;;) { c = getsymbol(ppos); if (c == EOF) break; if ((c == '>') && (state >= 2)) break; state = (c == '-') ? state + 1 : 0; } if (c == EOF) { xml_error(ppos, "Unexpected EOF in comment"); result = FALSE; } return result; }
/** remove top element from stack and deletes it * * TRUE if ok, FALSE otherwise */ static XML_Bool pop_pstack( PPOS* ppos /**< input stream position */ ) { PSTACK* p; int result; assert(ppos != NULL); if (ppos->top == NULL) { xml_error(ppos, "Stack underflow"); result = FALSE; } else { result = TRUE; p = ppos->top; ppos->top = p->next; debugMessage("Poping %s\n", p->node->name); BMSfreeMemory(&p); } return result; }
/** Parse input stream */ static XML_Bool xml_parse( PPOS* ppos /**< input stream position */ ) { XML_Bool ok = TRUE; while (ok) { debugMessage("state=%d\n", ppos->state); switch (ppos->state) { case STATE_BEFORE : proc_before(ppos); break; case STATE_IN_TAG : proc_in_tag(ppos); break; case STATE_PCDATA : proc_pcdata(ppos); break; case STATE_EOF : ok = FALSE; break; case STATE_ERROR : ok = FALSE; break; default : xml_error(ppos, "Internal Error, illegal state"); ok = FALSE; } } return (ppos->state == STATE_EOF); }
/** Read the value of an attribute from the input stream. * * The value has to be between two " or ' (the other character is then valid as well). The function * returns a pointer to allocated memory containing the value or it returns NULL in case of an * error. */ static char* get_attrval( PPOS* ppos ) { char* attr = NULL; int c; int stop; size_t len = 0; size_t size = 0; assert(ppos != NULL); /* The following is not allowed according to the specification (the value has to be directly * after the equation sign). */ c = skip_space(ppos); if ((c != '"') && (c != '\'')) { xml_error(ppos, "Atribute value does not start with \" or \'"); return NULL; } stop = c; for(;;) { if (len == size) { size += ATTR_EXT_SIZE; if ( attr == NULL ) { ALLOC_ABORT( BMSallocMemoryArray(&attr, size) ); } else { ALLOC_ABORT( BMSreallocMemoryArray(&attr, size) ); } } assert(attr != NULL); assert(size > len); c = getsymbol(ppos); if ((c == stop) || (c == EOF)) break; attr[len++] = (char)c; } if (c != EOF) attr[len] = '\0'; else { BMSfreeMemoryArray(&attr); attr = NULL; } return attr; }
/** Get name of a TAG or attribute from the input stream. * * Either it returns a pointer to allocated memory which contains the name or it returns NULL if * there is some error. */ static char* get_name( PPOS* ppos ) { char* name = NULL; size_t size = 0; size_t len = 0; int c; assert(ppos != NULL); c = getsymbol(ppos); if (!isalpha(c) && (c != '_') && (c != ':')) { xml_error(ppos, "Name starting with illegal charater"); return NULL; } /* The following is wrong: Here almost all characters that we casted to unicode are feasible */ while (isalnum(c) || (c == '_') || (c == ':') || (c == '.') || (c == '-')) { if (len + 1 >= size) { size += NAME_EXT_SIZE; if ( name == NULL ) { ALLOC_ABORT( BMSallocMemoryArray(&name, size) ); } else { ALLOC_ABORT( BMSreallocMemoryArray(&name, size) ); } } assert(name != NULL); assert(size > len); name[len++] = (char)c; c = getsymbol(ppos); } if (c != EOF) ungetsymbol(ppos, c); assert(name != NULL); if (len == 0) { BMSfreeMemoryArray(&name); name = NULL; } else name[len] = '\0'; return name; }
void set_role(const char *role) { if (unicode_strlen(role) > 255) { throw xml_error( "Relation Role has more than 255 unicode characters"); } m_role = std::string(role); }
/** * nmp_get_message_type: parse an XML in-memory document and build a tree. * * @xml_buff: input, pointer of xml text buffer * @xml_len: input, xml text buffer length * @message_type: output, contain message type ( command id ) * @return: succeed 0, else -1 */ int nmp_get_message_type( const char *xml_buff, int xml_len, char *message_type ) { xmlDocPtr doc; xmlNodePtr cur; char *cmd; ASSERT(message_type != NULL); doc = xmlParseMemory(xml_buff, xml_len); //doc = xmlParseDoc(&xml_buff); if (doc == NULL ) { xml_error("Document not parsed successfully. \n"); return -1; } cur = xmlDocGetRootElement(doc); //确定文档根元素 if (cur == NULL) { xml_error("empty document\n"); xmlFreeDoc(doc); return -1; } while (cur != NULL) { if (!xmlStrcmp(cur->name, (const xmlChar *) "message")) { cmd = (char *)xmlGetProp(cur, (const xmlChar *)"type"); if ((message_type != NULL)&&(cmd != NULL)) memcpy(message_type,cmd,strlen(cmd)); xmlFree(cmd); xmlFreeDoc(doc); return 0; } cur = cur->next; } xmlFreeDoc(doc); return -1; }
void set_ref(const char *ref) { osm_nwr_signed_id_t _ref = 0; try { _ref = std::stol(ref); } catch (std::invalid_argument &e) { throw xml_error("Relation member 'ref' attribute is not numeric"); } catch (std::out_of_range &e) { throw xml_error( "Relation member 'ref' attribute value is too large"); } if (_ref == 0) { throw xml_error("Relation member 'ref' attribute may not be 0"); } m_ref = _ref; }
/** Checks for next tag */ static void proc_before( PPOS* ppos /**< input stream position */ ) { int c; assert(ppos != NULL); assert(ppos->state == STATE_BEFORE); c = skip_space(ppos); if (c != '<') { xml_error(ppos, "Expecting '<'"); ppos->state = STATE_ERROR; } else { c = getsymbol(ppos); switch(c) { case EOF : xml_error(ppos, "Unexpected EOF"); ppos->state = STATE_ERROR; break; case '!' : handle_decl(ppos); break; case '?' : handle_pi(ppos); break; case '/' : handle_endtag(ppos); break; default : ungetsymbol(ppos, c); handle_starttag(ppos); break; } } }
/// Parse an xs:boolean value. bool parse_bool(xml_node<>* node, std::string description) { if (!node) { throw xml_error("Missing mandatory value for " + description); } const char* nptr = node->value(); return ((strcmp("true", nptr) == 0) || (strcmp("1", nptr) == 0)); }
MODULE load_ddns_services_list (THREAD *thread) { char *filename; filename = CONFIG ("ddns:filename"); services = NULL; switch (xml_load_file (&services, "PATH", filename, FALSE)) { case XML_FILEERROR: sendfmt (&operq, "ERROR", "xiddns: cannot read '%s': %s", filename, xml_error ()); raise_exception (exception_event); break; case XML_LOADERROR: sendfmt (&operq, "ERROR", "xiddns: error in '%s': %s", filename, xml_error ()); raise_exception (exception_event); break; } }
/** Handle end tag */ static void handle_endtag( PPOS* ppos ) { char* name; int c; assert(ppos != NULL); if ((name = get_name(ppos)) == NULL) xml_error(ppos, "Missing name in endtag"); else { c = skip_space(ppos); if (c != '>') { xml_error(ppos, "Missing '>' in endtag"); ppos->state = STATE_ERROR; } else { if (strcmp(name, top_pstack(ppos)->name)) { xml_error(ppos, "Name of endtag does not match starttag"); ppos->state = STATE_ERROR; } else { if ( pop_pstack(ppos) ) ppos->state = STATE_PCDATA; else ppos->state = STATE_ERROR; } BMSfreeMemoryArray(&name); } } }
/** * nmp_add_new_node: add a new node * * @xml_in: input, pointer of xml text buffer * @len_in: iutput, xml text buffer length * @xml_out: output, pointer of buffer block, containing xml text * after deleting a node * @len_out: output, indicate buffer length of xml_out * @xpath: addressing parts of an XML document * @node_name: node name * @node_cont: node content * @return: succeed 0, else -1 */ int nmp_add_new_node( const char *xml_in, int len_in, xmlChar *xml_out, int *len_out, xmlChar *xpath, xmlChar *node_name, xmlChar *node_cont ) { ASSERT(xml_in != NULL && xml_out!= NULL && xpath != NULL); xmlDocPtr doc; xmlNodePtr node; xmlXPathObjectPtr app_result; int node_num;; xmlChar *xml_buffer; doc = xmlParseMemory(xml_in, len_in); //doc = xmlParseDoc(&xml_buff); if (doc == NULL ) { xml_error("Document not parsed successfully. \n"); return -1; } app_result = nmp_get_node(doc, (const xmlChar *)xpath); if (app_result == NULL) goto end; if (app_result) { xmlNodeSetPtr nodeset = app_result->nodesetval; node_num = nodeset->nodeNr - 1; node = xmlNewNode(NULL, BAD_CAST node_name); xmlNodeSetContent(node, (const xmlChar *)node_cont); xmlAddNextSibling ( nodeset->nodeTab[node_num],node); xmlSaveFormatFileEnc("-", doc, ECODE_UFT8, 1); xmlDocDumpMemoryEnc(doc, &xml_buffer, len_out,ECODE_UFT8); xml_debug("xml_buffer=%s\n", xml_buffer); memcpy(xml_out,xml_buffer,*len_out); xmlFree(xml_buffer); xmlXPathFreeObject(app_result); } end: xmlFreeDoc(doc); return 0; }
void set_type(const char *type) { std::string t = std::string(type); if (boost::iequals(t, "Node")) m_type = "Node"; else if (boost::iequals(t, "Way")) m_type = "Way"; else if (boost::iequals(t, "Relation")) m_type = "Relation"; else throw xml_error( (boost::format("Invalid type %1% in member relation") % type).str()); }
/** * nmp_get_node_content: parse an XML in-memory document and get a * node content. * * @xml_buf: input, pointer of xml text buffer * @xml_len: input, xml text buffer length * @xpath: input, addressing parts of an XML document * @value_num output, indicate node number in array node_value * @node_value output, * @return: succeed 0, else -1 */ int nmp_get_node_content( const char *xml_buff, int xml_len, xmlChar *xpath, int *value_num, xmlChar node_value[][MAX_CMD_ID_LEN] ) { ASSERT(value_num != NULL); xmlDocPtr doc; xmlChar *value; xmlXPathObjectPtr app_result; int i; doc = xmlParseMemory(xml_buff, xml_len); //doc = xmlParseDoc(&xml_buff); if (doc == NULL ) { xml_error("Document not parsed successfully. \n"); return -1; } app_result = nmp_get_node(doc, (const xmlChar *)xpath); if (app_result == NULL) return 0; if (app_result) { xmlNodeSetPtr nodeset = app_result->nodesetval; *value_num = nodeset->nodeNr; for (i=0; i < nodeset->nodeNr; i++) { value = xmlNodeGetContent(nodeset->nodeTab[i]); if (value == NULL) { xml_warning("value is NULL\n"); continue; } memcpy(node_value[i],value,NODE_VALUE_LEN); xmlFree(value); } xmlXPathFreeObject(app_result); } xmlFreeDoc(doc); return 0; }
/** * nmp_parse_xml_file: open XML file and process it * * @filename: iutput, XML filename * @seq: input, sequence of message * @return: succeed NmpMsgInfo, else NULL */ NmpMsgInfo * nmp_parse_xml_file(NmpCmdType *self, char *filename, unsigned int seq) { xmlDocPtr doc; NmpMsgInfo *sys_msg; doc = xmlReadFile(filename,"UTF-8",XML_PARSE_NOBLANKS); //doc = xmlParseFile(filename); if (doc == NULL ) { xml_error("Document not parsed successfully. \n"); return NULL; } sys_msg = nmp_parse_xml(self, doc, seq); if(!sys_msg) { xml_error("parse xml fail!\n"); } xmlFreeDoc(doc); return sys_msg; }
/** * nmp_parse_xml_str: process XML text existing in memory buffer * * @xml_buf: iutput, memory address used to contain xml text * @xml_len: iutput, indicate length of xmf_buf, unit bytes * @seq: input, sequence of message * @return: succeed NmpMsgInfo, else NULL */ NmpMsgInfo * nmp_parse_xml_str(NmpCmdType *self, const char *xml_buff, int xml_len, unsigned int seq) { xmlDocPtr doc; NmpMsgInfo *sys_msg; // xml_error("--------------=======xml_buff=%s\n",xml_buff); doc = xmlParseMemory(xml_buff, xml_len); if (doc == NULL ) { xml_error("Document not parsed successfully. \n"); return NULL; } sys_msg = nmp_parse_xml(self, doc, seq); if(!sys_msg) { xml_error("parse xml fail!\n"); } xmlFreeDoc(doc); return sys_msg; }
/** * nmp_modify_attr_value: modify attribute's value in XML document * * @xml_in: input, pointer of xml text buffer * @len_in: iutput, xml text buffer length * @xml_out: output, pointer of buffer block, containing xml text * after modifying attribute value * @len_out: output, indicate buffer length of xml_out * @xpath: addressing parts of an XML document * @attribute: XML element attribute * @attr_value: value of a specific attribute in XML document * @return: succeed 0, else -1 */ int nmp_modify_attr_value( const char *xml_in, int len_in, xmlChar *xml_out, int *len_out, xmlChar *xpath, xmlChar *attribute, xmlChar *attr_value ) { ASSERT(xml_out != NULL && attribute!=NULL && attr_value!= NULL); xmlDocPtr doc; xmlXPathObjectPtr app_result; int node_num;; xmlChar *xml_buffer; doc = xmlParseMemory(xml_in, len_in); //doc = xmlParseDoc(&xml_buff); if (doc == NULL ) { xml_error("Document not parsed successfully. \n"); return -1; } app_result = nmp_get_node(doc, (const xmlChar *)xpath); if (app_result == NULL) { goto end; } if (app_result) { xmlNodeSetPtr nodeset = app_result->nodesetval; //*value_num = nodeset->nodeNr; xml_debug(" nodeset->nodeNr=%d\n", nodeset->nodeNr); node_num = nodeset->nodeNr - 1; xmlSetProp(nodeset->nodeTab[0], BAD_CAST attribute, BAD_CAST attr_value); xmlSaveFormatFileEnc("-", doc, ECODE_UFT8, 1); xmlDocDumpMemoryEnc(doc, &xml_buffer, len_out,ECODE_UFT8); memcpy(xml_out, xml_buffer, *len_out); xmlFree(xml_buffer); xmlXPathFreeObject(app_result); } end: xmlFreeDoc(doc); return 0; }
/** * nmp_get_node_attr_value: get value of an attribute * * @xml_buf: input, pointer of xml text buffer * @xml_len: input, xml text buffer length * @xpath: input, addressing parts of an XML document * @attribute: input, attribute * @attr_value: output, attribute value * @return: succeed 0, else -1 */ int nmp_get_node_attr_value( const char *xml_buff, int xml_len, xmlChar *xpath, xmlChar *attribute, xmlChar *attr_value ) { ASSERT((xml_buff != NULL) && (xpath!=NULL) && (attribute != NULL) && (attr_value != NULL)); xmlDocPtr doc; char *cmd; xmlXPathObjectPtr app_result; int i; doc = xmlParseMemory(xml_buff, xml_len); //doc = xmlParseDoc(&xml_buff); if (doc == NULL ) { xml_error("Document not parsed successfully. \n"); return -1; } app_result = nmp_get_node(doc, (const xmlChar *)xpath); if (app_result == NULL) goto end; if (app_result) { xmlNodeSetPtr nodeset = app_result->nodesetval; //*value_num = nodeset->nodeNr; xml_debug(" nodeset->nodeNr=%d\n", nodeset->nodeNr); for (i=0; i < nodeset->nodeNr; i++) { cmd = (char *)xmlGetProp(nodeset->nodeTab[i], (const xmlChar *)attribute); xml_debug("cmd type =%s\n",cmd); memcpy(attr_value,cmd,strlen(cmd)); xml_debug("attr_value type =%s\n",attr_value); xmlFree(cmd); } xmlXPathFreeObject(app_result); } end: xmlFreeDoc(doc); return 0; }
int main (int argc, char *argv []) { XML_ITEM *root; root = xml_new (NULL, "root", ""); if (xml_load_file (&root, ".", argv[1], FALSE) == 0) { xml_save_string (root); xml_save_file (root, "testxml.txt"); xml_free (root); } else printf ("Load error: %s\n", xml_error ()); return (EXIT_SUCCESS); }
/** * nmp_del_node: delete a node from XML text * * @xml_in: input, pointer of xml text buffer * @len_in: iutput, xml text buffer length * @xml_out: output, pointer of buffer block, containing xml text * after deleting a node * @len_out: output, indicate buffer length of xml_out * @xpath: addressing parts of an XML document * @return: succeed 0, else -1 */ int nmp_del_node( const char *xml_in, int len_in, xmlChar *xml_out, int *len_out, xmlChar *xpath ) { ASSERT(xml_out != NULL); xmlDocPtr doc; xmlXPathObjectPtr app_result; int node_num;; xmlChar *xml_buffer; doc = xmlParseMemory(xml_in, len_in); //doc = xmlParseDoc(&xml_buff); if (doc == NULL ) { xml_error("Document not parsed successfully. \n"); return -1; } app_result = nmp_get_node(doc, (const xmlChar *)xpath); if (app_result == NULL) goto end; if (app_result) { xmlNodeSetPtr nodeset = app_result->nodesetval; node_num = nodeset->nodeNr - 1; xmlUnlinkNode(nodeset->nodeTab[node_num]); xmlFreeNode(nodeset->nodeTab[node_num]); xmlSaveFormatFileEnc("-", doc, ECODE_UFT8, 1); xmlDocDumpMemoryEnc(doc, &xml_buffer, len_out,ECODE_UFT8); memcpy(xml_out, xml_buffer, *len_out); xmlFree(xml_buffer); xmlXPathFreeObject(app_result); } end: xmlFreeDoc(doc); return 0; }
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"); }