Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Displaying xml
Hi,

I'd like to display my results as an xml page. Is there a way I can do this
using Smarty (in use for the rst of my sites)?

My tpl file looks like this:

<?xml version='1.0' encoding='utf-8'?>
<Documents>
<result_size>{$itemcount}</result_size>
{section name=nr loop=$results}
<record id='{$results[nr].tr_id}'>
<AUTHOR>{$results[nr].sa}</AUTHOR>
{$results[nr].sa}
<TITLE>{$results[nr].st}</TITLE>
{$results[nr].ea}
<FRAGMENT_AUTHOR>{$results[nr].ea}</FRAGMENT_AUTHOR>
{$results[nr].vol}
<FRAGMENT_TITLE>{$results[nr].et}</FRAGMENT_TITLE>
{$results[nr].pagerange}
<VOLUME>{$results[nr].vol}</VOLUME>
<ISSUE>{$results[nr].issue}</ISSUE>
<PAGERANGE>{$results[nr].pagerange}</PAGERANGE>
</record>
{/section}
</Documents>

The web result looks like (for one record):

Bryman, Alan Bryman, Alan Chapter 5: The debate about quantitative and
qualitativ 93-126

and the 'view source' is like:

<?xml version='1.0' encoding='utf-8'?>
<Documents>
<result_size>5</result_size>
<record id='50450'>
<AUTHOR>Bryman, Alan</AUTHOR>
<TITLE>Quantity and quality in social research</TITLE>
<FRAGMENT_AUTHOR>Bryman, Alan</FRAGMENT_AUTHOR>
<FRAGMENT_TITLE>Chapter 5: The debate about ...</FRAGMENT_TITLE>
<VOLUME></VOLUME>
<ISSUE></ISSUE>
<PAGERANGE>93-126</PAGERANGE>
</record>
...
</Documents>

Cay anyone point me in the right direction please?

George in Oxford

Report this thread to moderator Post Follow-up to this message
Old Post
George Pitcher
12-07-04 09:23 AM


Re: Displaying xml
* George Pitcher <george.pitcher@ingenta.com>:
> I'd like to display my results as an xml page. Is there a way I can do thi
s
> using Smarty (in use for the rst of my sites)?
>
> My tpl file looks like this:
>
<snip - tmpl>
>
> The web result looks like (for one record):
>
> Bryman, Alan Bryman, Alan Chapter 5: The debate about quantitative and
> qualitativ 93-126
>
> and the 'view source' is like:
>
> <?xml version='1.0' encoding='utf-8'?>
>    <Documents>
> 	<result_size>5</result_size>
> 		<record id='50450'>
> 		<AUTHOR>Bryman, Alan</AUTHOR>
> 		<TITLE>Quantity and quality in social research</TITLE>
> 		<FRAGMENT_AUTHOR>Bryman, Alan</FRAGMENT_AUTHOR>
> 		<FRAGMENT_TITLE>Chapter 5: The debate about ...</FRAGMENT_TITLE>
> 		<VOLUME></VOLUME>
> 		<ISSUE></ISSUE>
> 		<PAGERANGE>93-126</PAGERANGE>
>  	</record>
> ...
>    </Documents>
>
> Cay anyone point me in the right direction please?

Looks to me like it's working fine, and that the issue is your browser's
display of XML.

We create XML using Smarty regularly with no issues. Until recently,
when we previewed in Firefox we could only see the actual data (no
tags); recent builds of Firefox -- with the developer tools enabled --
display a nice XML tree.

If ever in doubt, simply look at the source code sent to your browser;
if it looks correct, Smarty is doing its work, then.

Now, another possibility that I can see here is that you might want to
use XSLT to transform the XML into HTML or XHTML (which seems silly --
why not just send HTML back to the browser). If that's the case, you're
going to need to do a lot more, and this isn't the place to discuss it.

--
Matthew Weier O'Phinney           | mailto:matthew@garden.org
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

Report this thread to moderator Post Follow-up to this message
Old Post
Matthew Weier O'Phinney
12-07-04 09:23 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Smarty Templates archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:29 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.