Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 1 of 1

Thread: Get Topic Data As Xml Stream

  1. #1
    Rob is offline Senior Member
    Join Date
    Aug 2004
    Posts
    3,037

    Default Get Topic Data As Xml Stream

    For the IMOJ site, we needed a simple way to manage Xml content (somewhat static) in the admin site, but feed it back automatically to the Flash objects in Xml format.

    What we ended up doing so (we can manage all the data in the admin site topics) is to create this XmlPackage called topicasxml.xml.config (TopicAsXml)

    Code:
    <?xml version="1.0" standalone="yes" ?>
    <package version="2.1" displayname="Topic Data As Xml" debug="false" allowengine="true" includeentityhelper="false">
    
    	<!-- ###################################################################################################### -->
    	<!-- Copyright AspDotNetStorefront.com, 1995-2008.  All Rights Reserved.					                -->
    	<!-- http://www.aspdotnetstorefront.com														                -->
    	<!-- For details on this license please visit  the product homepage at the URL above.		                -->
    	<!-- THE ABOVE NOTICE MUST REMAIN INTACT.                                                                   -->
    	<!--                                                                                                        -->
    	<!-- ###################################################################################################### -->
    
        <HTTPHeaders>
            <HTTPHeader headername="Content-Type" headervalue="text/xml" />
        </HTTPHeaders>
        
        <query name="Topics" rowElementName="Topic">
            <sql>
                <![CDATA[
    			select * from Topic T with (NOLOCK) where Name=@TopicName
                ]]>
    		</sql>
            <queryparam paramname="@TopicName" paramtype="request" requestparamname="topic" sqlDataType="varchar" defvalue=""  validationpattern="" />
        </query>
    
        <PackageTransform>
        
            <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
              <xsl:output method="xml" omit-xml-declaration="no" />
    
    	<!-- the topic description actually had the tiltviewr Xml in it, just return it -->
                <xsl:template match="/">
    				<xsl:value-of select="/root/Topics/Topic/Description" disable-output-escaping="yes"/>
                </xsl:template>
    
    		</xsl:stylesheet>
    
        </PackageTransform>
    </package>
    This is a very simple XmlPackage that now allows you to get a topic returned from the HTTP call as an Xml file back (not just HTML).

    You just invoke it with the syntax:

    x-topicasxml.aspx?topic={topicnamehere}

    (this x- syntax uses our HTTP Handler ExecXmlPackage call)

    Note that you use the x- syntax to invoke it, and the {topicnamehere} is the name of the topic (which contains Xml Data) that you want returned.

    An example is this:

    http://www.imoj.com/x-topicasxml.asp...otographersxml

    This is how we are feeding data to the internal flash objects.

    The way I wrote the XmlPackage as shown only works with DB based topics (not file based topics), and the actual Topic should just contain the Xml you want returned (no HTML, head, etc).

    Anyway, just another little trick. We'll include this XmlPackage in the core on subsequent builds, as it's quite handy and this concept would work on any site.

    See this thread for more info on this type of subject also:

    http://forums.aspdotnetstorefront.co...ad.php?t=10789
    Last edited by Rob; 03-31-2008 at 01:11 AM.
    AspDotNetStorefront
    Shopping Cart