UCCX XPath on Get XML Document Data Step always returns null
Hello,
Can someone tell whats wrong with my XPath, because it always returns null. I have tried different variations and nothing. I'm using UCCX 7.0
XML
<?xml version="1.0" encoding="utf-8" ?>
<GetManagersResult xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.labdomain.com/">
<ClaimManagersList>
<X_CLAIM_MANAGER>
<ClaimManagerUserName>test</ClaimManagerUserName>
</X_CLAIM_MANAGER>
</ClaimManagersList>
</GetManagersResult>
XPATH
"/descendant::GetManagersResult/child::ClaimManagersList/child::X_CLAIM_MANAGER/child::ClaimManagerUserName"
During debug, this is the value of the xml document when it reaches the Get XML Document Data step:
TEXT[<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<GetManagersResult xmlns=\"http://www.labdomain.com/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n <ClaimManagersList>\r\n <X_CLAIM_MANAGER>\r\n <ClaimManagerUserName>test</ClaimManagerUserName>\r\n </X_CLAIM_MANAGER>\r\n </ClaimManagersList>\r\n</GetManagersResult>]
It's your XML namespace in the root element.
First off, I have never seen the CRS Editor play nice when XML namespaces are involved.
Secondly, with your namespace in place, not even a generic xpath expression tester can find your data. See attachements.
I think that if you find a way to either: not send, or remove the namespace from your document, your xpath expression will work.
With Namespaces
Without Namespaces
Similar Messages
-
Get XML Document Data step always returns NULL
Hi All,
I was hoping someone might be able to help with this.
I'm writing a holiday script, it uses XML to check whether the date is a holiday or halfday. XML below
<?xml version="1.0" encoding="ISO-8859-1"?>
<Holidays>
<Holiday Date="1/1/2012">Holiday</Holiday>
<Holiday Date="3/1/2012">Halfday</Holiday>
<Holiday Date="6/1/2012">Holiday</Holiday>
<Holiday Date="5/4/2012">Halfday</Holiday>
<Holiday Date="6/4/2012">Holiday</Holiday>
<Holiday Date="8/4/2012">Holiday</Holiday>
<Holiday Date="9/4/2012">Holiday</Holiday>
<Holiday Date="30/4/2012">Halfday</Holiday>
<Holiday Date="1/5/2012">Holiday</Holiday>
<Holiday Date="17/5/2012">Holiday</Holiday>
<Holiday Date="27/5/2012">Holiday</Holiday>
<Holiday Date="6/6/2012">Holiday</Holiday>
<Holiday Date="23/6/2012">Holiday</Holiday>
<Holiday Date="6/4/2012">Holiday</Holiday>
<Holiday Date="3/11/2012">Halfday</Holiday>
<Holiday Date="25/12/2012">Holiday</Holiday>
<Holiday Date="26/12/2012">Holiday</Holiday>
<Holiday Date="19/10/2012">Halfday</Holiday>
</Holidays>
However when I debug the script the result of the Get XML Document step always returns null.
Xpath work great in notepad++
My code is attached, anyone with any pointers?
Regards,
AndyYour XPATH of:
"/Holidays/Holiday[@Date='+DateString+']"
Needs to be:
"/Holidays/Holiday[@Date='"+DateString+"']"
Good luck and happy scripting!
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches. -
Xpath and Get XML Document Data
Good Morning,
I have just recently gotten involved in a project that requires communicating with some web services (axis2). We have existing scripts that handle this already, but they were built when we weren't on axis2 so now the XML output from the web service call is slightly different and i am no longer able to use the same xpath statement in the Get XML Document Data step.
I am receiving either null values or a prefix namespace error. I am new to xpath and have been reading as best i can from http://www.w3schools.com/xpath/ to try and understand how to write my statements to pull out the data i want correctly.
I have read that sometimes the editor has problems if the XML contains namespace declarations, etc.
Below is an example XML output where I'd like to be able to read the value in the ax211:success. My xpath gets prefix namespace errors as it doesn't recognize ax211.
Xpath: /descendant::ns:validateCertificationResponse/child::ns:return/child::ax211:success
Perhaps my xpath statement is just incorrect and wouldn't retrieve what i expect it to....
Any advice is appreciated.
Thanks,
KevinHi,
well, it appears that text() is automatically appended to the XPath query for some reason in UCCX, this is why you actually see the text node within the ax211:success element. This //*[local-name()="success"] select the whole node, not its first child (which is actually the first element, which also happens to be a text).
Anyway,
// - anywhere
* - any node
And within this "everything" you actually search with the condition within the angular brackets.
G. -
Cisco UCCX 10.6 Get XML Document Data XPath count() function
Hi
I'd like to retrieve the number of XML nodes in a document to make a script more efficient.
e.g. with this XML, I'd like to know how many <message> nodes there are:
<messages>
<message>contentA</message>
<message>contentA</message>
<message>contentA</message>
</messages>
I've tried iNodeCount = Get XML Document Data (inputXMLfile, "count(//messages/message)")
If I try this in an XPath expression tester then I get the result I'm expecting - an integer of 3. However, in UCCX this produces the error "Can not convert #NUMBER to a NodeList!"... What am I doing wrong?
ThanksHi,
you may want to use a Set or a Do step to execute Java code.
First, reference the XML file (within the repository) by calling DOC[myFile.xml] and of course, assigning this value to a Document type variable, e.g.:
Set myDocument = DOC[myFile.xml]
Then add a Do step that actually does the XPath part of the job.
There's a nice step by step explanation of it here: http://viralpatel.net/blogs/java-xml-xpath-tutorial-parse-xml/
Remember, you can get the Inputstream object of the myDocument variable using the getInputStream() method on it.
G. -
Has anyone found a way to overcome the SSL certificate error via UCCX editor? See attached screenshots. Thanks!
Hi, not easily, no.
But I guess this has already been discussed/answered by Sam Womack in a later post. What you need to do is talk to TAC and have them upload the client certificate into your UCCX's keystore.
G. -
After tweak bunch of times the argument inside "Get XML Document Data" I´m still not able to obtain a no null value. Could someone help me to find out what i´m doing wrong?
<?xml version="1.0" encoding="UTF-8"?>
<Holidays>
<Holiday>Date=1/2/2013</Holiday>
<Holiday>Date=1/2/2013</Holiday>
<Holiday>Date=8/4/2013</Holiday>
<Holiday>Date=9/4/2013</Holiday>
<Holiday>Date=1/5/2013</Holiday>
<Holiday>Date=17/5/2013</Holiday>
<Holiday>Date=27/5/2013</Holiday>
<Holiday>Date=6/6/2013</Holiday>
<Holiday>Date=23/6/2013</Holiday>
<Holiday>Date=6/4/2013</Holiday>
<Holiday>Date=25/12/2013</Holiday>
<Holiday>Date=26/12/2013</Holiday>
</Holidays>
Xpath:
"/descendant::Holidays/child::Holiday[attribute::symbol='DateString']/child::LAST"
thank in advance.Hi,
The script first obtain today´s date in this format 1/2/2013 and stores in DateString variable. Then create a XML document based on this:
<?xml version="1.0" encoding="UTF-8"?>
Date=1/2/2013
Date=1/2/2013
Date=8/4/2013
Date=9/4/2013
Date=1/5/2013
Date=17/5/2013
Date=27/5/2013
Date=6/6/2013
Date=23/6/2013
Date=6/4/2013
Date=25/12/2013
Date=26/12/2013
that i´ve upload to uccx. it uses get XML Document Data function and stores the result in DataResult variable.
if
DataResult == null meets True it makes a call redirect to an extension
if false that means "1/2/2013" was found inside the XML archive and sends to another extension.
The problem i see through reactive debug is that always return null,
In brief: I do not know how to tell using the function "find 1/2/2013 inside Holidays.xml document"
this is what I putted inside get XML Document Data function:
"/descendant::Holidays/child::Holiday[attribute::symbol='DateString']/child::LAST" -
How to check empty return from Get XML Document Data?
If Get XML Document Data doesn't return a result, how do you test it? String.isEmpty() doesn't do the trick, it still throws the exception "java.lang.NullPointerException". I can't seem to be able to match that up to a cisco exception with a "On Exception Goto" step (which I put right before the XML Document Data step). Any clues anyone?
Hi,
Try this:
variable=Get XML Document Data ()
if(variable == null) then
true
false
Gabriel. -
UCCX GET XML Document data - how to force language path
Hi,
I saw that with UCCX, If the trigger have is language FR_CA, when I will use the Get XML Document Data (docTemp, etc,etc )
It will get the value of the file located in the path of FR_CA in the document management.
Lets say, If the trigger language is FR_CA, Is there any way I can use the GET XML Document to open a file in the EN_CA in the document management ?
How can I do that ?
ps : The upload document have this function, we can force a language but I have no idea how to handle this with the Get XML Document.
ThanksI will attach a screenshot of how you can specify the language folder that the Document lives in, regardless of the language of the Trigger or Contact.
Notice that in the variable I am simply referencing the Document filename. This will assume the language of the Contact.
But also notice that within the step, I am saying that the Source document should be found in the L[en_CA] language folder. This does not change the language of the Contact; it simply tells the system to look in a different folder for the file.
Of course, if your Document is not language specific, you could always put it in the Default language folder and then it will be available to all Contacts regardless of Language setting.
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches. -
Error while getting xml document with default connection in 8iJServer
I had used GZIP utility to zip and store the document in
the CLOB. If i use thin drivers and GZIP to retieve this document it works fine.
instead of thin drivers if i use oracle8iJserver defalut
connection i get the follwing error
:Error while getting xml document Not in GZIP format.
your response is appreciated.
thanks
sanjay.Hi Yepin Jin,
I am facing the same issue did you solved it?
Regards,
Orlando Covault -
Get xml Document result via Toplink.
Hi.
I want to get XML Document result instead of the entities of the table by using the Toplink.
Who have some advices?
Thanks.Please try the toplink forum.
-
Hi guys, I need again your help.
I have many xml documents and I need create a class that "search" data at this xml documents. What I can do this!?!?
For example, I wanna get the Paul ages in the age.xml document!!!!! I wanna create a method like this:
SearchXmlfile search = new SearchXmlFile();
String result = search.get("/person@age[person@attribute = 'paul']"); //I pass the xpath like parameter
Someone know What I can do this?!!?
Just another question. When I create a transformer I set the Source and Result "Objects" (SAX, DOM or Stream). And where i set the xsl file?!!? I am reading the jwsdp tutorial and I don't understand where I configure the xsl file transformer to the transformer object!!!!
Thanks Again.
Giscard.1. For selecting nodes with an XPath expression parse with the JDom parser and select nodes with the XPath class.
http://www.jdom.org/
2. Set the stylesheet in the Transformer.
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new File("c:/input.xml"));
TransformerFactory tFactory =
TransformerFactory.newInstance();
StreamSource stylesource = new StreamSource(stylesheet);//Set the Stylesheet
Transformer transformer = tFactory.newTransformer(stylesource);
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(System.out);
transformer.transform(source, result); -
How do we get the change document data to be used in a workflow,
I have made entry in swec , there i associated the change object and my zbo delegeted from standard bo and specified the event as "on change". now i want to send a mail using this changed data.
I have two options either i use an exit fm to trigger the mail or use a workflow to trigger tha mail, but how do i use the changed data that i get from cdhdr, i need to specify these fields in tha mail body.
or if i choose to use an exit fm how to do it.
regards,
кu03B1ятu03B9кHello,
Create a new background method in the ZBO to get all the required details from CDHDR and CDPOS tables. Export them from the method as separate variables or as an internal table.
Create a task in the workflow to execute this method before the sendmail step. Once the data is exported from the method, it is going to be available in the workflow container and so you can use the same in the SENDMAIL step.
Hope this will help.
Thanks,
Samson -
How to get xml-document in 10g in simplest way ?
Hi,
I'm new in xml, there are so many tools to work with xml:
what is the simplest way to get a xml-file from 10g-database ?
I have : 10g R2 and a xsd.file to describe the xml-structure
thank you
NorbertThere is no automatic way to generate XML documents from an arbitary set of relational tables using the information contained in an XML Schema. Typically the easiest way to generate XML from relational data is to use the SQL/XML operators (XMLElement, XMLAGG, XMLAttribtues, XMLForest). There are many examples of using these operators in the forums You can validate the generated XML against the XML Schema by registering the XML Schema with XML DB and then using the XMLType.SchemaValidate() method
-
Using XPath I can read a particular node of an XML document through JAVA program. However, is it possible to Update the value of the node, just read from XML doc, using XPath expressions ?
That is blatant misinformation. Xpath is used all the time to select nodes from a document. The returned nodes are references to parts of the document, therefore this it should be easy to update any part of it having retrieved the required nodes.
-
Database table updation with XML Document data
import java.io.*;
import java.lang.*;
import java.net.URL;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import oracle.xml.sql.dml.OracleXMLSave;
import org.w3c.dom.Document;
public class updateXMLData
public static void main( String argv[] ) throws SQLException,Exception
String tabName = "emp";
Connection conn = null;
String xmlString;
Document doc;
URL filename;
try
//init a JDBC connection using Oracle's JDBC Drivers
String host = "maple"; // change,these won't work
String port = "1521";
String sid = "PBSI";
String s1 = "jdbc:oracle:thin:@" + host + ":" + port + ":" + sid;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection( s1,"scott","tiger");
// Instructions for updating the database rows from XML Document
OracleXMLSave sav = new OracleXMLSave(conn,tabName);
filename = sav.getURL("pbsiempupd.xml");
sav.setRowTag("EMP");
String[] tempArr = new String[2];
tempArr[0]="EMPNO";
tempArr[1]="ENAME";
sav.setKeyColumnList(tempArr);
sav.setUpdateColumnList(tempArr);
int noRows = sav.updateXML(filename);
System.out.println("No of rows updated : " + noRows);
catch (SQLException se)
System.out.println("An SQL exception has occured ");
System.out.println("The error code is : " + se.getErrorCode());
System.out.println("The SQL State is : " + se.getSQLState());
System.out.println("The message is : " + se.getMessage());
catch (Exception e)
System.out.println("Unknown exception has occured");
System.out.println("The class is : "+ e.getClass());
System.out.println("The message is : "+e.getMessage());
finally
if (conn != null) conn.close();
The input XML Document is given below :- in 'pbsiempupd.xml'
<?xml version="1.0"?>
<ROWSET>
<EMP>
<EMPNO>8888</EMPNO>
<ENAME>RAO THOTAKURA</ENAME>
</EMP>
<EMP>
<EMPNO>9999</EMPNO>
<ENAME>BAVA MANI</ENAME>
</EMP>
<EMP>
<EMPNO>7777</EMPNO>
<ENAME>SRINIVAS M</ENAME>
</EMP>
</ROWSET>
After executing this class with 'java updataXMLData' I'm getting following runtime error message :-
Unknown exception has occured
The class is : class oracle.xml.sql.OracleXMLSQLException
The message is : Exception 'java.sql.SQLException:Missing IN or OUT parameter at index:: 1'
encountered during processing ROW element 0All prior XML row changes were rolled back.
in the XML document.
Please anybody could explain how to solve it.
Thanks
Sambasivarao ThotakuraSee my reply to your other question. thanks.
Maybe you are looking for
-
I have not tried resetting Firefox 31.0 as I do not want to lose any of the thousands of bookmarks. It also hangs forever whenever I try to go to the bookmarks drop down just to go to a bookmark or even "Show all bookmarks" to create an exported .htm
-
How can i make a calendar in dreamweaver cs5.5?
how can i make a calendar in dreamweaver cs5.5 ?
-
Hello I have a problem with sp12. I can not see the adapter in the monitoring. I now some people have the same problem in this forum. I have made all this steps. Then i have the adapter in the monitoring. I have use the program rsxmb_activate_icf_se
-
Correct receipts for PO which is finally closed
Hi Sir, What's the steps to correct receipts for POs having status of "Finally Closed"? I look forward to hearing from you soon. Kind regards, James
-
Arsenic free glass in laptops? What exactly does it mean?
Apple announces that its laptops use arsenic free glass. What is the difference in comparison with the other, conventional glass? That is, what +amount of arsenic (per computer)+ is eliminated in Apple laptops compared to laptops built with the conve