Jump to content
Sign in to follow this  
karthikin

[solved]XPath expression XML

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>

Edited by karthikin

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...