Forums / Setup & design / Fetching an xml from an URL

Fetching an xml from an URL

Author Message

Jorge estévez

Wednesday 07 April 2010 5:18:44 am

Hello,

 

I have this javascript that loads an xml from a file

 

As loading from a file is a rather a bad solution to maintain in a changing ez project I have made the arrangements to generate the xml when a viewmode is used ..content/view/xml, so when a node of certain class-type is accessed by this view-mode I get my xml in the correct format (as the code of the page).

 

Now the problem, the url that leads to the page with the xml is something like http://MYSITE/uh/index.php/esl/content/view/xml/229 . The main difference is that when loaded from a file the name of the file is xxx.xml but in this case I need to access from the javascript the content (code) of the page …

 

I need to fetch the XML content from an url with the custom-viewmode of the node,

How can I do this?

 

thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Gaetano Giunta

Thursday 08 April 2010 12:35:01 am

Sorry, could you rephrase what your problem is? It is not very clear... Js can load xml files via http requests, regardless of their filename

As for your setup:

- you probably need to alter the content-type header sent along with the xml for things to work properly: set up a new layout and use an url like /layout/set/xml/node/view/xml/229 (see layout/set/print as an example)

- if /layout/set/xml/node/view/xml/229 is a bit ugly, you can set up a wildcard rewrite rule to have eg. /xmlview/229 as url

- if you want to omit the node id and use the node name instead, you can set up a separate siteaccess, with an 'xml' design as main design (where the xml template is the full one), and where the content-type header is sent via the parameters in site.ini; Thius the url could become http://mysite/index.php/xml/path/to/the/node.xml (just name the node with a trailing xml)

Principal Consultant International Business
Member of the Community Project Board

eZ debug

Timing: Jan 18 2025 00:09:32
Script start
Timing: Jan 18 2025 00:09:32
Module start 'content'
Timing: Jan 18 2025 00:09:33
Module end 'content'
Timing: Jan 18 2025 00:09:33
Script end

Main resources:

Total runtime1.0901 sec
Peak memory usage4,096.0000 KB
Database Queries56

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0078 588.8281180.8359
Module start 'content' 0.00781.0655 769.6641530.6875
Module end 'content' 1.07330.0168 1,300.351642.2656
Script end 1.0901  1,342.6172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00280.2567140.0002
Check MTime0.00130.1148140.0001
Mysql Total
Database connection0.00080.073110.0008
Mysqli_queries1.034194.8614560.0185
Looping result0.00070.0624540.0000
Template Total1.060597.320.5302
Template load0.00190.176520.0010
Template processing1.058597.101820.5293
Template load and register function0.00030.026810.0003
states
state_id_array0.00100.087210.0010
state_identifier_array0.00070.062720.0003
Override
Cache load0.00160.1449230.0001
Sytem overhead
Fetch class attribute can translate value0.00100.091820.0005
Fetch class attribute name0.00130.123130.0004
XML
Image XML parsing0.00090.081820.0004
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00580.5348180.0003
String conversion0.00000.000730.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
3content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs