Small new package - XmlOutput Options
tim
Posted: Thursday, August 09, 2007 3:35:02 PM

Rank: Addict

Joined: 2/19/2007
Posts: 825
Location: Belgium
Hey,

I created a new package for umbraco( tested on v2 and v3 ).

It's just a small tool to generate xml from a contentnode.

I made this because I often work with flash developers who will almost always want Xml. So instead of writing xslt you can just install this package.


Link to the package http://testing.netcentric.be/TG.Umb.XmlOutput_0.1.umb

When installed all you need to do is request the page /umbraco/XmlOutput.aspx?nodeid=???? and fill in the correct nodeid.


Thanks to Per for his awesome package creator.

Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
tim
Posted: Thursday, August 09, 2007 4:51:31 PM

Rank: Addict

Joined: 2/19/2007
Posts: 825
Location: Belgium
daniel_l
Posted: Friday, August 10, 2007 10:27:27 AM
Rank: Aficionado

Joined: 6/25/2007
Posts: 146
Location: Malmo, Sweden
Works fine! Tested the package out of curiosity even though I do not have a need for this functionality right now. Thanks for sharing your work!

Is it me or umbraco? Umbraco Certified Professional Level 2.
pph
Posted: Friday, August 10, 2007 3:42:06 PM
Rank: Aficionado

Joined: 7/19/2006
Posts: 171
Location: aalleren, Denmark
awesome tim!

Regarding doing raw xml feeds from umbraco you can also use the /base functionality
(this is not documented very well I know...)

But in short /base is an extension model for building raw data feeds from what ever .net method you setup.

there are a couple of demo feeds available.
Take a look at /config/restExtensions.config and enable these:

<ext assembly="/bin/umbraco" type="umbraco.presentation.umbracoBase.library.member" alias="currentMember">
<permission method="data" allowAll="true" />
<permission method="logout" allowAll="true" />
<permission method="setProperty" allowAll="false"/>
</ext>

Basicly what the above code does is reference the assembly umbraco.dll and it's umbraco.presentation.umbracobase.library.member class.

in this class there are a bunch of methods, among these data(), logout() and setProperty(alias, value)

so with this setup you can reference the output of these methods directly with url's

f.ex: /base/currentMember/data.aspx will return the xml of the current logged in member.
/base/currentMember/logout.aspx will log out the current member
/base/currentMember/setProperty/zipcode/90210.aspx will set the zipcode property on the currentmember to "90210"

this is extendable so you could do an assembly with methods that return a nodes xml based on the like /currentPage/data/ID.aspx

or whatever you would like to get back in it's raw form.

... better make a todo called "Write a book about /Base"




Umbracian Personal blog: Objects.dk
tim
Posted: Friday, August 10, 2007 3:53:18 PM

Rank: Addict

Joined: 2/19/2007
Posts: 825
Location: Belgium
Thanks Per, i know about base but this was for a project running version 2. Yeah a base book would be great, not that it is difficult to set up... Keep up the great work ! Greetings

Umbraco tips and tricks: http://www.nibble.be - umbraco mvp 08/09 - certified level 1 & 2 professional
maynardsmith
Posted: Saturday, November 03, 2007 4:26:43 PM
Rank: Devotee

Joined: 8/23/2007
Posts: 44
Hi,

I have tried XmlOutput, and while it is useful, I also find it confusing because it does not (as far as I can see) output exactly the XML that I am given to process in my XSLT macros etc.

For one just trying to find one's way into umbraco it would be very helpful to be able to see exactly the XML one's code is working on. Is there any (simple) way to output exactly the XML file that is given to the XSLT processor?

(I am afraid I do not understand the references to Base, so if that will do the trick could you be a bit more explicit as to how? I tried the example given and all I got was

<error>Extension not found or permission denied</error>

With thanks, Tony.
drobar
Posted: Saturday, November 03, 2007 5:27:07 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,831
Location: MA, USA
Try my handy-dandy 'DebugPrintOutAllNodes' xslt script. Really simple to use and shows exactly what you are working with, from within umbraco. Instructions on how to use it are at the top of the file.

http://www.percipientstudios.com/downloads/umbraco/DebugPrintOutAllNodes1.1.xslt

Let me know how it works for you.

cheers,
doug.

MVP 2007-2009 - Percipient Studios
maynardsmith
Posted: Saturday, November 03, 2007 9:09:44 PM
Rank: Devotee

Joined: 8/23/2007
Posts: 44
Thanks Doug,

This is better in that it does print the actual names of tags and attributes, and is clearly recursing through the whole file, so I am confident it is giving me what is there, But:

It does not print the actual values of the data items, and I could not see quickly how to do that. Adding an <xsl:value-of ... prints a concatenation of the content of this item and all child items.

Also I had to change the stuff at the top of your macro to that generated by the "Clean" new macro function - just pasting the lot in gave some sort of stylesheet error.

And it still is not giving the actual raw XML encoding. As a beginner trying to work out what is going on, there is nothing like being able to see the exact input to the process in order to try and understand the output.

Regards, Tony.
maynardsmith
Posted: Tuesday, November 06, 2007 5:07:53 PM
Rank: Devotee

Joined: 8/23/2007
Posts: 44
Doug, and anyone else interested:

I have made a couple of changes to this macro, first to get it to run in my environment, and second to print the values of data fields (a bit of a hack, but I don't see how esle to do so).

You can download from http://homepage.ntlworld.com/maynard-smith/DebugPrintOutAllNodes.xslt.

Regards, Tony.
maynardsmith
Posted: Tuesday, December 04, 2007 4:40:08 PM
Rank: Devotee

Joined: 8/23/2007
Posts: 44
Just to say that I have realised that the following line in an XSLT script actually outputs the full XML of the current page to the browser.

Code:
<xsl:copy-of select="$currentPage"/>

You won't see it because the browser throws away all the (XML) tags that it does'nt understand, but if you look at the source of the page they are all there. Also it is not pretty printed, but at least all the original source is there.

Regards, Tony.
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.