开发者

jqGrid XML data property load

I have a remote XML data generator which emits something like this:

<list>
  <hu.qualitis.opencms.utils.db.DBFile>
    <id>8dc66bf4-c39f-44c5-879d-1f3b16dc2开发者_开发问答9be</id>
    <name>testfile.txt</name>
    ...
    <metadata>
      <property name="lines" value="5"/>
    </metadata>
  </hu.qualitis.opencms.utils.db.DBFile>
</list>

my definition of the xmlReader is as follows

xmlReader: { 
  root: "list",
  row: "hu\\.qualitis\\.opencms\\.utils\\.db\\.DBFile",
  repeatitems: false,
  id: "id"
},

This works OK. My problem is about the metadata part which I cannot access. I tried things like:

colModel :[ 
  {name:'name', index:'name', width:60},
  ...
  {name:'metadata>property>lines', index:'name', width:10}
],

but to no avail.

Is it possible at all to configure the jqGrid XMLReader to read this value, or am I forced to change the generator?

Update

To sum up the responses: my original idea is not possible to implement.

The best solution would be to use JSON. This would be faster also.

An alternative solution is to modify the code which generates the XML. I will go with this, as all my communication is based on XML.

And another solution is to modify the XML with XSLT.


You access attributes of nodes you need to specify the attribute name in square brackets [name] in the xmlmap of the colModel e.g.:-

for node

the name attribute of node property would require xmlmap:"metadata>property>[name]"

the value attribute of node property would require xmlmap:"metadata>property>[value]"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜