R: Re: How to use libxml++ to write a file in c ++ xml



Hi Kjell,
 now i can not  check my code, i remeber not to use

    Glib::ustring whole = document.write_to_string();
    Glib::ustring whole_formatted = document.write_to_string_formatted();

but only:

     document.write_to_file_formatted();

you can do a check to your code???

Thanks


>----Messaggio originale----
>Da: kjell ahlstedt bredband net
>Data: 31/01/2012 10.55
>A: "carlo esposito"<kevinstar libero it>
>Cc: <libxmlplusplus-list gnome org>
>Ogg: Re: How to use libxml++ to write a file in c ++ xml
>
>I made some tests with the attached program. The file written with
>   document.write_to_file_formatted("examplef.xml");
>looks like so
>
><?xml version="1.0" encoding="UTF-8"?>
><!DOCTYPE EXAMPLE SYSTEM "example.dtd" [
><!ENTITY xml "Extensible Markup Language">
>]>
><example>&xml;<example1>text1</example1><example2>text2</example2></example>
>
>When I replace
>   xmlpp::add_child_entity_reference(nodeRoot, "xml");
>by
>   nodeRoot->add_child_text("xml");
>the result is (I exclude the first four lines from now on)
>
><example>xml<example1>text1</example1><example2>text2</example2></example>
>
>When I instead delete
>   xmlpp::add_child_entity_reference(nodeRoot, "xml");
>the result is
>
><example>
><example1>text1</example1>
><example2>text2</example2>
></example>
>
>When I return to the origin test program and change xmlsave.c the way 
>you have done, the result is
>
><example>
>&xml;
><example1>text1</example1>
><example2>text2</example2>
></example>
>
>But you say that you get what you want, and you have said earlier that 
>you want
>
><example>
>&xml;
><example1>
>           text
></ example1>
><example2>
>           text
></ Example2>
></ example>
>
>If that's actually what you get, I'm surprised that our results are so 
>different. Is your test program very different from mine?
>
>Apart from that, I think you will have to make a more detailed 
>description in your bug 669028. The libxml people that will hopefully 
>read it may not follow conversations on libxmlplusplus-list.
>
>I also think that the behaviour of xmlNodeDumpOutputInternal() is 
>deliberate, and that it's done like that because formatting shall never 
>add characters that may be significant to the program that reads the 
>written xml file. After all xml files are not made primarily to be read 
>by humans, they are made to be read by computer programs.
>
>Kjell
>
>2012-01-30 21:05, carlo esposito skrev:
>>
>> I followed your tips Kiel,
>>
>> I downloaded the code of libxml2 vers. 2.6.26, and I changed into the 
>> module xmlsave.c, the method xmlNodeDumpOutputInternal.
>>
>> Tthe problem is related to the setting of the "format" parameter:
>>
>>
>> format = ctxt-> format;
>> if (format == 1)
>>
>>     {
>> tmp = cur-> children;
>> while (tmp! = NULL)
>>
>>               {
>> if ((tmp-> type == XML_TEXT_NODE) | |
>> (tmp-> type == XML_CDATA_SECTION_NODE))
>>
>>                      {
>> -------->>>>>>>>>> / / (Tmp-> type == XML_ENTITY_REF_NODE)) {
>> ctxt-> format = 0;
>> break;
>> }
>> tmp = tmp-> next;
>> }
>> }
>>
>> I commented out the line :
>>
>>
>> (Tmp-> type == XML_ENTITY_REF_NODE)
>>
>>
>>  and I compiled the libraryand installed, it seems that now everything 
>> is OK ........
>>
>>
>> What do you think?
>>
>
>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]