Jump to content

[solved]XPath expression XML


karthikin

Recommended Posts

I couldn't get the values of my XML file in my XUL tree. I have a problem with my query expr here: <query expr="*"> <assign anonid="fulltext" var="?FULLTEXT" expr= "concat(Customer-ID,FirstName,LastName,gmail,yahoo,URL,Facebook-ID)"/> </query>Please check my full code below. Thanks for you support in advance.

<tree editable="false" id="myTodoListTree" flex="1" seltype="multiple"datasources="file://D:/xmlparserinxul/final.xml" ref="*" querytype="xml" >         <treecols>            <treecol  id="pde" label="Customer-ID" flex="1" persist="width ordinal hidden"  />                                    <treecol sortActive="true" sort="?name" id="name" label="FirstName" flex="1" persist="width ordinal hidden"  sortDirection="ascending"/>                                       <treecol sortActive="true" sort="?lastname" id="lastname" label="LastName" flex="1" persist="width ordinal hidden" sortDirection="ascending"/>                                          <treecol sortActive="true" sort="?gmail" id="gmail" label="Gmail" flex="1" persist="width ordinal hidden"  sortDirection="ascending"/>                                          <treecol sortActive="true" sort="?yahoo" id="yahoo" label="Yahoo" flex="1" persist="width ordinal hidden"  sortDirection="ascending"/>                                          <treecol  sortActive="true" sort="?url" id="url" label="Facebook" flex="1" persist="width ordinal hidden" sortDirection="descending"/>                                      <treecol  sortActive="true" sort="?pin" id="pin" label="Facebook-ID" flex="1" persist="width ordinal hidden" sortDirection="ascending"/>         </treecols>    <template>          <query expr="*">           <assign anonid="fulltext" var="?FULLTEXT" expr= "concat(Customer-ID,FirstName,LastName,gmail,yahoo,URL,Facebook-ID)"/>        </query>        <rule>          <conditions>            <where id="filter" subject="?FULLTEXT" rel="contains" value="" ignorecase="true" multiple="true" />          </conditions>          <action>        <treechildren id="myTodoListTreeChildren">       <treeitem uri="?">         <treerow>           <treecell label="?Customer-ID"/>           <treecell label="?FirstName"/>           <treecell label="?LastName"/>           <treecell label="?gmail"/>           <treecell label="?yahoo"/>           <treecell label="?URL"/>           <treecell label="?Facebook-ID"/>         </treerow>       </treeitem> </treechildren>     </action>   </rule>    </template>  </tree> 

My xml file:

<CONTACTS><CONTACT><Customer-ID>N65553</Customer-ID><FirstName>John</FirstName><LastName>Killer</LastName><gmail>john.killer@gmail.com</gmail><yahoo/><URL/><Facebook-ID/></CONTACT><CONTACT><Customer-ID>N65560</Customer-ID><FirstName>Karthik</FirstName><LastName>Kayan</LastName><gmail/><yahoo>karthy@yahoo.co.in</yahoo><alcatel-lucent/><URL/><Facebook-ID/></CONTACT></CONTACTS>

Solution : This solution just for FirstName:<query expr="CONTACT"> <assign var="?fname" expr="./FirstName/text()"/> </query><assign var="?fulltext" expr="concat(./FirstName/text());<rule> <conditions> <where id="filter" subject="?fulltext" rel="contains" value="" ignorecase="true" multiple="true" /> </conditions> </rule>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...