08-17-2022 10:40 PM
Hello,
This code is returning null in UCCX Editor but working in Eclipse, it returns an array of string. I should take anything in consideration while using this code inside UCCX? MyArray is defined as array of string from UCCX side.
javax.xml.parsers.DocumentBuilder builder = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder();
org.xml.sax.InputSource src=new org.xml.sax.InputSource();
src.setCharacterStream(new java.io.StringReader(s));
org.w3c.dom.Document doc = builder.parse(src);
org.w3c.dom.NodeList nodeList = doc.getElementsByTagName("Data1");int nl=nodeList.getLength();
javax.xml.xpath.XPath xpath =javax.xml.xpath.XPathFactory.newInstance().newXPath();
javax.xml.xpath.XPathExpression expr = xpath.compile("//Data1/Data2/Data3");
org.w3c.dom.NodeList List = (org.w3c.dom.NodeList) expr.evaluate(doc, javax.xml.xpath.XPathConstants.NODESET);
for (i = 0; i <=nl-1; i++) {
org.w3c.dom.Node node = List.item(i);
MyArray[i]=node.getTextContent();
}
return MyArray;
One more question, how can i return exceptions using java in UCCX.
Thanks
Solved! Go to Solution.
09-08-2022 11:54 AM
This isn't exactly what you are asking, but I think you would be better off parsing the XML with a step instead of try to do it in Java. I have had a hard time getting info out of Java back to the CCX script. Check out something like this post.https://community.cisco.com/t5/contact-center/uccx-xml-file-parsing-failed/td-p/2552944
09-08-2022 11:54 AM
This isn't exactly what you are asking, but I think you would be better off parsing the XML with a step instead of try to do it in Java. I have had a hard time getting info out of Java back to the CCX script. Check out something like this post.https://community.cisco.com/t5/contact-center/uccx-xml-file-parsing-failed/td-p/2552944
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