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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 01:58:35
Script start
Timing: Jan 18 2025 01:58:35
Module start 'layout'
Timing: Jan 18 2025 01:58:35
Module start 'content'
Timing: Jan 18 2025 01:58:36
Module end 'content'
Timing: Jan 18 2025 01:58:36
Script end

Main resources:

Total runtime1.0353 sec
Peak memory usage4,096.0000 KB
Database Queries55

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0048 589.0313152.6250
Module start 'layout' 0.00480.0031 741.656339.4453
Module start 'content' 0.00781.0261 781.1016525.6094
Module end 'content' 1.03390.0014 1,306.71098.3203
Script end 1.0353  1,315.0313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.2944160.0002
Check MTime0.00130.1259160.0001
Mysql Total
Database connection0.00060.055610.0006
Mysqli_queries0.986595.2866550.0179
Looping result0.00110.1085530.0000
Template Total1.003997.020.5020
Template load0.00170.162720.0008
Template processing1.002296.805520.5011
Template load and register function0.00020.018510.0002
states
state_id_array0.00130.130110.0013
state_identifier_array0.00130.127720.0007
Override
Cache load0.00140.1313230.0001
Sytem overhead
Fetch class attribute can translate value0.00100.095720.0005
Fetch class attribute name0.00170.162930.0006
XML
Image XML parsing0.00060.058020.0003
class_abstraction
Instantiating content class attribute0.00000.000930.0000
General
dbfile0.00130.1237160.0001
String conversion0.00000.000940.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
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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