2 Replies Latest reply on Aug 18, 2009 10:10 AM by netpagino

    Validating data in XML file


      Hi gang ..


      Just got a project (unfished) which I have to parse & validate an xml document .. the work to be done is as follows:


      1. Gather xml

      2. Parse data

      3. Validate data

      4. Insert data into db

      5. Send message back to browser


      I'm not sure what's the best way to go about accomplishing this in a productive way utilizing all that's out there.

      Any help would be appreciated.  (xml file is enclosed)



        • 1. Re: Validating data in XML file
          TLC-IT Level 3

          I do not know exactly what you mean by "validating data in an XML file."  At first blush, I interpreted your inquiry to mean that you wanted to verify that the XML file was well-formed ... that is to say, conformant to its DTD or Schema.  But on re-reading your post, I'm not sure.


          Certainly, you want to fully employ CF's in-built XML processing and querying capabilities.  (You want to use an XPath search to locate the nodes, for instance...)  As to the subsequent task of thereafter checking the data in those nodes against various business rules, well, that would take more thought.  But do remember (a) that this is very well-trod ground (so "don't re-invent the wheel"), and (b) you have all of Java at your disposal should you require it.

          • 2. Re: Validating data in XML file
            netpagino Level 1

            Thanks for the reply TLC-IT ..


            I agree on not reinventing the wheel .. I'd much rather start the project from beginning instead of what I have in front of me now ..

            I will work to get as best of a result as I can ..


            So for the sake of making sure I have the process correctly, what steps would you follow on the following scenario which is the basis for

            this project ..


            1. User submits request via web app to get latest list of information

            2. Web app makes a call for xml data to be processed: validated against business rules (data type, not nulls, etc)

            3. Upon successful validation a message is sent back to app with success message

            4. Upon errors found a message is sent back to app with errors


            Alternatively .. I will work on some sort of validation for this, however I can't think of a way to validate the data which comes from an xml file & looks to be loaded into an array ..


            Thanks ..