<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=134136&amp;view=findpost&amp;p=1027969</guid>
        <pubDate>Mon, 27 Feb 2006 10:59:26 +0000</pubDate>
        <title>Формирование XML</title>
        <link>https://forum.sources.ru/index.php?showtopic=134136&amp;view=findpost&amp;p=1027969</link>
        <description><![CDATA[Magistr: Конвертируй его с помощью iconv<br>Или ещё лучше используй DOM.]]></description>
        <author>Magistr</author>
        <category>XML, XSL, XSLT</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=134136&amp;view=findpost&amp;p=1027966</guid>
        <pubDate>Mon, 27 Feb 2006 10:56:49 +0000</pubDate>
        <title>Формирование XML</title>
        <link>https://forum.sources.ru/index.php?showtopic=134136&amp;view=findpost&amp;p=1027966</link>
        <description><![CDATA[gnumus: У DomDocument есть атрибут encoding  :unsure: <br>Как вариант - можешь перекодировать свой 1251 в UTF-8: http://www.php.net/manual/en/ref.iconv.php]]></description>
        <author>gnumus</author>
        <category>XML, XSL, XSLT</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=134136&amp;view=findpost&amp;p=1027052</guid>
        <pubDate>Sun, 26 Feb 2006 11:25:36 +0000</pubDate>
        <title>Формирование XML</title>
        <link>https://forum.sources.ru/index.php?showtopic=134136&amp;view=findpost&amp;p=1027052</link>
        <description><![CDATA[Полный песец: <div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;&nbsp; &nbsp;//Building xml document...</div><div class="code_line">&nbsp;&nbsp; &nbsp;$xml_doc= new_xmldoc(&quot;1.0&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;$xml_root= $xml_doc-&#62;add_root(&quot;forums&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp;foreach($xfr_forums as $xfr_forums_id){</div><div class="code_line">&nbsp;&nbsp; &nbsp; $xml_forum=$xml_root-&#62;new_child(&quot;forum&quot;,&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; $xml_forum-&#62;set_attribute(&quot;id&quot;,$xfr_forums_id);</div><div class="code_line">&nbsp;&nbsp; &nbsp; $xml_topics=$xml_forum-&#62;new_child(&quot;topics&quot;,&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; foreach($xfr_topics as $xfr_topics_list){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;if($xfr_forums_id== $xfr_topics_list[&#39;forum_id&#39;]){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; $xml_topic=$xml_topics-&#62;new_child(&quot;topic&quot;,&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; $xml_topic-&#62;set_attribute(&quot;id&quot;,$xfr_topics_list[&#39;tid&#39;]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; $xml_topic-&#62;set_attribute(&quot;topic_name&quot;,$xfr_topics_list[&#39;title&#39;]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; $xml_topic-&#62;set_attribute(&quot;topic_desc&quot;,$xfr_topics_list[&#39;description&#39;]);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; $xml_posts=$xml_topic-&#62;new_child(&quot;posts&quot;,&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; foreach($xfr_posts as $xfr_posts_list){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if($xfr_topics_list[&#39;tid&#39;]==$xfr_posts_list[&#39;topic_id&#39;]){</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $xml_post=$xml_posts-&#62;new_child(&quot;post&quot;,&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $xml_post-&#62;set_attribute(&quot;id&quot;,$xfr_posts_list[&#39;pid&#39;]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $xml_post-&#62;set_attribute(&quot;post_uid&quot;,$xfr_posts_list[&#39;author_id&#39;]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $xml_post-&#62;set_attribute(&quot;post_user_name&quot;,$xfr_posts_list[&#39;author_name&#39;]); </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $xml_post-&#62;set_attribute(&quot;post_date&quot;,$xfr_posts_list[&#39;post_date&#39;]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $xml_post-&#62;set_attribute(&quot;post_edit_time&quot;,$xfr_posts_list[&#39;edit_time&#39;]);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $xml_post-&#62;set_attribute(&quot;post_smile&quot;,$xfr_posts_list[&#39;icon_id&#39;]); </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $xml_post-&#62;new_child(&quot;post_content&quot;,&quot;\&quot;&quot;.$xfr_posts_list[&#39;post&#39;].&quot;\&quot;&quot;);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; }</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; }</div><div class="code_line">&nbsp;&nbsp; &nbsp;} </div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;if($XFR_CONFIG[&#39;GzCompress&#39;]==1)</div><div class="code_line">&nbsp;&nbsp; &nbsp; print gzcompress($xml_doc-&#62;dumpmem(),$XFR_CONFIG[&#39;GzCompressLevel&#39;]);</div><div class="code_line">&nbsp;&nbsp; &nbsp;else</div><div class="code_line">&nbsp;&nbsp; &nbsp; print $xml_doc-&#62;dumpmem();</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
Данные выбираются из MySQL (что, в прочем, не важно) в кодировке windows-1251<br>
1. При выводе документа вместо русских символов выводиться фигня (Насколько я понимаю функция dumpmem пытается вывести текст в UTF-8), чего я очень не хочу. Как заставить формировать документ в windows-1251?<br>
2. Вторая проблема вытикает из первой: пары символов вместе с &#39;&amp;&#39; в xml тегах вызывают ошибку интерпретации xml документа. :wall:]]></description>
        <author>Полный песец</author>
        <category>XML, XSL, XSLT</category>
      </item>
	
      </channel>
      </rss>
	