title: Parsing a XML file using C++ stacks/queues
body: <p>Any help would be appreciated, even if it's just a quick idea.</p>
  
  <p>No librarys(besides stl) or external parsers</p>
  
  <p>I am supposed to create a c++ program that will read the data of an XML file and store it in memory but I am having lots of trouble finding a way to do this. I was hoping that I could get some guidance from someone here. Also regex should be used to recognize the file data or split it up.</p>
  
  <p>Tag names do NOT need to be preserved although it would be ideal, just the nesting data, all the data is stored as text (string)</p>
  
  <p>This is an example showing you what I mean by using stacks and queues. However, It would need to be non-specific to this.</p>
  
  <pre><code>&lt;House&gt;                 // tag: push &lt;House&gt; on stack
    &lt;Info&gt;                // tag: push &lt;Coordinates&gt; on stack
      &lt;Code&gt;ABE&lt;/Code&gt;    // element:  push_back on element queue
      &lt;City&gt;Allentown&lt;/City&gt;   // element:  push_back on element queue
      &lt;ID&gt;PA&lt;/ID&gt;         // element:  puch_back on element queue
    &lt;/Info&gt;               // terminator:  pop stack and complete node in queue
    &lt;Exact&gt;               // tag:  push &lt;Exact&gt; on stack
      &lt;X&gt;40.65&lt;/X&gt;        // element:  push_back on element queue
      &lt;Y&gt;75.43&lt;/Y&gt;        // element:  push_back on element queue
    &lt;/Exact&gt;              // terminator:  pop stack and complete node in queue
  &lt;/House&gt;                // terminator:  pop stack and complete node in queue
  </code></pre>
  
  <p>So far, it's pretty lame but I have just been able to set up the file to be read line by line and skip the header by detecting it with regex like this:</p>
  
  <pre><code>string fileline;
  regex header("[&lt;][?](.*?)[?][&gt;]");
  while (getline(ifstreamobj, fileline))
  {
      if (regex_match(fileline, header))
      {
          cout&lt;&lt;"Skipping what appears to be a header"&lt;&lt;endl;
      }
  
      //?
  }
  cout &lt;&lt; "END OF FILE, EOF" &lt;&lt; endl;
  </code></pre>
  
  <p>I don't know really what to do. I guess the stack would be a stack of strings where the tag name would be pushed/popped</p>
  
  <p>And then the queue would be for the actual data in between the tags</p>