6 Replies Latest reply on Jun 1, 2010 5:39 AM by SimonGIS

    Noob: Search --> Display XML in a component

    SimonGIS

      So ive got an XML file that looks something like this:

      <Bugs>
      <ID>1</ID>
      <Key>COMO-1956</Key>
      <Summary>This bug is about this and that</Summary>
      <Status>Resolved</Status>
      <Resolution>Fixed</Resolution>
      <Created>2010-05-21T08:30:00</Created>
      </Bugs>


      There are a few more fields than that, but you get the jist.
      Its a huge XML document pulled from our Issue Mgmt System (well around 600 bugs).

      Now I am happy to pull this XML file from the system periodically, and I would like to dump the XML on our web-server and design a nice & simple front end web app to search on the KEY field to pull up the info on a specific bug. (perhaps display in a DataGrid?)

      = Not too sure on how to search on a tag in XML and pull out just the info relating to that 'record'


      Now, I am a rookie web developer with basic HTML/JS/CSS skills.
      I was hoping to use this as an excuse to start doing some self development with Flex as I assume its not the trickiest of applications to design?

       

      Now, ideally I would like to find a similar template application to hack apart and plug my XML in.

       

      Has anyone got any basic applications to get me going?

      Any other advice on how to go about this, would really be appreciated.

       

       

        • 1. Re: Noob: Search --> Display XML in a component
          UbuntuPenguin Level 4

          So what is your question , how to parse xml , how to search xml , how to present xml ... ?

          • 2. Re: Noob: Search --> Display XML in a component
            SimonGIS Level 1
            So what is your question , how to parse xml , how to search xml , how to present xml ... ?

            Haha - TBH, all 3 of those 

             

            I guess the first step, would be to:

            - add a text box and button onto a page

            - When button clicked, take the text string and throw it into a query that searches a standalone XML file

            ???

            • 3. Re: Noob: Search --> Display XML in a component
              UbuntuPenguin Level 4

              Oh , that sounds relatively easy.  If you go online you can find some great tutorials detailing everything you mentioned except for the "search algorithm".  Here is an example of loading an xml file.  Where you see they have the buttons and tilelist you should replace with your UI specifications.  All in all it should be really easy to reverse engineer to your needs.

               

              http://blog.flexexamples.com/2008/03/29/dynamically-loading-xml-files-using-the-httpservic e-tag/

               

              If this post was helpful , please mark it as such.

               

              Sincerely ,

              Ubu

              1 person found this helpful
              • 4. Re: Noob: Search --> Display XML in a component
                GordonSmith Level 4

                What does the second bug look like? Do the <ID>, <Key>, etc. for it just follow sequentially after the <ID>, <Key>, etc. for the first bug? That would be a very strange XML design. Is there really no <Bug> tag around the tags which describe one bug, to indicate a "record"?

                 

                Gordon Smith

                Adobe Flex SDK Team

                • 5. Re: Noob: Search --> Display XML in a component
                  SimonGIS Level 1
                  What does the second bug look like?

                  Good point.

                  So for info, I got this XML by exporting a XLS from JIRA (Issue Mgmt System).

                  I then imported this into an Access db and exported it to XML. 

                  This seems long-winded, but I can automate that with some VBA/scheduled tasks.

                   

                  Here is a few bugs together, as they appear in the XML:

                   

                  <Bugs>
                  <ID>4</ID>
                  <Key>COMO-1942</Key>
                  <Summary>While editing a Search query, breaks</Summary>
                  <Issue_x0020_Type>Bug</Issue_x0020_Type>
                  <Status>Resolved</Status>
                  <Resolution>Fixed</Resolution>
                  <Created>2010-05-12T17:08:00</Created>
                  </Bugs>
                  <Bugs>
                  <ID>5</ID>
                  <Key>COMO-1941</Key>
                  <Summary>Selection Review ---&gt; Export to pdf throws error.</Summary>
                  <Issue_x0020_Type>Bug</Issue_x0020_Type>
                  <Status>Closed</Status>
                  <Resolution>Fixed</Resolution>
                  </Bugs>
                  <Bugs>
                  <ID>6</ID>
                  <Key>COMO-1934</Key>
                  <Summary>Unable to add Typeahead and combobox queries</Summary>
                  <Issue_x0020_Type>Bug</Issue_x0020_Type>
                  <Status>Closed</Status>
                  <Resolution>Fixed</Resolution>
                  </Bugs>
                  

                   

                  Is this not correct/clean XML?  Is the format wrong?  I guess I need to ensure the raw XML is correct before trying to mess around with it in Flex.

                  Please advise.

                  • 6. Re: Noob: Search --> Display XML in a component
                    SimonGIS Level 1

                    I found the Tour de Flex which has been helping me a lot.

                    More specifically, this HTTPService sample looks like a good place to start.

                     

                    Ive got the sample working in Flashbuilder 4, but having trouble trying to reverse engineer it to work with my XML (see above)

                     

                         <mx:DataGrid dataProvider="{srv.lastResult.catalog.product}" width="100%" height="513">
                              <mx:columns>
                                   <mx:DataGridColumn dataField="ID" headerText="ID"/>
                                   <mx:DataGridColumn dataField="Key" headerText="COMO"/>
                              </mx:columns>
                         </mx:DataGrid> 
                    

                     

                    Now I imagine this might not be working because my of my XML format.

                    Is my XML a bad format, or can I tweak the above code to work with my XML.

                     

                    Once I get this sorted, I can move onto searching the XML on the Key field and just displaying the relevant record in either a datagrid or perhaps someone can suggest a better component to embed the results in?