cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3388
Views
5
Helpful
22
Replies

XML Area Code Script

jbalderrama
Level 1
Level 1

Does anyone have a XML area code script that I can look at?

22 Replies 22

I'm not sure what else I can do for you.  I have given you sample code that works, and all you have to do is take it and run with it.

https://supportforums.cisco.com/message/3408410#3408410

Here's what i'm getting.

From that screen shot it would appear that either:

A) you haven;t given the script an XML file to load

B) the XML file you gave the script is not valid XML

Can you confirm both?  PS you can validate your XML at validator.w3.org

Hi Anthony,

I think you deserve a +5 for all the tips you wrote in this thread.

Gabriel

Thanks Gabriel!

Anthony,

Great example on the Area Code XML Script.  I am new to scripting.  Could you provide direction or clarification of the following set strings.  I am buiding a E164 script not just area code.  I am trying to understand substring(0, 3) and the set xpath configuration..

area_code = calling_number.substring(0, 3)

set xpath = "//AreaCodes[AreaCode=" + area_code + "]/../@value"

If you can provide input it would be much appreciated.

Regards

String.subtring(0, 3) is a method that returns a section of a String.

The first number, 0, is the starting index of the string, and the second number, 3, is how many characters to the right to return.

Example:  "6125551212".substring(0, 3) would return "612".  "6" being index 0, and "612" being 3 characters long.

Now for the XPATH, are you asking how the variables and Strings are put together, or how XPATH works?

set xpath = "//AreaCodes[AreaCode=" + area_code + "]/../@value"

After this is evaluated, the xpath variable should look like this:

"//AreaCodes[AreaCode=612]/../@value"

In XPATH terms, that means:

Find an AreaCodes node, which has an AreaCode child node with a value of 612, and then get the original AreaCodes node's attribute "value".

For more on XPATH, here is a good reference:

http://www.w3schools.com/xpath/xpath_syntax.asp

Solution to my question

https://supportforums.cisco.com/thread/2128707?tstart=0

Anthony,

Customer has standard license.

This does not work with standard license

area_code = calling_number.substring(0, 3)

Is there another method that will give me the first 3 digits of the calling number?

Thanks,

Solomon