PDA

View Full Version : is it possible to merge module databases?



Ikael
August 25th, 2011, 18:45
Before updating Unicore ruleset to FGII v2.8 compatible I created lots of modules that didn't show up as individual entries in library windowlist. Instead there was one master module (say regular rulebook) that had normal library bookentry and all other modules were submodules/addendums for it. For example one submodule could add more skills which were displayed in master module's bookentry. This worked out with examples modules displayed below, without any coding. But now after FG v2.8 compatible update, it doesn't work anymore. I quess FGII v2.2 compatibility might have something to do with this.

So my question is, can I merge module databasenodes to enable similar effect that worked before? So far I haven't been able to succeed in it and started to wonder if it would be impossible.

I have tried to use DB.copyNode function and created my own recursive node copier but no luck. I did even try both out with modules where I removed the static="true" declaration. Now I started to thought if module databasenodes are static by default and instead of removing the attribute, I should set in to "false"?

Master module content



<?xml version="1.0" encoding="ISO-8859-1"?>
<root version="2.8">
<library>
<Sample static="true">
<name type="string">Sample1</name>
<categoryname type="string">Category</categoryname>
<entries>
<test>
<librarylink type="windowreference">
<class>referenceindex</class>
<recordname>..</recordname>
</librarylink>
<name type="string">Numbers</name>
<index>
<one>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.one@Sample1</recordname>
</listlink>
<name type="string">One</name>
</one>
<three>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.three@Sample1</recordname>
</listlink>
<name type="string">Three</name>
</three>
</index>
</test>
</entries>
</Sample>
</library>
<reference>
<test>
<one>
<name type="string">One</name>
<description type="formattedtext">
<p>Number one</p>
</description>
</one>
<three>
<name type="string">Three</name>
<description type="formattedtext">
<p>Number three</p>
</description>
</three>
</test>
</reference>
</root>


Additional submodule content


<?xml version="1.0" encoding="ISO-8859-1"?>
<root version="2.8">
<library>
<Sample static="true">
<name type="string"></name>
<categoryname type="string">Category</categoryname>
<entries>
<test>
<index>
<two>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.two@Sample2</recordname>
</listlink>
<name type="string">Two</name>
</two>
<four>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.four@Sample2</recordname>
</listlink>
<name type="string">Four</name>
</four>
</index>
</test>
</entries>
</Sample>
</library>
<reference>
<test>
<two>
<name type="string">Two</name>
<description type="formattedtext">
<p>Number two</p>
</description>
</two>
<four>
<name type="string">Four</name>
<description type="formattedtext">
<p>Number four</p>
</description>
</four>
</test>
</reference>
</root>

Ikael
August 25th, 2011, 18:48
The end result of pre FGII v2.8 merged module databasenode looked like this


<?xml version="1.0" encoding="ISO-8859-1"?>
<root version="2.8">
<library>
<Sample static="true">
<name type="string">Sample1</name>
<categoryname type="string">Category</categoryname>
<entries>
<test>
<librarylink type="windowreference">
<class>referenceindex</class>
<recordname>..</recordname>
</librarylink>
<name type="string">Numbers</name>
<index>
<one>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.one@Sample1</recordname>
</listlink>
<name type="string">One</name>
</one>
<two>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.two@Sample2</recordname>
</listlink>
<name type="string">Two</name>
</two>
<three>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.three@Sample1</recordname>
</listlink>
<name type="string">Three</name>
</three>
<four>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.four@Sample2</recordname>
</listlink>
<name type="string">Four</name>
</four>
</index>
</test>
</entries>
</Sample>
</library>
<reference>
<test>
<one>
<name type="string">One</name>
<description type="formattedtext">
<p>Number one</p>
</description>
</one>
<two>
<name type="string">Two</name>
<description type="formattedtext">
<p>Number two</p>
</description>
</two>
<three>
<name type="string">Three</name>
<description type="formattedtext">
<p>Number three</p>
</description>
</three>
<four>
<name type="string">Four</name>
<description type="formattedtext">
<p>Number four</p>
</description>
</four>
</test>
</reference>
</root>

Zeus
August 25th, 2011, 19:28
I think if you use a common moduleid or mergeid for the modules then the contents of the modules should become merged under a common entry.

Ikael
August 25th, 2011, 20:12
Thanks for reply, however I was once again unclear of what I wanted. I can merge new page-entries in one bookentry by using several modules, which would result following structure. However this is not what want. I want to merge all entries child nodes of "library.Sample.entries.test.index" (see the db structure from 2nd post). It should result one extended list.


<?xml version="1.0" encoding="ISO-8859-1"?>
<root version="2.8">
<library>
<Sample static="true">
<name type="string">Sample1</name>
<categoryname type="string">Category</categoryname>
<entries>
<test>
<librarylink type="windowreference">
<class>referenceindex</class>
<recordname>..</recordname>
</librarylink>
<name type="string">Numbers</name>
<index>
<one>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.one@Sample1</recordname>
</listlink>
<name type="string">One</name>
</one>
<two>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.two@Sample2</recordname>
</listlink>
<name type="string">Two</name>
</two>
<three>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.three@Sample1</recordname>
</listlink>
<name type="string">Three</name>
</three>
<four>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.four@Sample2</recordname>
</listlink>
<name type="string">Four</name>
</four>
</index>
</test>

<test>
<librarylink type="windowreference">
<class>referenceindex</class>
<recordname>..</recordname>
</librarylink>
<name type="string">Numbers</name>
<index>
<two>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.two@Sample2</recordname>
</listlink>
<name type="string">Two</name>
</two>
<four>
<listlink type="windowreference">
<class>referencegeneral</class>
<recordname>reference.test.four@Sample2</recordname>
</listlink>
<name type="string">Four</name>
</four>
</index>
</test>
</entries>
</Sample>
</library>
<reference>
<test>
<one>
<name type="string">One</name>
<description type="formattedtext">
<p>Number one</p>
</description>
</one>
<two>
<name type="string">Two</name>
<description type="formattedtext">
<p>Number two</p>
</description>
</two>
<three>
<name type="string">Three</name>
<description type="formattedtext">
<p>Number three</p>
</description>
</three>
<four>
<name type="string">Four</name>
<description type="formattedtext">
<p>Number four</p>
</description>
</four>
</test>
</reference>
</root>