title: Having trouble spliting the contents of a node in XML when the contents are empty
body: <p>Give the following XML I am trying to split the contents of the "extra" node into four parts by the | delimiter and return the four parts in the response as chdspt(0), chdspt(1), chdspt(2) and chdspt(3). The problem I seem to have is if the XML loaded is missing anything inside the "extra" node then the whole script fails with a 500 error.</p>
  
  <pre><code>&lt;Export&gt;
      &lt;SAVED_EXPORT&gt;
          &lt;id&gt;00-6189&lt;/id&gt;
          &lt;title&gt;00-6189 Start Mech Switch&lt;/title&gt;
          &lt;price&gt;5.46 USD&lt;/price&gt;
          &lt;extra&gt;Male|Adult|Black|medium&lt;/extra&gt;
      &lt;/SAVED_EXPORT&gt;
      &lt;SAVED_EXPORT&gt;
          &lt;id&gt;00-6190&lt;/id&gt;
          &lt;title&gt;00-6190 Start Mech Switch&lt;/title&gt;
          &lt;price&gt;5.46 USD&lt;/price&gt;
          &lt;extra&gt;&lt;/extra&gt;
      &lt;/SAVED_EXPORT&gt;
  &lt;/Export&gt;
  </code></pre>
  
  <p>Note that I removed a lot of the sibling nodes from the XML above as it is too much to post and should be unnecessary for the question at hand.</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim xData,xNewDoc,xmldataout,xmldataout2,title,description,link,gpc,chd,chdspt
  
  url = "http://thesite.com/v/myxml.xml"
  Set xData = Server.CreateObject("Microsoft.XMLHTTP")
  xData.Open "get", url, False
  xData.Send
  Set xNewDoc = xData.responseXML 'ResponseXml returns DOMDocument object
  
  For Each x In xNewDoc.documentElement.selectNodes(".//SAVED_EXPORT")
  
      Dim productid: Set productid = x.selectSingleNode("id")
      Dim pt: Set pt = x.selectSingleNode("title")
      Dim pds: Set pds = x.selectSingleNode("striphtml-description")
      Dim pl: Set pl = x.selectSingleNode("link")
      Dim pe: Set pe = x.selectSingleNode("product_type")
      Dim pri: Set pri = x.selectSingleNode("price")
      Dim psp: Set psp = x.selectSingleNode("sale_price")
      Dim pbr: Set pbr = x.selectSingleNode("brand")
      Dim pcn: Set pcn = x.selectSingleNode("condition")
      Dim pex: Set pex = x.selectSingleNode("expiration_date")
      Dim pwe: Set pwe = x.selectSingleNode("weight")
      Dim ppn: Set ppn = x.selectSingleNode("id")
      Dim pil: Set pil = x.selectSingleNode("image_link")
      Dim pav: Set pav = x.selectSingleNode("availability")
      Dim ppi: Set ppi = x.selectSingleNode("upc")
      Dim pch: Set pch = x.selectSingleNode("extra")
  
      title=Replace(pt.text,"&amp;","&amp;amp;")
      title=Replace(title,"&lt;","&amp;lt;")
      title=Replace(title,"&gt;","&amp;gt;")
  
      description=Replace(pds.text,"&amp;","&amp;amp;")
      description=Replace(description,"&lt;","&amp;lt;")
      description=Replace(description,"&gt;","&amp;gt;")
  
      link=Replace(pl.text,"&amp;","&amp;amp;")
      link=Replace(link,"&lt;","&amp;lt;")
      link=Replace(link,"&gt;","&amp;gt;")
  
      gpc=Replace(pri.text,"&amp;","&amp;amp;")
      gpc=Replace(gpc,"&lt;","&amp;lt;")
      gpc=Replace(gpc,"&gt;","&amp;gt;")
  
      chd = pch.text
      chdspt = split(chd, "|")    
  
  
  xmldataout= "&lt;item&gt;&lt;g:id&gt;" &amp; productid.text &amp; "&lt;/g:id&gt;" &amp; "&lt;title&gt;" &amp; title &amp; "&lt;/title&gt;"
  &amp; "&lt;description&gt;" &amp; description &amp; "&lt;/description&gt;" &amp; "&lt;link&gt;" &amp; link &amp; "&lt;/link&gt;"
  &amp; "&lt;g:google_product_category&gt;" &amp; gpc &amp; "&lt;/g:google_product_category&gt;" &amp; "&lt;g:price&gt;" &amp; pri.text &amp; "&lt;/g:price&gt;" &amp; "&lt;g:sale_price&gt;" &amp; psp.text &amp; "&lt;/g:sale_price&gt;"
  &amp; "&lt;g:brand&gt;" &amp; pbr.text &amp; "&lt;/g:brand&gt;" &amp; "&lt;g:condition&gt;" &amp; pcn.text &amp; "&lt;/g:condition&gt;"
  &amp; "&lt;g:expiration_date&gt;" &amp; pex.text &amp; "&lt;/g:expiration_date&gt;" &amp; "&lt;g:shipping_weight&gt;" &amp; pwe.text &amp; "&lt;/g:shipping_weight&gt;" &amp; "&lt;g:mpn&gt;" &amp; ppn.text &amp; "&lt;/g:mpn&gt;"
  &amp; "&lt;g:image_link&gt;" &amp; pil.text &amp; "&lt;/g:image_link&gt;" &amp; "&lt;g:availability&gt;" &amp; pav.text &amp; "&lt;/g:availability&gt;" &amp; "&lt;g:gtin&gt;" &amp; ppi.text &amp; "&lt;/g:gtin&gt;"
  &amp; "&lt;g:gender&gt;" &amp; chdspt(0) &amp;  "&lt;/g:gender&gt;" &amp; "&lt;g:age_group&gt;" &amp; chdspt(1) &amp; "&lt;/g:age_group&gt;" &amp; "&lt;g:color&gt;" &amp; chdspt(2) &amp; "&lt;/g:color&gt;"
  &amp; "&lt;g:size&gt;" &amp; chdspt(3) &amp; "&lt;/g:size&gt;  &lt;/item&gt;" 
  
  xmldataout2=xmldataout2+xmldataout
  Next
  
  
  Response.ContentType = "text/xml"
  Response.Write("&lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;rss version='2.0' xmlns:g='http://base.google.com/ns/1.0'&gt;&lt;channel&gt;&lt;title&gt;store&lt;/title&gt;&lt;link&gt;http://www.thesite.com&lt;/link&gt;&lt;description&gt;This is a sample feed&lt;/description&gt;" &amp; xmldataout2 &amp; "&lt;/channel&gt;&lt;/rss&gt;")
  
  Set xNewDoc = Nothing
  Set xData = Nothing
  </code></pre>