Sunday, April 4, 2010

xpath behaves differently in CS4?

Using the bookstore example from the Tools guide I get different results using this code with CS 3 and CS4

var Docdatafile=File(''/test.xml'');

var myResult = Docdatafile.open(''r'', undefined, undefined);

var temp = Docdatafile.read();

var docdata=new XML (temp);

book=docdata.xpath(''//title[@lang]'');

alert(book);

CS3 gives me ''enenenen'' which is what I expect whereas CS4 returns the complete title object. I am not completely sure what xpath is supposed to return in this case. (Actually I need to get the name of a publication where name is an attribute of a publication node.)

To formulate differently: Is there a way to get the attribute name out of an XML object with xpath that works the same way in CS3 and CS4?

Thank you,

Ralf

xpath behaves differently in CS4?

book=docdata.xpath(''//title/@lang'');

seems to work for both CS3 and CS4.

Ralf

  • pores
  • No comments:

    Post a Comment