Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jonas Høiby 62 posts 53 karma points
    Jun 25, 2009 @ 14:31
    Jonas Høiby
    0

    external XML file made searchable??

    I have an external XML file from another website i would like to import into my umbraco solution - and then the items posted to my page made search-able .. how do i do this?

     

    My XML file looks like kinda like this:

  • Jonas Høiby 62 posts 53 karma points
    Jun 25, 2009 @ 14:32
    Jonas Høiby
    0


    I have an external XML file from another website i would like to import into my umbraco solution - and then the items posted to my page made search-able .. how do i do this?

    My XML file looks like kinda like this:


    <?xml version="1.0" encoding="ISO-8859-1" ?>
    - <Travelize>
      <Exporttype>myTours</Exporttype>
    - <rejse>
      <destination>myDestination</destination>
      <hotel>myHotel</hotel>
      <rejse>
    </Travelize>


    Any help would be appreciated .. :-)

  • Jamie Pollock 27 posts 102 karma points c-trib
    Jun 25, 2009 @ 14:37
    Jamie Pollock
    1

    Hi Jonas,

    I'm not sure exactly how you'd import that file into a usable state for umbraco, but for inspiration look at

    http://umbimport.soetemansoftware.nl/ it imports xml and data into umbraco, although I've never used it.

    As far as making an xml -based search engine for umbraco nodes you could look at XSLTsearch made by Doug, http://www.percipientstudios.com/xsltsearch.aspx.

    I hope this helps a little, if anyone has an experience in using the umbimport I think this would be the import first step.

    - Jamie

  • Jamie Pollock 27 posts 102 karma points c-trib
    Jun 25, 2009 @ 14:37
    Jamie Pollock
    0

    The period got stuck on my second URL so to clarify: http://www.percipientstudios.com/xsltsearch.aspx

  • Jesper Hauge 298 posts 487 karma points c-trib
    Jun 25, 2009 @ 14:43
    Jesper Hauge
    1

    Hi Jonas

    The umbraco.library contains a method that fetches xml from Urls, umbraco.library.GetXmlDocumentByUrl. Using this method you can load the xml document into a xslt variable in a xslt stylesheet using the following code:

    <xsl:variable name="externalXml" select="umbraco.library:GetXmlDocumentByUrl('http://remotedomain.net/path/to/xml/document')" />

    From then on the root of the remote xml doc is accessible through the $externalXml variable.

    Regards
    .Hauge

  • Jonas Høiby 62 posts 53 karma points
    Jun 25, 2009 @ 15:16
    Jonas Høiby
    0

     

    its not so much making an XML search engine for umbraco .. its more importing the XML file to umbraco and making it searchable with that exact same search engine as you mention .. :-)

     

     

    but then all i have to do is:

    <xsl:variable name="xmlFile" select="umbraco.library:GetXmlDocumentByUrl('http://www.mySite.com/xmlFeed.xml')" />

    <xsl:for-each select="$xmlFile/Travelize//rejse">

    <div><xsl:value-of select="destination"/> - <xsl:value-of select="hotel"/></div>

    </xsl:for-each>

     

    and when i output that to a page, thats made searchable by the XSLT search engine that i can install from the packages?

  • Jonas Høiby 62 posts 53 karma points
    Jun 25, 2009 @ 15:21
    Jonas Høiby
    0

    Cause - that does not work ..

     

     

    wheres my edit button?

  • Jesper Hauge 298 posts 487 karma points c-trib
    Jun 25, 2009 @ 15:52
    Jesper Hauge
    0

    When you mentioned searching I presumed you were talking about visible content published on the website, and hence searchable via search providers like google.

    Not sure about this, but I think XsltSearch only searches content in the umbraco store (the umbraco.config file in other words). So if you really need a local search, you'll prbably have to import the data into umbraco via some kind of import procedure, Look at Richards umbImport tool mentioned in Jamies post.

    .Hauge

     

  • Jonas Høiby 62 posts 53 karma points
    Jun 25, 2009 @ 15:56
    Jonas Høiby
    0

    okay ..

    but cant get umbImport tool to work ... :s .. tried both "umbimport_0.1.zip" as well as "Umbimport__1.0_Beta1.zip" ... :-/

     

    umbimport_0.1.zip fails on install ...

    and

    Umbimport__1.0_Beta1.zip fails when i goto the menu options that has been installed ..

     

    maby the solution would be to get my programmers to code some kind of .NET control that imports XML to something each time a specific page is hit? i dunno really ..

  • Jamie Pollock 27 posts 102 karma points c-trib
    Jun 26, 2009 @ 22:32
    Jamie Pollock
    0

    Does the data need to be in umbraco itself? or could it be accessed as an external file? In what way do you need to use the XML file I guess, on the website or inside umbraco?

    Also as a review, how do you need to search the xml document?

    Regards importing an XML in .net you could look at XmlDocument.load() which takes a file path, like I said I don't know how you want to use it.

  • Jesper Ordrup 1019 posts 1528 karma points MVP
    Jun 29, 2009 @ 09:19
    Jesper Ordrup
    0

    Hi there,

    If you want to import the data into Umbraco, and make it maintainable (edit button) then you have a couple of options.

    Either use umbImport ( http://our.umbraco.org/projects/umbimport ) - I would really suggest you tried to make that work. It would probably be the quickest way.

    Another way is to write some c# and make a usercontrol and do the import yourself. Creating new nodes (documents) is fairly easy - http://our.umbraco.org/wiki/reference/api-cheatsheet/creating-a-document

    Or ... you can do a XSLT extension that allows you to create nodes. This would allow you to do something like this:

    <xsl:variable name="xmlFile" select="umbraco.library:GetXmlDocumentByUrl('http://www.mySite.com/xmlFeed.xml')" />
    <xsl:for-each select="$xmlFile/Travelize//rejse">
    <xsl:value-of select="destination"/> - <xsl:value-of select="hotel"/>
    <xsl:value-of select="extension:nodeCreate($parentid, 'mydoctype', values, ...)"/>
    </xsl:for-each>

    I've used this approach a couple of times .. when the need is max. flexibility.

    /Jesper

Please Sign in or register to post replies

Write your reply to:

Draft