Welcome to Vortx Community Forum, where you can ask questions and receive answers from the staff at Vortx and other members of the community.

If you had a user account on our previous forums website, you will need to register a new account here.

Learn more about...


How to import an XML file into an XML Package?

Right now all of my XML Packages query my database in order to create the xml they will transform.

This causes a lot of needless query activity on my database because every time someone requests a page load it has to run out to the database to get data that simply doesn't change all that often.

I would like instead to use data stored in a separate XML file as the datasource, feeding it to the XSLT for transformation. This would allow me to periodically run a stored procedure that outputs XML-formatted data and update my saved XML file while reducing the load on my database.

I've searched the old forums and keep coming up with broken links. http://forumarchive.vortx.com/threads/6712-Loading-an-XML-file-into-an-XML-Package.html looks like it may have some useful informatin, but it returns a 404.


Has anyone else succeeded at doing this? I appreciate any guidance you can provide.

asked Mar 14, 2014 in MultiStore by Chris (3,685 points)

1 Answer

+1 vote
Best answer
Is this link http://forumarchive.vortx.com/threads/41593-Baffled-how-do-I-import-an-XML-file-into-an-XML-package.html what you are looking for?

That said unless I am using controls or something else dynamic during the transform I prefer to cache the result of the transform. If you do what to cache just the query done on xmlpackages with the source you certinaly can do so.

Doing so mostly takes building a cache key for the query. Which is mostly modifying GetSqlData and CreateParameter in XmlPackage2.cs.
answered Mar 14, 2014 by mmcgeachy (5,045 points)
selected Mar 14, 2014 by Chris

The webquery turns out to be a good candidate, unfortunately my entire application is running on https, and it's complaining about negotiating the ssl - even for a file stored within my own virtual folder.

Could you elaborate on the transform-caching? I see some AppConfigs for entity and menu caching, but I'm not finding much in the way of documentation on how to get an XmlPackage within the scope of either of those.

A post in the old forum (http://forumarchive.vortx.com/threads/55149-Cache-Question.html) indicates that only Entities are covered by entity (intuitive, yes), but I'm not finding anything about how to get something cached with the MenuCache.

I think that the transform-cache would work for me, since these aren't terribly complex elements and they're definitely not dynamic.

In this case transform cahcing would be basicly storing the string that gets returned from running an xmlpackage to the cache. Be the cache stored to memory or disk.

I am not certian what xmlpackage you are trying to speed up. Can you tell me what version you are running and what you are trying to cache? It does sounds like some type of menu but there has been quite a few versions of menus used in themes over the years. With this information I may be able to give a code example you can try.
My site has been pretty heavily modified by a few different developers now, so it's kind of hard sometimes to tell what was a default setting and what wasn't.

The module that I'm trying to optimize around is a navigation tree that was custom-built. It loads on just about every page on my site, and runs a stored procedure returning ~300 categories each time it runs. The procedure itself usually takes between 70 and 150ms to execute, but if it's all the same I'd rather not have to run it so often.

Essentially, what I was looking to do was to set up an explicitly-defined cache, so if there's a way to do that built-in, I'm game.

I understand the mechanics behind how the caching would work, but what steps would I need to take to leverage it in ASPDNSF?

Given that this is custom code I will try to make as gernal as possible. For this example I will assum that there is this Literal control on the page called ltl_menu. Also that is this conrol referaced as goblaly protected if in the masterpagebase or templatebase if used in a master page or template.

This cacheing code would be something like this:

String s = null;
s = (string)HttpContext.Current.Cache.Get("menu");
if (string.IsNullOrEmpty(s))
	s = AppLogic.RunXmlPackage("menu.xml.config", null, ThisCustomer, ThisCustomer.SkinID, String.Empty, String.Empty, false, true);
	HttpContext.Current.Cache.Insert("menu", s, null, DateTime.Now.AddMinutes(AppLogic.CacheDurationMinutes()), TimeSpan.Zero);

Please Keep in mind that you may have additonal RuntimeParms and xmlpackage name. Also if there are RuntimeParms you may need to make the cache name include the RuntimeParms values to create a chache name. With all this in mind you now have the basics of what needed to do caching on xmlpackage results.