pugixml & declaration
От: Аноним  
Дата: 20.03.13 12:19
Оценка:
Начал осваивать pugixml

Что то ни как не пойму как получить доступ к атрибутам декларации такого вида:

pugi::xml_document doc;

doc.load("<?xml version=\"1.0\" encoding=\"utf-8\"> \
             <long xmlns=\"http://TEST/Z\">10000</long>");

std::cout << "version: " << doc.child("xml").attribute("version").as_float() << std::endl;


на выходе получаю 0

В доках что то не нашел ничего вразумительного по работе с декларацией. Или с декларацие работа как с child исключена?
Re: pugixml & declaration
От: uzhas Ниоткуда  
Дата: 20.03.13 12:29
Оценка:
Здравствуйте, Аноним, Вы писали:

А>В доках что то не нашел ничего вразумительного по работе с декларацией. Или с декларацие работа как с child исключена?


дока: http://pugixml.googlecode.com/svn/tags/latest/docs/manual/saving.html#manual.saving.declaration
цитата:

By default the declaration node is not added to the document during parsing. If you just need to preserve the original declaration node, you have to add the flag parse_declaration to the parsing flags; the resulting document will contain the original declaration node, which will be output during saving.

Re[2]: pugixml & declaration
От: Аноним  
Дата: 20.03.13 12:34
Оценка:
Здравствуйте, uzhas, Вы писали:

U>Здравствуйте, Аноним, Вы писали:


А>>В доках что то не нашел ничего вразумительного по работе с декларацией. Или с декларацие работа как с child исключена?


U>дока: http://pugixml.googlecode.com/svn/tags/latest/docs/manual/saving.html#manual.saving.declaration

U>цитата:
U>

U>By default the declaration node is not added to the document during parsing. If you just need to preserve the original declaration node, you have to add the flag parse_declaration to the parsing flags; the resulting document will contain the original declaration node, which will be output during saving.


я эт понял...но я то не save делаю. мне нужно обратную процедуру
Re[3]: pugixml & declaration
От: uzhas Ниоткуда  
Дата: 20.03.13 12:38
Оценка:
Здравствуйте, Аноним, Вы писали:

А>я эт понял..


плохо поняли, прочитайте цитату еще разок и внимательно почитайте режимы париснга документа
http://pugixml.googlecode.com/svn/tags/latest/docs/manual/loading.html#manual.loading.options
в частности:

parse_declaration determines if XML document declaration (node with type node_declaration) is to be put in DOM tree. If this flag is off, it is not put in the tree, but is still parsed and checked for correctness. This flag is off by default.

Re[4]: pugixml & declaration
От: Аноним  
Дата: 20.03.13 12:39
Оценка:
Здравствуйте, uzhas, Вы писали:

U>Здравствуйте, Аноним, Вы писали:


А>>я эт понял..


U>плохо поняли, прочитайте цитату еще разок и внимательно почитайте режимы париснга документа

U>http://pugixml.googlecode.com/svn/tags/latest/docs/manual/loading.html#manual.loading.options
U>в частности:
U>

U>parse_declaration determines if XML document declaration (node with type node_declaration) is to be put in DOM tree. If this flag is off, it is not put in the tree, but is still parsed and checked for correctness. This flag is off by default.



да — действительно плохо. спасибо
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.