Hi,
Can you please help me solving a challenge I have with a specific type XML-query?
Ive a bunch of XML-files that are referencing each other.
So, a XML-file can reference to multiple XML-files and a XML-file can be referenced to by multiple XML-files. This whole reference-structure could be cyclic.
Actually an m:n relationship between XML-files with possible cyclic structure.
The standard solution would be to build a recursive-routine for processing an XML-file that, before actually processing the XML-file, checks in some way, for example with some sort of file-in-process-buffer, if the XML-file isnt already being processed. If not store the name in this buffer, processes the XML-file and initiate the recursive routine for the referenced XML-files.
A structure like this (not real code (at all)):
==============================================================
INSTANTIATE Guard FROM COLLECTION
PROCESS-RECURSIVELY( XML-fileName) {
PROCESS( XML-fileName)
ITERATE Called-XML-file THROUGH XML-file//call-ELEMENT {
IF NOT ( Guard.EXISTS( Called-XML-file.NAME) {
Guard.ADD( Called-XML-file.NAME)
PROCESS-RESURSIVELY(Called-XML-file.NAME)
}
}
}
PROCESS-RESURSIVELY(start-file)
=============================================================
I found out that, but I could be mistaken, that the standard W3C-XML-tooling (XPATH, XQUERY, XLST) cant handle this situation because of their declarative nature.
Recursiveness is possible with these tools but only in a linear way not in an iterative way.
That is why Im looking for alternatives. Hopefully BaseX can help me out here.
Ive BaseX and the JAVA-examples in eclipse running.
Im b.t.w. nor a JAVA- nor an eclipse-expert so it was a bit of a struggle, but I managed.
My question: What is the best way to approach this challenge?
Can you give me some tips?
Kind regards,
Rob Stapper
Meine frage ist in English weil mein Deutsch nicht so gut is wie mein Englisch. Enschuldigung dafür. ;-)
_____
I am using the Free version of SPAMfighter http://www.spamfighter.com/len . SPAMfighter has removed 501 of my spam emails to date.
Do you have a slow PC? http://www.spamfighter.com/SLOW-PCfighter?cid=sigen Try free scan!