Fixed FELIX-3131
Use LinkedHashMap to guaranty that the element and attribute order is the insertion-order

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1175368 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java b/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java
index ba2ac5b..85e5a47 100644
--- a/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java
+++ b/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java
@@ -1,4 +1,4 @@
-/* 
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -22,6 +22,7 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -49,14 +50,14 @@
      * The map key is the qualified name of the attribute (<code>ns:name</code>)
      * The value is the attribute object.
      */
-    private Map m_attributes = new HashMap();
+    private Map m_attributes = new LinkedHashMap();
 
     /**
      * The map of the sub-element of the element (element name -> {@link Element}.
      * The map key is the element qualified name (ns:name).
      * The value is the array of element of this name.
      */
-    private Map m_elements = new HashMap();
+    private Map m_elements = new LinkedHashMap();
 
     /**
      * Creates an Element.
@@ -133,14 +134,14 @@
      * Returns the value of the attribute "name" of the namespace "ns".
      * @param name the name of the attribute to find
      * @param ns the namespace of the attribute to find
-     * @return the String value of the attribute, or 
+     * @return the String value of the attribute, or
      * <code>null</code> if the attribute is not found.
      */
     public String getAttribute(String name, String ns) {
         name = ns.toLowerCase() + ":" + name.toLowerCase();
         return getAttribute(name);
     }
-    
+
     /**
      * Gets the qualified name of the current element.
      * @return the qualified name of the current element.
@@ -226,7 +227,7 @@
     }
 
     /**
-     * Gets the elements array of the element type given in parameter. 
+     * Gets the elements array of the element type given in parameter.
      * This method looks for an empty namespace.
      * @param name the type of the element to find (element name)
      * @return the resulting element array (<code>null</code> if the search failed)
@@ -260,7 +261,7 @@
     }
 
     /**
-     * Does the element contain a sub-element of the type given in parameter. 
+     * Does the element contain a sub-element of the type given in parameter.
      * @param name the type of the element to check.
      * @param ns the namespace of the element to check.
      * @return <code>true</code> if the element contains an element of the type "name"
@@ -280,7 +281,7 @@
     public boolean containsAttribute(String name) {
         return m_attributes.containsKey(name.toLowerCase());
     }
-    
+
     /**
      * Gets the XML form of this element.
      * @return the XML snippet representing this element.
@@ -308,7 +309,7 @@
         } else {
             xml.append("<" + m_nameSpace + ":" + m_name);
         }
-        
+
         Set keys = m_attributes.keySet();
         Iterator it = keys.iterator();
         while (it.hasNext()) {