Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# D3grade 9/20/2007 4:44 PM (edited 9/20/2007 4:47 PM)
Hi guys,

As part of a job that i am working on, we have a need to auto populate a site with nodes and sections. In order to do this, i thought it would be good to try and template this in some way.

My initial thoughts are to use xml files with a similar format to this:

< cluster>
	< node title="" templateid="" showinnavigation="" linkurl="" linktarget="">
		< sections>
			< section title="" showtitle="" placeholderid="" moduletypeid="">
				< settings>
					< setting name="" value="" />
					< setting name="" value="" />
					< setting name="" value="" />
					< setting name="" value="" />
				< /settings>
			< /section>
			< section title="" showtitle="" placeholderid="" moduletypeid="">
				< settings>
					< setting name="" value="" />
					< setting name="" value="" />
					< setting name="" value="" />
					< setting name="" value="" />
				< /settings>
			< /section>
		< /sections>
		< nodes>
			< node title="" templateid="" showinnavigation="" linkurl="" linktarget="">
				< sections>
					< section title="" showtitle="" placeholderid="" moduletypeid="">
						< settings>
							< setting name="" value="" />
							< setting name="" value="" />
							< setting name="" value="" />
							< setting name="" value="" />
						< /settings>
					< /section>
					< section title="" showtitle="" placeholderid="" moduletypeid="">
						< settings>
							< setting name="" value="" />
							< setting name="" value="" />
							< setting name="" value="" />
							< setting name="" value="" />
						< /settings>
					< /section>
				< /sections>
				< nodes />
			< /node>
		< /nodes>
	< /node>
< /cluster>


I was wondering if anyone could offer assistance as to how to go about this? I've not yet created a service of my own, so would this be well suited? What would be the general structure of this?

Many thanks

Matt

PS I've had to add a space after the starting '<' just to get it to post
# martijnb 9/21/2007 3:15 PM
The XML format looks fine. I suggest you take a deep breath and code the service that exports or imports this by hand :).
The reason I'm saying this, is that I have had experiences in the past where object graphs were serialized to XML by using the XML serializer. This looks much better at first, until you get to the point where you're stuck with circular references and XML attributes all over the place in your domain model.

On a side note: I also see some nice future possibilities to extend this for exporting and importing entire sites including content. The content abstraction concept that is in SVN now should make this an easy job.
# D3grade 9/24/2007 10:08 PM
martijnbI suggest you take a deep breath and code the service that exports or imports this by hand

This is probably what i'd do anyway as i prefer to have more control over the XML.

Our requirements at the moment or only to do an import facility to aid in setting up pages quickly, and it will be a case that we will create these files by hand. We will probably look to administer this in the future or even exporting a series of already created nodes, but we don't need this right now (plus it allows us to develop it in stages)
martijnbOn a side note: I also see some nice future possibilities to extend this for exporting and importing entire sites including content. The content abstraction concept that is in SVN now should make this an easy job.

We actually got to that idea aswell.

As i mentioned in my first post though, could you offer any advice as to how i would go about creating a service for this? what is the general workflow for creating an additional service?

Many thanks

Matt
# martijnb 9/25/2007 12:21 PM
D3gradeAs i mentioned in my first post though, could you offer any advice as to how i would go about creating a service for this? what is the general workflow for creating an additional service?

I'd add another class library to the Solution with the export component. Make sure that this dll is copied to the /bin directory and register it in /config/services.config. Optionally you could set properties in the configuration, for example, the export and import path.
For the UI, I'd just create an aspx page in the /Admin directory.

Now to the service itself: since you're exporting nodes and section, you need to load the node-section-settings tree. The INodeService interface is perfect to obtain the root nodes. Add that one to the constructor of the export service and it's available at runtime.

Hope this helps.
# D3grade 9/25/2007 2:26 PM
martijnbI'd add another class library to the Solution with the export component. Make sure that this dll is copied to the /bin directory and register it in /config/services.config. Optionally you could set properties in the configuration, for example, the export and import path.
For the UI, I'd just create an aspx page in the /Admin directory.

Now to the service itself: since you're exporting nodes and section, you need to load the node-section-settings tree. The INodeService interface is perfect to obtain the root nodes. Add that one to the constructor of the export service and it's available at runtime.

Hope this helps.

Thanks Martijn

Just what i needed.

Matt