Ext


Go Back   Ext JS Forums > Ext JS Community Forums (2.0) > Ext 2.x: Help

Reply
 
Thread Tools
  #1  
Old 10-31-2007, 06:20 AM
onawave onawave is offline
Ext User
 
Join Date: Aug 2007
Posts: 32
onawave is on a distinguished road
Default Can I use Cocoon as a datasource?

Hello,

I am going back and forth working on UI widgets but then back to look at my JSP java backend as I am unsure what ExtJS can handle.

I have other systems that use Apache Cocoon to serve the data or content based on a 'sitemap.xmap. file.

The 'XML' returned looks like this:

<dir:directory name="Music" lastModified="1193753209125" date="30/10/07 14:06" size="0" sort="name" reverse="false" requested="true">

    <
dir:directory name="Amy Winehouse" lastModified="1193676529130" date="29/10/07 16:48" size="0">
        <
dir:directory name="Back to Black" lastModified="1193676529130" date="29/10/07 16:48" size="0">
            <
dir:file name="01 Rehab.mp3" lastModified="1170067706000" date="29/01/07 10:48" size="8604778"/>
            <
dir:file name="02 You Know I'm No Good.mp3" lastModified="1170067702000" date="29/01/07 10:48" size="10294378"/>
            <
dir:file name="03 Me & Mr Jones.mp3" lastModified="1170067650000" date="29/01/07 10:47" size="6134639"/>
            <
dir:file name="04 Just Friends.mp3" lastModified="1170067712000" date="29/01/07 10:48" size="7739602"/>
            <
dir:file name="05 Back to Black.mp3" lastModified="1170067698000" date="29/01/07 10:48" size="9659080"/>
            <
dir:file name="06 Love Is a Losing Game.mp3" lastModified="1170067704000" date="29/01/07 10:48" size="6223455"/>
            <
dir:file name="07 Tears Dry on Their Own.mp3" lastModified="1170067710000" date="29/01/07 10:48" size="7464794"/>
            <
dir:file name="08 Wake Up Alone.mp3" lastModified="1170067706000" date="29/01/07 10:48" size="8886900"/>
            <
dir:file name="09 Some Unholy War.mp3" lastModified="1170067574000" date="29/01/07 10:46" size="5714590"/>
            <
dir:file name="10 He Can Only Hold Her.mp3" lastModified="1170067708000" date="29/01/07 10:48" size="6663357"/>
            <
dir:file name="11 Addicted.mp3" lastModified="1170067684000" date="29/01/07 10:48" size="6611112"/>
        </
dir:directory>
    </
dir:directory>    
</
dir:directory
One example of XML being returned refers to Directory structures. Normally an .xslt stylesheet would be used to format the XML but I would like to read it using a TreeLoader.

But I read somewhere ExtJS doesn't like the ":" in XML. Is this true? Makes it a little hard for me to use Apache Cocoon if this is the case so just wanted to be sure. As far as I know the ":" is a standard part of the XML generator within Cocoon, so changing it would be difficult.

Thanks for helping,
Mark
Reply With Quote
  #2  
Old 10-31-2007, 07:27 AM
JeffHowden's Avatar
JeffHowden JeffHowden is offline
Ext JS - Community Support Team
 
Join Date: Mar 2007
Location: Forest Grove, OR
Posts: 1,035
JeffHowden is on a distinguished road
Send a message via MSN to JeffHowden Send a message via Yahoo to JeffHowden
Default

Yeah, XML namespaces aren't supported. Your options are to process the XML that cocoon returns and:
  1. Do a quick and dirty search and replace on dir: changing it to just dir.
  2. Transform the XML using XSLT to non-namespaced XML.
  3. Transform the XML using XSLT to JSON

Personally, if it was me, I'd go with the last option as the payload size is smaller and the parsing time is many times less (evaling some JSON takes no time compared to parsing an XML doc).
__________________
Jeff Howden
Ext JS - Support Team Volunteer
jeff@extjs.com

Any and all code samples that are authored by me and posted on the Ext forums or website are hereby released into the public domain and I release anyone or entity of liability by using said code samples unless explicitly stated otherwise.

Opinions are mine and not necessarily endorsed by Ext, LLC. Please do not contact me directly for assistance unless requested by me.
Reply With Quote
  #3  
Old 10-31-2007, 11:53 AM
onawave onawave is offline
Ext User
 
Join Date: Aug 2007
Posts: 32
onawave is on a distinguished road
Default

Thanks for the info.

I will have a search for info on converting xml to json using xslt.

Not used xlst before so any pointers for where to look would be great.

Thanks for your help.

Mark
Reply With Quote
Reply

Thread Tools

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

All times are GMT -5. The time now is 05:56 AM.

© 2006-2009 Ext, LLC
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.