Hi,
I am relatively new to MySource Matrix and I have a question. I have being playing around with standard pages and I was wondering is it possible to output xml instead of html?
Any help would be greatly appreciated.
Thanks
The WYSIWYG Editor generates HTML. It is possible to get Matrix to output XML, though – but its trickier. For example, if you create a blank design (i.e. a design with only a body tag in it), you can then insert XML into a Raw HTML bodycopy and that would work. Also, you can get asset listings to output XML as well, with careful configuration of bodycopies and designs.
So, the answer is, "Yes, its possible" but its not immediately obvious, I suspect.
[quote]The WYSIWYG Editor generates HTML. It is possible to get Matrix to output XML, though – but its trickier. For example, if you create a blank design (i.e. a design with only a body tag in it), you can then insert XML into a Raw HTML bodycopy and that would work. Also, you can get asset listings to output XML as well, with careful configuration of bodycopies and designs.
So, the answer is, “Yes, its possible” but its not immediately obvious, I suspect.
[right][post=“12937”]<{POST_SNAPBACK}>[/post][/right][/quote]
Is there a tutorial on how to output xml using asset listings? I tried creating a design with just a body tag but it just prints out an empty body tag and not the contents.
[quote]Is there a tutorial on how to output xml using asset listings? I tried creating a design with just a body tag but it just prints out an empty body tag and not the contents.
[right][post=“12945”]<{POST_SNAPBACK}>[/post][/right][/quote]
There isn’t a tutorial on this, as far as I know. When I said “just a body tag”, I mean a MySource area tag:
With just a body tag, Matrix won't print any of the supporting HTML stuff it usually does, which means you can build pure text or XML output yourself.
[quote]There isn't a tutorial on this, as far as I know. When I said "just a body tag", I mean a MySource area tag:
With just a body tag, Matrix won't print any of the supporting HTML stuff it usually does, which means you can build pure text or XML output yourself.
[right][post="12946"]<{POST_SNAPBACK}>[/post][/right][/quote]
Thanks for your help but when I do that I get the following response:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- The System
Content © Copyright
Running Squiz MySource v3.10.1 (Matrix) - http://matrix.squiz.net/
Developed by Squiz - http://matrix.squiz.net/
© Copyright 2006. All rights reserved.
Page generated: 07 November 2006
-->
<title>Sandbox - pointOfView</title>
<meta http-equiv="Content-Type" content="text/xml"/>
<meta name="description" content="Sandbox" />
<meta name="keywords" content="" />
<link rel="stylesheet" type="text/css" href="http://fs.fmr.com:81/matrix/_designs/design_74/style.css" />
</head>
<body>
<POINTOFVIEW><POST> <POSTDATE>11/07/2006</POSTDATE> <POSTHEADLINE>Headline goes here</POSTHEADLINE> <POSTCONTENT>Content goes here</POSTCONTENT></POST> </POINTOFVIEW>
</body>
</html>
I need a response like this:
<POINTOFVIEW><POST> <POSTDATE>11/07/2006</POSTDATE> <POSTHEADLINE>Headline goes here</POSTHEADLINE> <POSTCONTENT>Content goes here</POSTCONTENT></POST> </POINTOFVIEW>
Is it possible to design an xml design so i can add an asset and it would return an xml document containing a number of <POST>'s?
What does your design parsefile associated with that asset look like? It shouldn't have any of that HTML stuff wrapped around it. You may need to create a new design just for your XML-only pages.
[quote]Is it possible to design an xml design so i can add an asset and it would return an xml document containing a number of <POST>'s?
[right][post=“12948”]<{POST_SNAPBACK}>[/post][/right][/quote]
This is what we do.
The is the design for an RSS feed:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="/rss/rss-style.xsl"?>
This design is applied to an asset listing (example from live site (view source)
The page contents looks like this:
Radio New Zealand News Headlines
The Latest headlines from Radio New Zealand News
http://www.radionz.co.nz/news
Radio New Zealand
60
%asset_listing%And then the type formats like this:
%asset_name%
%asset_attribute_summary%
%asset_url%
%asset_published_rfc2822%
%asset_attribute_contact_phone%
The type format has the tags you need to loop though a list of assets.
All code is entered into the raw HTML cell.
Hopefully you should be able to thin this out to do what you want.
One last thing to remember. For all the DIV assets that you enter content into for the asset listing, open their properties at set the Display Type from "Block level" to "Raw HTML". This will suppress the printing of DIV tags in the output.
%asset_name%
%asset_attribute_summary%
%asset_url%
%asset_published_rfc2822%
%asset_attribute_contact_phone%
Thanks for your help. Presently I am just using the Standard page. It requires me to create a div and manually enter in xml and manually put in the tags. Is there a way to create an asset an pull the the contents into a predefined tag and if so how would you carry out looping? Thanks
[quote]Is there a way to create an asset an pull the the contents into a predefined tag and if so how would you carry out looping? Thanks
[right][post=“12954”]<{POST_SNAPBACK}>[/post][/right][/quote]
Yes, you do this using the Asset Listing asset as described by Richard above.
%asset_attribute_post_date%
%asset_attribute_post_headline%
%asset_attribute_post_content%
I am unsure how to use the asset listing asset. Presently I created the asset listing page. I changed the default layout to contain the code above. I left the Page Contents folder as it was just containing %asset_listing%. I then selected the Details option of the newly created asset listing object and I set the asset types to list as standard page. For the root node I pointed to the root element which is the asset list itself. all the rest I left as the default.
My questions are is where do I define the attributes that I have outlined in the default layout. And how can they pull text into that format and how can I loop per post?
Thanks,
A Standard Page asset does not have those attributes – Richard uses a custom asset to provide the content for his XML lists. You would need to create a metadata schema or perhaps use the News asset instead (which does have Headline and Body attributes).
Hi,
You can define the format you want for each item to be listed in the asset listing by modifying: Asset Listing Asset > Display Formats Screen > Default Formats Section > Default Format Bodycopy. On the Display Formats Screen, you may also add a specific format for a particular asset type under the ‘Customised Asset Type Formats’ section, in your case, the Standard Page asset. If the format for an asset is not defined, the Default Format will be used.
If you have access to the news package, you may create and list news items. Matrix uses a keyword replacement system to replace keywords with the desired asset information, such as attributes or metadata. When you customise the format for a news item, you may discover the keywords that are available to this asset from the – select keyword – wysiwyg dropdown, for example, %asset_attribute_show_headline%, %asset_attribute_show_body%. Which I believe, are what you are after.
If you need more information regarding how to customise the asset listing asset, feel free to check out the ‘Asset Listing Page’ chapter in the CMS manual available at http://matrix.squiz.net/resources/documentation .