title: How to ignore casing of element names in JaxB
body: <p>As stated in the title I want to ignore casing of element names in a document.</p>
  
  <pre><code>static class XY433 {
      @XmlAttribute(name = "C200")
      String c200;
      @XmlAttribute(name = "C215")
      String c215;
  
      @XmlAttribute(name="F001")
      String f001;
  
      @XmlAttribute(name="f001")
      String lcf001; // I want to avoid this duplication
  }
  </code></pre>
  
  <p>I tried to use the code posted by Blaise Doughan:</p>
  
  <pre><code>private static class ToLowerCaseNamesStreamReaderDelegate extends StreamReaderDelegate {
  
      public ToLowerCaseNamesStreamReaderDelegate(XMLStreamReader xsr) {
          super(xsr);
      }
  
      @Override
      public String getAttributeLocalName(int index) {
          return super.getAttributeLocalName(index).toLowerCase();
      }
  
      @Override
      public String getLocalName() {
          return super.getLocalName().toLowerCase();
      }
  
  }
  
  
  @XmlRootElement(name="doc")
  static class Doc {
      @XmlElement(name="element")
      List&lt;Element&gt; elements;
  }
  
  static class Element {
      @XmlAttribute(name = "abc")
      String abc;
  }
  
  public static void main(String[] args) throws Exception {
      XMLInputFactory xif = XMLInputFactory.newInstance();
      XMLStreamReader xsr = xif.createXMLStreamReader(new FileInputStream("LowerCaseElementNamesFilterTest.xml"));
  
      Unmarshaller u = JAXBContext.newInstance(Doc.class).createUnmarshaller();
  
      //Do unmarshalling
      Doc doc = (Doc) u.unmarshal(new ToLowerCaseNamesStreamReaderDelegate(xsr));
  
      System.out.println(doc.elements.get(0).abc);
      System.out.println(doc.elements.get(1).abc);
      System.out.println(doc.elements.get(2).abc);
  
  }
  </code></pre>
  
  <p>This actually did not work.</p>
  
  <pre><code>null
  2
  Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
      at java.util.ArrayList.RangeCheck(ArrayList.java:546)
      at java.util.ArrayList.get(ArrayList.java:321)
      at com.hre.commons.tec.xml.LowerCaseElementNamesFilter.main(LowerCaseElementNamesFilter.java:58)
  </code></pre>
  
  <p>For this XML:</p>
  
  <pre><code>&lt;doc&gt;
      &lt;Element ABC="1"&gt;&lt;/Element&gt;
      &lt;element Abc="1"&gt;&lt;/element&gt;
      &lt;element abc="2"&gt;&lt;/element&gt;
  &lt;/doc&gt;
  </code></pre>