Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Community Member

Compare data in xml file using IP IVR

Hi

I wonder if any of you skilled peoples in this community have any idea on how to use xml in a "catch and dispatch" feature.

I have today a working holiday script that uses an xml file to compare the current date with a date in the xml file and to report it back to the IP IVR script to set a tru or false statement. However i would like to modify this a bit.

I would like to do the following in a new script. A customer dials in and enters his or hers ordernumber consisting of 5 to 10 numbers, this number should then be checked towards an xml file containing approx. 2500 different ordernumbers. If it finds a match it will report back to the crs script that it was a true statement perhaps? and also to what phone number it should be routed to. For the phone number i will use 3 different ones for all these ordernumbers to route to and if i also can add that to the xml file together with the order numbers i can have an pretty easy file to maintain. I would then also not have to use a huge amount of if statements.

Is this possible in some way or how should i do it? The thought is also for the customers themselfs to maintain this xml file and to upload it to the IP IVR, that´s not hard to accomplish but that´s why i don't go for an sql database.

Thanks in advance

Br Patrik

Everyone's tags (1)
6 REPLIES

Re: Compare data in xml file using IP IVR

I assume you do not have Premium, otherwise a database connection sounds like a better solution for 3,000 orders to handle.  However, if you have Enhanced, then this sounds like it would work to me.

Just don't implement a loop to search through your XML file like you are probably doing in the holiday file.  Checking 2499 account numbers just to finally get the one you want is a bit much, don't you think?

Do something like this:

XML:

    

         

              

                    0-111-02

                    Black Shirt

                    1

              

              

                    0-109-00

                    Blue Jeans

                    1

              

         

    

    

         

              

                    0-111-03

                    Red Shirt

                    1

              

         

    

XPath to first item number in desired order:

"/descendant::Orders/child::Order[attribute::number=" + accountNumber + "]/child::Items/child::Item[attribute::sequence=" + itemCount + "]/child::Number"

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
Community Member

Re: Compare data in xml file using IP IVR

Thanks for your reply Anthony. This will be helpful and i will try it out.

Re: Compare data in xml file using IP IVR

I'd like to revise my response, and thank Jonathan Schulenberg for his wisdom, however no part of this message is speaking for him, these are solely my own thoughts:

XML:

    

         

              

                    Black Shirt

                    1

              

              

                    Blue Jeans

                    1

              

         

    

    

         

              

                    Men's Red Shirt

                    1

              

         

    

XPath to last item's description in order 67890:

"//Order[@number='" + orderNumber + "']//Item[last()]/Description"

That's a lot cleaner.  It basically reads: "From order number 67890's last item, give me the description."

Do be mindful of the size of the file as it could cause performance issues, however, you could run your xml file through a mini-fier before uploading it.

...Men's Red Shirt...

Xpath is a little uglier, but it's not a end user facing component so you can weigh you options:

"//o[@n='" + orderNumber + "']/i"

That one order weighs in at about 60 bytes.  The more verbose one above weighs in at about 135 bytes.  That's a 56% reduction in size.

You could feasibly squeeze 3,000 orders in under a 200KB file.

Speaking of loading files into memory.  If the document is stored in the resposity it would make since that it is loaded once into memory, and called from memory each time it's requested.  There's no need to read from disk every time it's called (or load it multiple times for that matter), as that's what an upload or refresh to the repository should indicate.

Could a Cisco representative help us out on this issue of documents from the repository being loaded into memory?

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
VIP Super Bronze

Re: Compare data in xml file using IP IVR

xml file containing approx. 2500 different ordernumbers

The MIVR subsystem has to load a copy of this XML document into the Java heap for every call that calls in. A file with 2500 unique orders and supporting data could be substantial. You should think carefully if this is really how you want to do this as it could have a significant impact on your IPIVR server.

If it finds a match it will report back to the crs script that it was a true statement perhaps? and also to what phone number it should be routed to.

You may want to look at my replies (number two, five and ten) to this thread for an example similar to this: https://supportforums.cisco.com/message/1323743#1323743 The idea is to use Xpath and predicates to select the desired element within the XML file. If the returned value by the Get XML Document Data step is null, then a match was not found.

The thought is also for the customers themselfs to maintain this xmlfile and to upload it to the IP IVR, that´s not hard to accomplish butthat´s why i don't go for an sql database.

If this is XML file is dynamic, it probably does not make sense to store this in the Document Repository. Retrieving it from an external application through a Create URL Document step makes more sense. In my opinion, this type of work is better suited for an ODBC database connection though. Maintaining the XML files is extra work where as this data presumably already exists in a database.

Community Member

Re: Compare data in xml file using IP IVR

Thanks for your reply Jonathan. I will check out your other tread and look for tips there.

Re: Compare data in xml file using IP IVR

Wow, this is excellent information.  Your XPath syntax is groundbreaking for me.  I took the example in the book as gospel, and here you are opening my eyes to a whole new way to handle XML files.  Nice work.

Anthony Holloway

Please use the star ratings to help drive great content to the top of searches.
1006
Views
7
Helpful
6
Replies
CreatePlease to create content