<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Biggle&#039;s Blog &#187; XML</title>
	<atom:link href="http://www.biggle.de/blog/category/markup/xml-markup/feed" rel="self" type="application/rss+xml" />
	<link>http://www.biggle.de/blog</link>
	<description>Web- und Software Development</description>
	<lastBuildDate>Tue, 07 Feb 2012 13:08:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Mit LINQ2XML innerhalb einer foreach serialisieren</title>
		<link>http://www.biggle.de/blog/mit-linq2xml-innerhalb-einer-foreach-serialisieren</link>
		<comments>http://www.biggle.de/blog/mit-linq2xml-innerhalb-einer-foreach-serialisieren#comments</comments>
		<pubDate>Fri, 31 Jul 2009 08:17:29 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=2737</guid>
		<description><![CDATA[Ziel dieses HowTo's ist es, mehrere Daten aus einem Service (hier in dem Beispiel aus einem Mock) via LINQ in eine XML zu schreiben (serialisieren).]]></description>
			<content:encoded><![CDATA[<p>Ziel dieses HowTo&#8217;s ist es, mehrere Daten aus einem Service (hier in dem Beispiel aus einem Mock) via LINQ in eine XML zu schreiben (serialisieren).</p>
<p>Die XML soll folgendermaßen aussehen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml version<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1.0&quot;</span> encoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;utf-8&quot;</span> standalone<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;yes&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;Localization&gt;
  &lt;Module id=&quot;Customers&quot;&gt;
    &lt;CultureCode&gt;de-DE&lt;/CultureCode&gt;
    &lt;Key&gt;General&lt;/Key&gt;
    &lt;Value&gt;Allgemein&lt;/Value&gt;
  &lt;/Module&gt;
  &lt;Module id=&quot;Customers&quot;&gt;
    &lt;CultureCode&gt;en-EN&lt;/CultureCode&gt;
    &lt;Key&gt;General&lt;/Key&gt;
    &lt;Value&gt;General&lt;/Value&gt;
  &lt;/Module&gt;
  &lt;Module id=&quot;Customers&quot;&gt;
    &lt;CultureCode&gt;de-DE&lt;/CultureCode&gt;
    &lt;Key&gt;Customer&lt;/Key&gt;
    &lt;Value&gt;Kunde&lt;/Value&gt;
  &lt;/Module&gt;
&lt;/Localization&gt;</pre></td></tr></table></div>

<p>Dazu inizialisiere ich mir zu erst den Datenpool, in diesem Fall benutze ich eine Klasse die mir ein paar <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2RlLndpa2lwZWRpYS5vcmcvd2lraS9Nb2NrLU9iamVrdA==">Mock-Objekte</a> bereitstellt.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">LocalizationServiceMock lm <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LocalizationServiceMock<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Dann erstelle ich mir das erste XML Element &#8220;Localization&#8221;, welches weitere Elemente beinhalten soll. </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">XElement moduleElement <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Localization&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Nun iteriere ich durch die Liste von Objekten die ich von meinem Mock bekomme und füge dem oben erstellten &#8220;moduleElement&#8221; die Daten aus dem Mock, als jeweils neues Element hinzu.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span>LocalizationServiceMock<span style="color: #339933;">.</span>TranslatedString translatedString in lm<span style="color: #339933;">.</span>GetTranslatedStrings<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  moduleElement<span style="color: #339933;">.</span>Add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> XElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Module&quot;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">new</span> XAttribute<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #339933;">,</span> translatedString<span style="color: #339933;">.</span>Module<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #000000; font-weight: bold;">new</span> XElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;CultureCode&quot;</span><span style="color: #339933;">,</span> translatedString<span style="color: #339933;">.</span>CultureCode<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #000000; font-weight: bold;">new</span> XElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Key&quot;</span><span style="color: #339933;">,</span> translatedString<span style="color: #339933;">.</span><span style="color: #990000;">Key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #000000; font-weight: bold;">new</span> XElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Value&quot;</span><span style="color: #339933;">,</span> translatedString<span style="color: #339933;">.</span>Value<span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Zum Schluss wird das Ganze noch in ein XDocument geschrieben</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> localizationService <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XDocument<span style="color: #009900;">&#40;</span>
  <span style="color: #000000; font-weight: bold;">new</span> XDeclaration<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;1.0&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;yes&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    moduleElement
 <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>und gespeichert:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">localizationService<span style="color: #339933;">.</span>Save<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Services/LocalizationService.xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Fertig sieht das folgendermaßen aus:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> void WriteXml<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  LocalizationServiceMock lm <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LocalizationServiceMock<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  XElement moduleElement <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Localization&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span>LocalizationServiceMock<span style="color: #339933;">.</span>TranslatedString translatedString in lm<span style="color: #339933;">.</span>GetTranslatedStrings<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    moduleElement<span style="color: #339933;">.</span>Add<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> XElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Module&quot;</span><span style="color: #339933;">,</span> <span style="color: #000000; font-weight: bold;">new</span> XAttribute<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #339933;">,</span> translatedString<span style="color: #339933;">.</span>Module<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
          <span style="color: #000000; font-weight: bold;">new</span> XElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;CultureCode&quot;</span><span style="color: #339933;">,</span> translatedString<span style="color: #339933;">.</span>CultureCode<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
          <span style="color: #000000; font-weight: bold;">new</span> XElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Key&quot;</span><span style="color: #339933;">,</span> translatedString<span style="color: #339933;">.</span><span style="color: #990000;">Key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
          <span style="color: #000000; font-weight: bold;">new</span> XElement<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Value&quot;</span><span style="color: #339933;">,</span> translatedString<span style="color: #339933;">.</span>Value<span style="color: #009900;">&#41;</span>
          <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">var</span> localizationService <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> XDocument<span style="color: #009900;">&#40;</span>
    <span style="color: #000000; font-weight: bold;">new</span> XDeclaration<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;1.0&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;yes&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
      moduleElement
   <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  localizationService<span style="color: #339933;">.</span>Save<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Services/LocalizationService.xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Viel Spass beim entwickeln : )</p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGU=">Mario Priebe</a>.</p> <img src="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=2737" width="1" height="1" style="display: none;" /><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>5. November 2009 -- <a href="http://www.biggle.de/blog/geschwindigkeitsvorteile-mit-vorkompilierten-linq-queries" title="Geschwindigkeitsvorteile mit vorkompilierten LINQ-Queries">Geschwindigkeitsvorteile mit vorkompilierten LINQ-Queries</a></li><li>12. Oktober 2009 -- <a href="http://www.biggle.de/blog/linq-tools" title="LINQ Tools">LINQ Tools</a></li><li>16. Juli 2009 -- <a href="http://www.biggle.de/blog/menuitems-aus-xml-auslesen-und-binden-wpf-mvvm" title="MenuItems aus XML auslesen und binden &#8211; WPF / MVVM ">MenuItems aus XML auslesen und binden &#8211; WPF / MVVM </a></li><li>4. März 2009 -- <a href="http://www.biggle.de/blog/einfaches-linq2sql-beispiel" title="Einfaches LINQ2SQL Beispiel">Einfaches LINQ2SQL Beispiel</a></li><li>14. Februar 2011 -- <a href="http://www.biggle.de/blog/bedingte-formatierung-im-datagrid-wpf" title="Bedingte Formatierung im Datagrid &#8211; WPF Quicky">Bedingte Formatierung im Datagrid &#8211; WPF Quicky</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/mit-linq2xml-innerhalb-einer-foreach-serialisieren/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MenuItems aus XML auslesen und binden &#8211; WPF / MVVM</title>
		<link>http://www.biggle.de/blog/menuitems-aus-xml-auslesen-und-binden-wpf-mvvm</link>
		<comments>http://www.biggle.de/blog/menuitems-aus-xml-auslesen-und-binden-wpf-mvvm#comments</comments>
		<pubDate>Thu, 16 Jul 2009 18:31:09 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[MVVM]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=2621</guid>
		<description><![CDATA[Eine XML soll die Daten für ein Menü bereitstellen. Das ganze ohne CodeBehind und unter MVVM.]]></description>
			<content:encoded><![CDATA[<p>Folgende Aufgabenstellung:</p>
<p>Eine XML soll die Daten für ein Menü bereitstellen. Das ganze ohne CodeBehind und unter MVVM.</p>
<p>Die XML sieht folgendermaßen aus:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml version<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1.0&quot;</span> encoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;TopNavigationItems&gt;
  &lt;NavigationItem&gt;
    &lt;MenuImage&gt;new.png&lt;/MenuImage&gt;
    &lt;MenuName&gt;Neu&lt;/MenuName&gt;
  &lt;/NavigationItem&gt;
  &lt;NavigationItem&gt;
    &lt;MenuImage&gt;preferences.png&lt;/MenuImage&gt;
    &lt;MenuName&gt;Tools&lt;/MenuName&gt;
  &lt;/NavigationItem&gt;
  &lt;NavigationItem&gt;
    &lt;MenuImage&gt;search.png&lt;/MenuImage&gt;
    &lt;MenuName&gt;Suche&lt;/MenuName&gt;
  &lt;/NavigationItem&gt;
&lt;/TopNavigationItems&gt;</pre></td></tr></table></div>

<p>Dazu habe ich als <strong>Model</strong> eine Klasse <em>TopNavigationMenuItem</em> erstellt mit lediglich zwei Propertys:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TopNavigationMenuItem
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> String MenuName <span style="color: #009900;">&#123;</span> get<span style="color: #339933;">;</span> set<span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>  
    <span style="color: #000000; font-weight: bold;">public</span> String MenuImage <span style="color: #009900;">&#123;</span> get<span style="color: #339933;">;</span> set<span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>  
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Anschliessend hab ich eine weitere Klasse in <strong>Models</strong> erstellt welche eine Methode enthält, die eine Liste von <em>TopNavigationMenuItem</em> zurück gibt. Hier benutze ich LINQ2XML um mir die Knoten heraus zu selektieren:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">using <span style="color: #990000;">System</span><span style="color: #339933;">.</span>Collections<span style="color: #339933;">.</span>Generic<span style="color: #339933;">;</span>
using <span style="color: #990000;">System</span><span style="color: #339933;">.</span>IO<span style="color: #339933;">;</span>
using <span style="color: #990000;">System</span><span style="color: #339933;">.</span>Xml<span style="color: #339933;">.</span>Linq<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TopNavigationMenuItems
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> static TopNavigationMenuItem navigationItem<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> static List<span style="color: #339933;">&lt;</span>TopNavigationMenuItem<span style="color: #339933;">&gt;</span> topNavigationMenuItemList <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> List<span style="color: #339933;">&lt;</span>TopNavigationMenuItem<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> static List<span style="color: #339933;">&lt;</span>TopNavigationMenuItem<span style="color: #339933;">&gt;</span> getTopNavigationItems<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">var</span> xmlPath <span style="color: #339933;">=</span> Path<span style="color: #339933;">.</span>GetDirectoryName<span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #0000ff;">&quot;\Pfad\zur<span style="color: #000099; font-weight: bold;">\T</span>opNavigationItems.xml&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">var</span> NavigationItems <span style="color: #339933;">=</span> XElement<span style="color: #339933;">.</span>Load<span style="color: #009900;">&#40;</span>xmlPath<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> item in NavigationItems<span style="color: #339933;">.</span>Elements<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        navigationItem <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TopNavigationMenuItem<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        navigationItem<span style="color: #339933;">.</span>MenuName <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span>item <span style="color: #339933;">.</span>Element<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MenuName&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        navigationItem<span style="color: #339933;">.</span>MenuImage <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span>item <span style="color: #339933;">.</span>Element<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;MenuImage&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        topNavigationMenuItemList<span style="color: #339933;">.</span>Add<span style="color: #009900;">&#40;</span>navigationItem<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">return</span> topNavigationMenuItemList<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Im <strong>ViewModel</strong> habe ich dann das ViewModelProperty <em>TopMenuItems</em> erstellt welche die Daten für die View in eine ObservableCollection bereitstellen soll.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #666666; font-style: italic;">#region ViewModelProperty: TopMenuItems
</span>    <span style="color: #000000; font-weight: bold;">private</span> ObservableCollection<span style="color: #339933;">&lt;</span>TopNavigationMenuItem<span style="color: #339933;">&gt;</span> _topNavigationMenuItem <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ObservableCollection<span style="color: #339933;">&lt;</span>TopNavigationMenuItem<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> ObservableCollection<span style="color: #339933;">&lt;</span>TopNavigationMenuItem<span style="color: #339933;">&gt;</span> TopMenuItems
    <span style="color: #009900;">&#123;</span>
      get
      <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> _topNavigationMenuItem<span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      set
      <span style="color: #009900;">&#123;</span>
        _topNavigationMenuItem <span style="color: #339933;">=</span> value<span style="color: #339933;">;</span>
        OnPropertyChanged<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;TopMenuItems&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">#endregion</span></pre></td></tr></table></div>

<p>im Konstruktor von dem <strong>ViewModel</strong> wird dann die Liste aus dem <strong>Model</strong> der ObservableCollection zugewiesen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> TopMenuMainViewModel<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      TopNavigationMenuItems<span style="color: #339933;">.</span>getTopNavigationItems<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #b1b100;">ForEach</span><span style="color: #009900;">&#40;</span>x <span style="color: #339933;">=&gt;</span> TopMenuItems<span style="color: #339933;">.</span>Add<span style="color: #009900;">&#40;</span>x<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Und hier kommt der der Lamda Ausdruck zum Einsatz, den wir schon einmal <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGUvYmxvZy9jYXN0LWxpc3QtdG8tb2JzZXJ2YWJsZWNvbGxlY3Rpb24td3BmLXF1aWNreQ==">Beachtung geschenkt haben</a>.</p>
<p>Zum Schluss dann in der <strong>View</strong> noch die Daten an die ObservableCollection binden und in einem DataTemplate aufbereiten:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>UserControl <span style="color: #339933;">...</span>
    <span style="color: #339933;">&lt;</span>UserControl<span style="color: #339933;">.</span>Resources<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>DataTemplate x<span style="color: #339933;">:</span><span style="color: #990000;">Key</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;MenuItemStyle&quot;</span><span style="color: #339933;">&gt;</span>
            <span style="color: #339933;">&lt;</span>StackPanel Orientation<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Horizontal&quot;</span><span style="color: #339933;">&gt;</span>
                <span style="color: #339933;">&lt;</span>Image Source<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Binding MenuImage}&quot;</span> Width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;16&quot;</span> Height<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;16&quot;</span> Margin<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0 0 5 0&quot;</span>  <span style="color: #339933;">/&gt;</span>
                <span style="color: #339933;">&lt;</span>TextBlock Text<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Binding MenuName}&quot;</span> <span style="color: #339933;">/&gt;</span>
            <span style="color: #339933;">&lt;/</span>StackPanel<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;/</span>DataTemplate<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;/</span>UserControl<span style="color: #339933;">.</span>Resources<span style="color: #339933;">&gt;</span>
&nbsp;
    <span style="color: #339933;">&lt;</span>Grid<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>Menu Grid<span style="color: #339933;">.</span>Column<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span>
              VerticalAlignment<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Top&quot;</span> 
              HorizontalAlignment<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Left&quot;</span> 
              Background<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Transparent&quot;</span> ItemsSource<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Binding TopMenuItems}&quot;</span> ItemTemplate<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{StaticResource MenuItemStyle}&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>UserControl<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Fertig : )</p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGU=">Mario Priebe</a>.</p> <img src="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=2621" width="1" height="1" style="display: none;" /><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>5. Mai 2010 -- <a href="http://www.biggle.de/blog/combobox-an-objectprovider-binden" title="ComboBox an ObjectDataProvider binden">ComboBox an ObjectDataProvider binden</a></li><li>22. Juli 2009 -- <a href="http://www.biggle.de/blog/cal-anwendung-in-3-minuten" title="CAL Anwendung in 3 Minuten">CAL Anwendung in 3 Minuten</a></li><li>18. Juni 2009 -- <a href="http://www.biggle.de/blog/mehrsprachigkeit-lokalisierung-in-wpf" title="Mehrsprachigkeit / Lokalisierung in WPF">Mehrsprachigkeit / Lokalisierung in WPF</a></li><li>6. März 2011 -- <a href="http://www.biggle.de/blog/multibinding-die-zweite" title="MultiBinding die Zweite">MultiBinding die Zweite</a></li><li>14. Februar 2011 -- <a href="http://www.biggle.de/blog/doppelklick-im-datagrid-abfangen-wpf-quicky" title="Doppelklick im DataGrid abfangen &#8211; WPF Quicky">Doppelklick im DataGrid abfangen &#8211; WPF Quicky</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/menuitems-aus-xml-auslesen-und-binden-wpf-mvvm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mehrsprachigkeit / Lokalisierung in WPF</title>
		<link>http://www.biggle.de/blog/mehrsprachigkeit-lokalisierung-in-wpf</link>
		<comments>http://www.biggle.de/blog/mehrsprachigkeit-lokalisierung-in-wpf#comments</comments>
		<pubDate>Thu, 18 Jun 2009 09:14:38 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[Architektur]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=2505</guid>
		<description><![CDATA[Folgender Artikel beschreibt die technische Umsetzung  zweier Methoden (Resources, XML) um WPF Anwendungen mehrsprachig zu gestalten...]]></description>
			<content:encoded><![CDATA[<p>Folgender Artikel beschreibt die technische Umsetzung  zweier Methoden um WPF Anwendungen mehrsprachig zu gestalten.</p>
<p>Mögliche Lösungsansätze:</p>
<ul>
<li> Ressource-Files</li>
<li>Xml-Files</li>
</ul>
<p>Ressource-Files (.resx) liegen sehr nahe, da der Zugriff auf diese bereits vom Framework bereitgestellt wird, und da Ressource-Files XML-Files sind, ist auch der Umgang mit ihnen kein Problem. Es gibt aber durchaus Situationen, wo &#8220;normale&#8221; XML-Files die bessere Wahl wären &#8211; z.B. wenn »Plattform-Unabhängigkeit« , oder »Skalierbarkeit« eine Rolle spielen. Die beiden in Frage kommenden Möglichkeiten werden im Folgenden technisch analysiert und vorgestellt.</p>
<p><strong>Lösungsansatz Resource-Files</strong></p>
<p>Feste Elemente, können in einer Anwendung durch Resources in der jeweiligen Sprache definiert werden. Durch ein einfaches Duplizieren einer bestehenden Resource.SPRACHE.resx und der Anpassung dieser, wird automatisch eine neue Resource.SPRACHE.dll erstellt. Das garantiert ein schnelles Implementieren weiterer Sprachen durch den Entwickler¹. Die verschiedenen Sprachdateien haben aber nun den Nachteil das die entsprechenden Variable redundant vorliegt, was auch ein Erweitern der jeweiligen Sprache beim späteren Hinzufügen einer neuen Variable erschwert.</p>
<p><strong>Technische Umsetzung</strong></p>
<p><span style="text-decoration: underline;">Benötigte Tools:</span></p>
<ul>
<li>ResXFileCodeGeneratorEx &#8211; http://dmytro.kryvko.googlepages.com/</li>
<li>Klasse CultureResources.cs &#8211; http://www.codeproject.com/KB/WPF/WPFLocalize.aspx</li>
</ul>
<p><span style="text-decoration: underline;">Vorbereitung / Installation</span></p>
<ul>
<li>Order Cultures in der Solution anlegen</li>
<li>Die Klasse CultureResources.cs² anlegen</li>
<li>Die Resources.resx aus Propertys nach Cultures verschieben, Achtung! Der Namensraum der CodeBehind muss hier aber weiter auf „Properties“ zeigen.</li>
<li>Die Settings.settings um &#8220;DefaultCulture&#8221; vom Typ &#8220;System.Globalization.Culture&#8221; erweitern (Die app.config wird dabei automatisch aktualisiert). Hier kann als Wert die Defaultsprache eingestellt werden, zB. en-US</li>
<li>Erstellen einer ResourceDictionary in Cultures mit den Namen ResourceDictionary.xaml mit folgendem Inhalt:</li>
</ul>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>ObjectDataProvider x<span style="color: #339933;">:</span><span style="color: #990000;">Key</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Resources&quot;</span> ObjectType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{x:Type Cultures:CultureResources}&quot;</span>  MethodName<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;GetResourceInstance&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>ObjectDataProvider x<span style="color: #339933;">:</span><span style="color: #990000;">Key</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;CultureResourcesDS&quot;</span> ObjectType<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{x:Type Cultures:CultureResources}&quot;</span><span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>Die ResourceDictionary.xaml in der App.xaml bekannt machen (<ResourceDictionary Source="/Cultures/ResourceDictionary.xaml"/>) / ggfls. Mergen</p>
<p>In der View können nun die Inhalte welche übersetzt werden sollen um folgenden Syntax erweitert werden: {Binding Path=HIER.DER.RESOURCE.NAME, Source={StaticResource Resources}}</p>
<p>Beispiel View:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>MenuItem <span style="color: #990000;">Header</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Binding Path=MenuItemEdit, Source={StaticResource Resources}}&quot;</span><span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Es empfiehlt sich die Anwendung soweit vorzubereiten und innerhalb einer Resource die Sprachvariablen festzulegen und dann erst diese zu duplizieren und in der jeweiligen Sprache zu übersetzen. Ein späteres Hinzufügen von neuen Variablen ist recht aufwändig, da dieses in jeder erstellten Sprache ausgeführt werden muss. Die Möglichkeit dieses mit der Baml.exe, welche die DLL in *.csv Dateien parsen kann ist zwar gegeben, jedoch bleibt es nicht aus, alle Sprachdateien für sich anzupassen. Auch Bilder, Datei u.a. können über Resources gesteuert werden</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>¹Um eine Sprache hinzuzufügen, genügt es eine vorhandene Resources zu duplizieren und anzupassen. Die Resourcedatei muss in den Buildeigenschaften (&#8220;Benutzerdefiniertes Tool&#8221;) um den Suffix &#8220;Ex&#8221; (ResXFileCodeGeneratorEx) erweitert werden. Vorher muss vom Entwickler das Tool ResXFileCodeGeneratorEx heruntergeladen und installiert werden (siehe benötigte Tools &#8211; ResXFileCodeGeneratorEx)</p>
<p>²Die Klasse Culture beinhaltet Methoden, welche die vorhandenen Resources findet und in einer Liste bereitstellt.</p>
<p><strong> </strong></p>
<p><strong>Nachteile von Resources</strong></p>
<p>Resources haben den entscheidenden Nachteil, dass hier während der Laufzeit keine neuen „Sprachvariablen“ hinzugefügt werden können, da dieses ein Neukompilieren voraussetzt, um die entsprechende *.dll zu erzeugen. Des Weiteren ist das Anpassen aller implementierten Resources bei neuen Sprachvariablen (notwendige Schritte: exportieren, anpassen, importieren, kompilieren) umständlich.</p>
<p>Resources sind Redundant zu den darunterliegenden Ebenen, das heißt, dass die Variablen in jeder Sprach.dll sich wiederholen, so entsteht auch die Gefahr von nicht vorhandenen oder „falsch“ geschriebenen Sprachenvariablen.</p>
<p>Diese Implementierung ist in dieser Weise Plattformabhängig und so auch proprietär an Windowssysteme bzw. an .NET Plattformen gebunden.</p>
<p><br class="spacer_" /></p>
<p><strong>Lösungsansatz XML Files</strong></p>
<p>Wenn Ressource-Files wegfallen, liegen &#8220;normale&#8221; XML-Files nahe. Alle Strings werden in ein zentrales XML-File geladen. <br />
 Der Zugriff auf die Strings funktioniert über eine zentrale Klasse, welche die ZugriffsLogik kapseln soll.</p>
<p><strong>Anforderungen:</strong></p>
<ul>
<li>1-n Sprachen werden unterstützt (muss soweit skalierbar sein, dass neue Sprachen jederzeit hinzugefügt werden können,  ohne dass die Applikation angepasst werden, oder neu kompiliert muss).</li>
<li>Die Strings müssen in verschiedene Bereiche (Regions) unterteilt werden können &#8211; sonst verliert man schnell den Überblick über die zu verwalteten Strings.</li>
<li>Eine StringVariable soll einmalig sein</li>
<li>Das Source-File sollte &#8220;Notepad-kompatibel&#8221; sein</li>
<li>Modularität muss unterstützt werden</li>
<li>Muss von allen Systemen unterstützt werden</li>
<li>Möglichkeit einfacher Übersetzung durch Outsourcing</li>
</ul>
<p>Exemplarischer Aufbau einer XML Struktur:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>Region name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;TopMenu&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>MenuItemEdit<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>de<span style="color: #339933;">-</span>DE<span style="color: #339933;">&gt;</span>Bearbeiten<span style="color: #339933;">&lt;/</span>de<span style="color: #339933;">-</span>DE<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>en<span style="color: #339933;">-</span>US<span style="color: #339933;">&gt;</span>Edit<span style="color: #339933;">&lt;/</span>en<span style="color: #339933;">-</span>US<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>nl<span style="color: #339933;">-</span>NL<span style="color: #339933;">&gt;</span>Bewerken<span style="color: #339933;">&lt;/</span>nl<span style="color: #339933;">-</span>NL<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>fr<span style="color: #339933;">-</span>FR<span style="color: #339933;">&gt;</span>Modifier<span style="color: #339933;">&lt;/</span>fr<span style="color: #339933;">-</span>FR<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>MenuItemEdit<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>RegionName<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>Region name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;OutlookBar&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>NavigationPaneMinimizedText<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>de<span style="color: #339933;">-</span>DE<span style="color: #339933;">&gt;</span>Arbeitsplatz<span style="color: #339933;">&lt;/</span>de<span style="color: #339933;">-</span>DE<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>en<span style="color: #339933;">-</span>US<span style="color: #339933;">&gt;</span>Workplace<span style="color: #339933;">&lt;/</span>en<span style="color: #339933;">-</span>US<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>nl<span style="color: #339933;">-</span>NL<span style="color: #339933;">&gt;</span>Werkplek<span style="color: #339933;">&lt;/</span>nl<span style="color: #339933;">-</span>NL<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>fr<span style="color: #339933;">-</span>FR<span style="color: #339933;">&gt;</span>Poste de Travail<span style="color: #339933;">&lt;/</span>fr<span style="color: #339933;">-</span>FR<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>NavigationPaneMinimizedText<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>Region<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Die Unterteilung in die Region-Nodes ermöglicht es, eine gewisse Struktur in das XML-File zu bringen. So behält man auch bei hunderten von Texten den Überblick.</p>
<p>Die Sprachen können frei ergänzt werden, die Bezeichnung der Sprach-Nodes (hier de-DE, en-US, nl-NL, fr-FR) ist dabei egal, da dessen Bezeichnung dann einfach als Parameter mitgegeben wird.<br />
In einer dynamischen Anwendungslandschaft, in deren der Anwender eigene Elemente oder Controls anlegen kann, ist dieses System einzusetzen. Hier kann durch eine Serializierung neuer „Vokabeln“ sichergestellt werden, das die Übersetzung des jeweiligen Elements zur Laufzeit geschehen kann.</p>
<p><strong>Umsetzung in GUI:</strong></p>
<p>Als Datenspeicher für die Daten bieten sich durch das Key / Value &#8211; Verfahren Dictionary-Objekte an.<br />
Jede Hierarchie-Stufe (Key, Value) wird in ein eigenes Dictionary-Objekt gespeichert &#8211; und diese werden dann entsprechend verschachtelt. </p>
<p><strong>Zwei einfache Methoden für die Realisierung:</strong></p>
<ul>
<li>LoadSourceFile(&#8220;language.xml&#8221;) Wird nur dazu verwendet, das XML-File in eine XmlDocument-Instanz zu laden,   die dann anschliessend in der GetTranslatedDictionaryFromXML verarbeitet wird.</li>
<li>GetTranslatedDictionaryFromXML() wird aufgerufen wenn die Standard-Spracheinstellungen genutzt werden. Diese ruft die im folgenden beschriebene Methode mit der default-Spracheinstellung auf und gibt das Dictionary zurück.</li>
<li>Die eigentliche Methode GetTranslatedDictionaryFromXML(String language) iteriert die XML und speichert im Key/Value Verfahren die Werte im Dictionary und gibt dieses zurück. </li>
</ul>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#region Method: GetTranslatedDictionaryFromXML
</span>    <span style="color: #000000; font-weight: bold;">public</span> static Dictionary<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">,</span> String<span style="color: #339933;">&gt;</span> GetTranslatedDictionaryFromXML<span style="color: #009900;">&#40;</span>String language<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #990000;">xmlDoc</span> <span style="color: #339933;">=</span> LoadSourceFile<span style="color: #009900;">&#40;</span>SourceFile<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">var</span> translatedDictionary <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Dictionary<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">,</span> String<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      try
      <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span>XmlNode regionNode in <span style="color: #990000;">xmlDoc</span><span style="color: #339933;">.</span>SelectNodes<span style="color: #009900;">&#40;</span>XML_ROOTNODE<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
          <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span>XmlNode keyNode in regionNode<span style="color: #339933;">.</span>ChildNodes<span style="color: #009900;">&#41;</span>
          <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span>XmlNode value in keyNode<span style="color: #339933;">.</span>ChildNodes<span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#123;</span>
              <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>language <span style="color: #339933;">==</span> value<span style="color: #339933;">.</span>Name<span style="color: #009900;">&#41;</span>
              <span style="color: #009900;">&#123;</span>
                Value <span style="color: #339933;">=</span> value<span style="color: #339933;">.</span>InnerText<span style="color: #339933;">;</span>
              <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #990000;">Key</span> <span style="color: #339933;">=</span> keyNode<span style="color: #339933;">.</span>Attributes<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;key&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span>Value<span style="color: #339933;">;</span>
            translatedDictionary<span style="color: #339933;">.</span>Add<span style="color: #009900;">&#40;</span><span style="color: #990000;">Key</span><span style="color: #339933;">,</span> Value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span>
      catch <span style="color: #009900;">&#40;</span>Exception ex<span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error - &quot;</span> <span style="color: #339933;">+</span> SourceFile <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;: &quot;</span> <span style="color: #339933;">+</span> ex<span style="color: #339933;">.</span>Message<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">return</span> translatedDictionary<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> static Dictionary<span style="color: #339933;">&lt;</span>String<span style="color: #339933;">,</span> String<span style="color: #339933;">&gt;</span> GetTranslatedDictionaryFromXML<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">return</span> GetTranslatedDictionaryFromXML<span style="color: #009900;">&#40;</span>DefaultLanguage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">#endregion</span></pre></td></tr></table></div>

<p>Hierbei werden beide Methoden zur Verfügung stehen, somit kann optional die gewünschte Sprache mit übergeben werden, anders verwendet die Methode die definierte Default-Sprache.</p>
<p>[Die Besonderheit in diesem Verfahren ist, dass es möglich ist die angezeigten Sprachen zu „mischen“, so könnten Kundenwünsche in der Art „Ich hätte gerne die Inhalte in Englisch, aber die Menüstruktur auf Holländisch“, umgesetzt werden.]</p>
<p><strong>MVVM</strong></p>
<p>In der View wird das Element wie folgt gebunden, diese Methode kann auf alle Elemente abgebildet weredn: </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>MenuItem <span style="color: #990000;">Header</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Binding Translation[MenuItemEdit]}&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>Image ToolTip<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;{Binding Translation[LogoToolTip]}&quot;</span> Source<span style="color: #339933;">=</span>“…“<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Im ViewModel, wird in das jeweilige ViewModelProperty das Dictionary gespeichert:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">Translation <span style="color: #339933;">=</span> TranslateXml<span style="color: #339933;">.</span>GetTranslatedDictionaryFromXML<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
TranslationFR <span style="color: #339933;">=</span> TranslateXml<span style="color: #339933;">.</span>GetTranslatedDictionaryFromXML<span style="color: #009900;">&#40;</span>“fr<span style="color: #339933;">-</span>FR“<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
TranslationNL <span style="color: #339933;">=</span> TranslateXml<span style="color: #339933;">.</span>GetTranslatedDictionaryFromXML<span style="color: #009900;">&#40;</span>“nl<span style="color: #339933;">-</span>NL“<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><strong>Fazit</strong></p>
<p>Der 2. Lösungsansatz ist dem Ersten vorzuziehen, da hier die Vorteile klar auf der Hand liegen. Es wird gewährleistet, das betriebsystemunabhängige Systeme, gleichermaßen eine einzige LanguageSource bereitsteht, die von allen Systemarchitekturen gelesen werden kann.<br />
Dieses Konzept kann ohne Probleme auch auf andere Datenquellen angewendet werden. </p>
<p>Sprachvariablen liegen in einer XML einmalig vor, so wird verhindert das man sich in einer anderen Sprache verschreibt, oder vergisst diese hinzuzufügen. Weiterhin können XML Dateien als Services bereitgestellt und in Workflows mit eingebunden und ggfl. angepasst oder verändert werden.<br />
Eine Erweiterbarkeit der Sprachdateien während der Laufzeit wird ebenfalls durch diese Lösung gewährleistet. Vorteile dieses Ansatzes liegen sicherlich auch in der einfachen Handhabung des XML-Files.</p>
<p>Es werden keine speziellen Programme oder User-Interfaces benötigt, um die Strings anzupassen,  z.B. kann die XML nach Excel exportiert werden und an einem Übersetzer &#8220;outgesourced&#8221; werden.</p>
<p>Im Endeffekt muss verglichen werden, wie weit man seine Entwicklung modular aufbauen möchte und wie weit man eine Skalierung des System gewährleisten will. Die Entwicklung zeigt aber, dass es wichtig ist, eine Anwendungslandschaft zu entwickeln, die in klaren Schichten voneinander getrennt ist um so Business und GUI vollkommen voneinander zu trennen. Wenn es später heißt, lasst uns die Anwendung auch auf dem IPhone, Smartphone oder mittels Website in PHP/ASP/Silverlight abbilden, spielen solche  Entscheidungen eine gravierende Rolle.</p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGU=">Mario Priebe</a>.</p> <img src="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=2505" width="1" height="1" style="display: none;" /><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>20. Oktober 2009 -- <a href="http://www.biggle.de/blog/note-multiple-styles-in-wpf" title="Note: Multiple Styles in WPF">Note: Multiple Styles in WPF</a></li><li>16. Juli 2009 -- <a href="http://www.biggle.de/blog/menuitems-aus-xml-auslesen-und-binden-wpf-mvvm" title="MenuItems aus XML auslesen und binden &#8211; WPF / MVVM ">MenuItems aus XML auslesen und binden &#8211; WPF / MVVM </a></li><li>18. Juni 2009 -- <a href="http://www.biggle.de/blog/birthdayconverter-wpf-quicky" title="BirthdayConverter &#8211; WPF Quicky">BirthdayConverter &#8211; WPF Quicky</a></li><li>6. März 2011 -- <a href="http://www.biggle.de/blog/multibinding-die-zweite" title="MultiBinding die Zweite">MultiBinding die Zweite</a></li><li>14. Februar 2011 -- <a href="http://www.biggle.de/blog/doppelklick-im-datagrid-abfangen-wpf-quicky" title="Doppelklick im DataGrid abfangen &#8211; WPF Quicky">Doppelklick im DataGrid abfangen &#8211; WPF Quicky</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/mehrsprachigkeit-lokalisierung-in-wpf/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Suche im Firefox um Eigene erweitern</title>
		<link>http://www.biggle.de/blog/suche-im-firefox-um-eigene-erweitern</link>
		<comments>http://www.biggle.de/blog/suche-im-firefox-um-eigene-erweitern#comments</comments>
		<pubDate>Fri, 15 May 2009 08:25:26 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[MarkUp]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=2267</guid>
		<description><![CDATA[Seit neuestem kann man sich ja die Suche auf Biggle.de in den Firefox integrieren. Für den einen oder anderen sicher uninteressant, sich gerade mein Blog in den Firefox zu packen. Aber wie man das macht, kann sicher interessant sein : )]]></description>
			<content:encoded><![CDATA[<p>Seit neuestem kann man sich ja die Suche auf Biggle.de in den Firefox integrieren. Für den einen oder anderen sicher uninteressant, sich gerade mein Blog in den Firefox zu packen. Aber <span style="text-decoration: underline;">wie</span> man das macht, kann sicher interessant sein : )</p>
<p><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGUvYmxvZy93cC1jb250ZW50L3VwbG9hZHMvMjAwOS8wNS9zdWNoZW5pbWZpcmVmb3guanBn"><img class="alignnone size-full wp-image-2266" title="suchenimfirefox" src="http://www.biggle.de/blog/wp-content/uploads/2009/05/suchenimfirefox.jpg" alt="suchenimfirefox" width="369" height="78" /></a></p>
<p>Wie folgt geht man dabei vor:</p>
<p>1. Schritt:<br />
 Man legt sich eine *.xml auf dem Space und benennt diese nach seiner Wahl. In meinem Fall nenn ich diese &#8220;openSearch.xml&#8221;.</p>
<p>2.Schritt:<br />
 Der Inhalt der xml, sieht wie folgt aus:</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>xml version<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1.0&quot;</span> encoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
 &lt;OpenSearchDescription xmlns=&quot;http://a9.com/-/spec/opensearch/1.1/&quot;&gt;
  &lt;ShortName&gt;biggle.de&lt;/ShortName&gt;
  &lt;Description&gt;Biggle.de&lt;/Description&gt;
  &lt;Image&gt;src=&quot;http://www.biggle.de/favicon.ico&quot;&lt;/Image&gt;
  &lt;Url type=&quot;text/html&quot; template=&quot;http://www.biggle.de/blog/?s={searchTerms}&quot; /&gt;
 &lt;/OpenSearchDescription&gt;</pre></div></div>

<p>Wichtig ist hierbei, die URL so anzupassen, das der jeweilige SuchString angegeben werden muss. In meinem Fall:</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.biggle.de/blog/?s=</span></pre></div></div>

<p>Man kann damit diese Suche für den Firefox, nahezu für jede Webseite erstellen, die bei der Suche, der URL die jeweiligen Parameter anhängen.</p>
<p>Das Favicon sollte sich auch auf dem Space befinden. </p>
<p><div class="note"><div class="notetip">Erstellen kann man sich so ein Favicon bereits <a title=\"http://www.telegraphics.com.au/sw/\" href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy50ZWxlZ3JhcGhpY3MuY29tLmF1L3N3Lw==" target=\"_blank\">recht easy</a> (Photoshop Plugin) und das sogar <a title=\"http://favicon-generator.org/\" href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2Zhdmljb24tZ2VuZXJhdG9yLm9yZy8=" target=\"_blank\">online</a>.</div></div></p>
<p><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGUvYmxvZy93cC1jb250ZW50L3VwbG9hZHMvMjAwOS8wNS9zdWNoZW5pbWZpcmVmb3gyMS5qcGc="><img class="alignnone size-full wp-image-2269" title="suchenimfirefox21" src="http://www.biggle.de/blog/wp-content/uploads/2009/05/suchenimfirefox21.jpg" alt="suchenimfirefox21" width="228" height="277" /></a></p>
<p>3.Schritt:<br />Dem Browser bekannt machen:<br />
Dazu folgende Anweisung in den Headerbereich setzen.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>link title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Suche auf Biggle.de&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;application/opensearchdescription+xml&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;search&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.biggle.de/blog/openSearch.xml&quot;</span> <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>4.Schritt:<br />Zu guter letzt, wird der entsprechende Link gesetzt:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">javascript<span style="color: #339933;">:</span>window<span style="color: #339933;">.</span>external<span style="color: #339933;">.</span>AddSearchProvider<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'http://www.biggle.de/blog/openSearch.xml'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=amF2YXNjcmlwdDp3aW5kb3cuZXh0ZXJuYWwuQWRkU2VhcmNoUHJvdmlkZXIo"http://www.biggle.de/blog/openSearch.xml');\">Biggle-Suche im FireFox</a></p>
<p>Viel Spass beim nachmachen : )</p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGU=">Mario Priebe</a>.</p> <img src="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=2267" width="1" height="1" style="display: none;" /><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>27. Mai 2009 -- <a href="http://www.biggle.de/blog/foxtab-nice-firefox-addon" title="FoxTab Nice Firefox Addon">FoxTab Nice Firefox Addon</a></li><li>26. Oktober 2008 -- <a href="http://www.biggle.de/blog/webseiten-mit-firefox-speichern" title="Webseiten mit Firefox speichern">Webseiten mit Firefox speichern</a></li><li>6. Februar 2010 -- <a href="http://www.biggle.de/blog/twitterclient-als-firefox-extension" title="Twitterclient als Firefox-Extension">Twitterclient als Firefox-Extension</a></li><li>1. Februar 2010 -- <a href="http://www.biggle.de/blog/firefox-3-6-addons-kompatibilitat" title="Firefox 3.6 Addons Kompatibilität">Firefox 3.6 Addons Kompatibilität</a></li><li>20. September 2009 -- <a href="http://www.biggle.de/blog/wikipedia-bookmarklet" title="Wikipedia Bookmarklet">Wikipedia Bookmarklet</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/suche-im-firefox-um-eigene-erweitern/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WP &#8211; RSS Syndication sortiert nach Kategorien</title>
		<link>http://www.biggle.de/blog/wp-rss-sortiert-nach-kategorien</link>
		<comments>http://www.biggle.de/blog/wp-rss-sortiert-nach-kategorien#comments</comments>
		<pubDate>Sat, 18 Oct 2008 23:10:45 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[(X)HTML]]></category>
		<category><![CDATA[MarkUp]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=600</guid>
		<description><![CDATA[Wenn man möchte kann man auch einzeln die Kategorien hier im Blog als RSS abonnieren.  Dazu einfach oben in der Adressleiste, das RSS Sysmbol wählen, welches ein Kontexmenü mit den entsprechenden Kategorien öffnet.]]></description>
			<content:encoded><![CDATA[<p>Ein paar Artikel habe ich ja schon geschrieben in meinem Blog und erst mit der Zeit kristalisiert sich heraus, welche Kategorien man wirklich benutzt und heute habe ich die vorerst wahllos erstellten Kategorien, einfach mal eine Struktur gegeben.</p>
<p>Ich dachte auch, oh man jeden Artikel editieren das kann dauern, jedoch ist mir dazu ein wunderbares WordPress Plugin in die Hände gefallen, welches ich euch nicht vorenthalten möchte.</p>
<p>Es nennt sich <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5zY2hsb2ViZS5kZS93b3JkcHJlc3MvYWRtaW4tbWFuYWdlbWVudC14dGVuZGVkLXBsdWdpbg==" target=\"_blank\">Admin Management Xtended</a>, unterstützt durch Ajax, ermöglicht dieses ein unkompliziertes bearbeiten von Kategorien und Tags . Einfach mal das <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5zY2hsb2ViZS5kZS93b3JkcHJlc3MvYWRtaW4tbWFuYWdlbWVudC14dGVuZGVkLXBsdWdpbi9zY3JlZW5jYXN0Lw==" target=\"_blank\">Videorial</a> dazu anschaun.</p>
<p>Ausserdem kann man, wenn man möchte nun auch einzeln die Kategorien hier im Blog als RSS abonnieren.  Dazu einfach oben in der Adressleiste, das RSS Symbol wählen, welches ein Kontexmenü mit den entsprechenden Kategorien öffnet.</p>
<p><a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGUvYmxvZy93cC1jb250ZW50L3VwbG9hZHMvMjAwOC8xMC9yc3MuanBn"><img class="alignnone size-medium wp-image-601" title="rss" src="http://www.biggle.de/blog/wp-content/uploads/2008/10/rss-280x300.jpg" alt="" width="280" height="300" /></a></p>
<p><br class="spacer_" /></p>
<p>Wenn Du in Deinem Blog dieses Kontextmenü benutzen möchtest, erweitere Deinen Header Bereich pro Kategorie um folgende Zeile(n): </p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;alternate&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;application/atom+xml&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Photoshop-Themen&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;/blog/?cat=32&amp;amp;feed=rss2&quot;</span> <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>Editieren solltest Du den title=&#8221;" und natürlich die entsprechende ?cat=</p>
<p>Wenn Du die verschiedenen RSS Spezifikationen anbieten möchtest, dann jeweils durch die Typen ergänzen, dazu stehen derzeit folgende Syndication bereit:</p>
<p>RSS 2.0 -> type=&#8221;application/rss+xml&#8221;</p>
<p>RSS 0.92 -> type=&#8221;text/xml&#8221;</p>
<p>Atom 0.3 -> type=&#8221;application/atom+xml&#8221;</p>
<p><br class="spacer_" /></p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5iaWdnbGUuZGU=">Mario Priebe</a>.</p> <img src="http://www.biggle.de/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=600" width="1" height="1" style="display: none;" /><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>5. September 2008 -- <a href="http://www.biggle.de/blog/wordpress-seiten-via-rss" title="Wordpress-Seiten via RSS">Wordpress-Seiten via RSS</a></li><li>17. Januar 2011 -- <a href="http://www.biggle.de/blog/feedflare-fuer-dotnet-kicks-de" title="FeedFlare für dotnet-kicks.de">FeedFlare für dotnet-kicks.de</a></li><li>21. November 2010 -- <a href="http://www.biggle.de/blog/bbcomments-um-syntaxtag-code-erweitert" title="BBComments um SyntaxTag [code] erweitert">BBComments um SyntaxTag [code] erweitert</a></li><li>23. April 2010 -- <a href="http://www.biggle.de/blog/facebook-like-button-im-blog-einbinden" title="Facebook Like Button im Blog einbinden">Facebook Like Button im Blog einbinden</a></li><li>13. Februar 2010 -- <a href="http://www.biggle.de/blog/dotnet-kick-button-in-wordpress-einbinden-ii" title="Dotnet-Kick Button in Wordpress einbinden II">Dotnet-Kick Button in Wordpress einbinden II</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/wp-rss-sortiert-nach-kategorien/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

