xml - Comparison of Two XPath Values Even When One Does Not Exist -


I am looking for a way to compare two XPath (version 1.0) values ​​with two different XMLs , Even when no one is present

One of the generated XML always returns with an XML element value or an empty tag, i.e.

  & lt ; Products & gt; & Lt; Name & gt; ProdName & lt; / Name & gt; & Lt; Eid & gt; 3388 & lt; / Id & gt; & Lt; / Products & gt;  

or

ProductName ), < / P>
  & lt; ProductDetail & gt; & Lt; ProductName & gt; ProdName & lt; / Product name & gt; & Lt; ProductPrice & gt; 4820.99 & lt; / ProductPrice & gt; ... & lt; / ProductDetail & gt;  

Get it when ProductName ,

  & lt; ProductDetail & gt; & Lt; ProductPrice & gt; 4820.99 & lt; / ProductPrice & gt; ... & lt; / ProductDetail & gt;  

If nodes exist, the comparison is simple,

  // interest_node / product / name / text ()  

and

  // interest_node / productdetail / product_name / text ()  

What are the two XPath expressions, one of the first XML documents from the node Get the price and compare it with the value of the node in the other XML document, even when there is no node in the second expression? Is there an XPath 1.0 function that meets a condition if a condition is met, otherwise the other value (such as decode () of Oracle)?

I got around XPath 1.0 with the trick:

  concat (Substring (// interest_node/ProductDetail/ProductName/text (), number (exists (// interest_node/productetail/productname/text ()) * string-length (// interest_node / productdetail / product_name / text () ), Then enter it in the  // interest_node / product / name / text ()  

compare with

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -