title: Simple Xml - Element Declared Twice Error
body: <p>I have been trying to wrap a set of classes based on Simple XML (Java Serializer) around a RSS Feed. The sample feed is </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;rss  xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"&gt;
  &lt;channel&gt;
      &lt;title&gt;Coding Horror&lt;/title&gt;
      &lt;link&gt;http://www.codinghorror.com/blog/&lt;/link&gt;
      &lt;description&gt;programming and human factors - Jeff Atwood&lt;/description&gt;
      &lt;language&gt;en-us&lt;/language&gt;
  
      &lt;lastBuildDate&gt;Wed, 04 May 2011 20:34:18 -0700&lt;/lastBuildDate&gt;
      &lt;pubDate&gt;Wed, 04 May 2011 20:34:18 -0700&lt;/pubDate&gt;
      &lt;generator&gt;http://www.typepad.com/&lt;/generator&gt;
      &lt;docs&gt;http://blogs.law.harvard.edu/tech/rss&lt;/docs&gt;
  
      &lt;image&gt;
          &lt;title&gt;Coding Horror&lt;/title&gt;
          &lt;url&gt;http://www.codinghorror.com/blog/images/coding-horror-official-logo-small.png&lt;/url&gt;
          &lt;width&gt;100&lt;/width&gt;
          &lt;height&gt;91&lt;/height&gt;
          &lt;description&gt;Logo image used with permission of the author. (c) 1993 Steven C. McConnell. All Rights Reserved.&lt;/description&gt;
          &lt;link&gt;http://www.codinghorror.com/blog/&lt;/link&gt;
      &lt;/image&gt;
  
      &lt;xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /&gt;   
      &lt;atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/codinghorror" /&gt;        
  
  &lt;/channel&gt;
   &lt;/rss&gt;
  </code></pre>
  
  <p>The error that I am getting while running the code is </p>
  
  <pre><code>org.simpleframework.xml.core.PersistenceException: Element 'link' declared twice at line 24
  </code></pre>
  
  <p>And the error is fair enough because the particular element name occurs twice in the xml but in different ways.</p>
  
  <p>The first link element is here</p>
  
  <pre><code>&lt;link&gt;http://www.codinghorror.com/blog/&lt;/link&gt;
  </code></pre>
  
  <p>Its directly under the Channel tag. And then the next link tag is again under Channel in the following format</p>
  
  <p><code>&lt;atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/codinghorror" /&gt;</code></p>
  
  <p>In Channel.java class I cannot have two variables with the same name link. I tried changing a variable name to blogLink and tried giving name in the Element annotation and Eclipse gave me this error</p>
  
  <pre><code> Change was
  
  @Element("name=link")
  
  
  Result is
  
  The attribute value is undefined for the annotation Element
  </code></pre>
  
  <p>I know I am missing something here but I am not able to put my finger on it. I would appreciate any help on this.</p>
  
  <p>UPDATE</p>
  
  <p>Channel Class</p>
  
  <pre><code>@Element(name="link")
  @Namespace(reference="http://www.w3.org/2005/Atom",prefix="atom")
  private atomlink atomlink;
  
  public atomlink getAtomLink() {
      return atomlink;
  }
  </code></pre>
  
  <p>Link Class</p>
  
  <pre><code>   import org.simpleframework.xml.Attribute;
     import org.simpleframework.xml.Namespace;
     import org.simpleframework.xml.Root;
  
    @Root(name="link")
    @Namespace(reference="http://www.w3.org/2005/Atom",prefix="atom10")
    public class atomlink {
  
  @Attribute 
  private String rel;
  
  public String getRel() {
      return rel;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I have changed the class names and yet it still points to the same error.</p>