Forum Discussion

radhika1's avatar
radhika1
Contributor
7 years ago

Query on xsi-type

 Hi All,

 

Please let us know how to write xpath for the below.

i wrote it but it is not working.

//bc:infos/bc:info[contains(@type,"bc:bc:FieldInfo)]/bc:infoKey

 

<bc:infos>
<bc:info xsi:type="bc:FieldInfo">

<bc:infoKey>xsdddd</bc:infoKey>

    • JHunt's avatar
      JHunt
      Community Hero

      Hi radhika1,

       

      This should work...

      //bc:infos/bc:info[@xsi:type='bc:FieldInfo']/bc:infoKey

      At least it does match to:

      <bc:infos xmlns:bc="blah" xmlns:xsi="foo">
          <bc:info xsi:type="bc:FieldInfo">
              <bc:infoKey>xsdddd</bc:infoKey>
          </bc:info>
      </bc:infos>
      Element='<bc:infoKey xmlns:bc="blah">xsdddd</bc:infoKey>'
      

       

      • radhika1's avatar
        radhika1
        Contributor

        i am getting the below error

         

         

        java.lang.RuntimeException: net.sf.saxon.trans.XPathException: XPath syntax error at char 71 on line 2 in {...:info[@xsi:type='ac:FieldIn...}: Prefix xsi has not been declared error at line: 26