cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
827
Views
25
Helpful
6
Replies

Unable to parse XML File in CCX Script Editor

bejjanihady
Level 1
Level 1

Dears;

I am facing an issue with parsing XML files in the CCX Script editor. here is my example:

 

I have the attached XML file containing information of Active Directory Users with some users having Employee ID and others not.

I have manually created an XML file in CCX using "Create XML Document" step as the below: 

D_XML_Doc= Create XML  Document (D_XML_Doc) 

and staticly set: Text["the content of the attached XML"] value in the "D_XML_Doc" Document variable 

 

Now the issue is to extract from this XML document the employee's ID and store them in a variable.

appreciate if someone could help me with this matter. Thank you in advance. 

 

 

 

 

6 Replies 6

I'm by no means an expert in XML file formatting, but that file does not look like anything I've ever seen and does not look like anything we'd used.

Below is an example of an XML file that we're using.
image.png

And the part in the script that read this is shown in the below pictures.
image.png

image.png

One example of the above get data steps.

image.png

image.png

Hopefully this helps you along the way with this.



Response Signature


I don't see where that XML document has an employee ID. Can you specify which is the right element?

 

david

bejjanihady
Level 1
Level 1
Hi David ;

not all user have employee ID you check this example:
"


CN=Nelly
Ghreishy,OU=Users,OU=Lebanon,DC=crystalnetworks,DC=me

CN=Nelly
Ghreishy,OU=Users,OU=Lebanon,DC=crystalnetworks,DC=me
* 6000*
true
Nelly
Nelly Ghreishy
user
fab9f846-e28b-4e8c-ac80-5e3cdeade9f1
NellyGhreishy


S-1-5-21-3490208173-1116838592-846869112-2114

28

N="AccountDomainSid">S-1-5-21-3490208173-1116838592-846869112
S-1-5-21-3490208173-1116838592-846869112-2114


Ghreishy
NellyGhreishy@crystalnetworks.me


"

TO EVERYONE WHO POSTS A QUESTION AND WANTS HELP -please be clear about what you want help with, include valid examples, and what system (CCX, UCCE, PCCE, etc) and version numbers. It'll save everyone's time.

 

Your first  sample XML file was valid XML, but didn't include the item you wanted help finding (employeeID) - so how can we help?

Your second example, wasn't XML at all. So again, how could you expect help with the XPath expression to find the employeeID?

Please be clear and post an example that is actually XML and actually contains the thing you need help finding.
If however, you were just asking for how to do something like XPath and XML parsing in UCCX, then please mark Roger's answer as correct.


Thanks

 

Dear Janine;

 

First, you'd rather recheck the XML file I have attached from the beginning, and there you can find the employees IDs which are empty values for some users but valid values for the others. (you can search for values"10", "6000", "5000", "9000", "1000").

 

second, regarding "what system (CCX, UCCE, PCCE, etc" you can simply check my title "Unable to parse XML File in CCX Script Editor".

 

Thank you anyway for your reply.

 

 

 

 

This XPath expression will give you an array where each item in the array is a <Props> node where EmployeeID is not null (NIL):  /Objs/Obj/Props[S[2]/@N="EmployeeID"]

These 2 XPath expressions will give you the Name and EmployeeID for all employees  where EmployeeID is not null (NIL):

Name: /Objs/Obj/Props[S[2]/@N="EmployeeID"][S[4]]

EmployeeID:  /Objs/Obj/Props[S[2]/@N="EmployeeID"][S[2]]

 

This would give you back the EmployeeID for the name Nelly Ghreishy:
/Objs/Obj/Props[S[2]/@N="EmployeeID"][S[4]='Nelly Ghreishy'][S[2]]

 

HTH