01-18-2022 01:11 AM
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.
01-18-2022 01:36 AM - edited 01-19-2022 12:13 AM
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.
And the part in the script that read this is shown in the below pictures.
One example of the above get data steps.
Hopefully this helps you along the way with this.
01-18-2022 06:10 PM
I don't see where that XML document has an employee ID. Can you specify which is the right element?
david
01-19-2022 12:02 AM
01-19-2022 07:00 AM
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
01-20-2022 12:39 AM
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.
01-24-2022 08:23 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide