title: How to get an array of attributes when there is whitespace characters between the name and value?
body: <p>I'm trying to get an array of attributes and I'm splitting on the whitespace character. What I have works fine except when namespaces are involved. Here is my sample code: </p>
  
  <p>XML:  </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:node something xmlns:s = "library://ns.adobe.com/flex/spark" 
  xmlns:b='testnamespace.com' xmlns="noprefix.com"&gt;&lt;/node&gt;
  </code></pre>
  
  <p>Exmascript:  </p>
  
  <pre><code>var xmlString:String = 'something xmlns:s = "library://ns.adobe.com/flex/spark" xmlns:b='testnamespace.com' xmlns="noprefix.com"';
  var attributes:Array = xmlString.split(/\s+/g);
  </code></pre>
  
  <p>That results in this array of items: </p>
  
  <pre><code> - something
   - xmlns:s
   - =
   - "library://ns.adobe.com/flex/spark"
   - xmlns:b='testnamespace.com'
   - xmlns="noprefix.com"
  </code></pre>
  
  <p>How would I split the attributes up when there are spaces between the name and value? </p>
  
  <p>PS:<br>
  I have an XML parser but it throws an error because of mismatched namespaces. So I have to parse the attributes and remove or fix invalid namespaces and then I can pass it the XML string. </p>
  
  <p>PSS:<br>
  I only need to work with the first tag to add the namespaces. I'm not doing any other string manipulations.</p>