I don’t want to make a specific implementation for each kind of treatment, I will have to do (different treatment = different file/different xsd)…
That’s why I want to make it that way… It’s (I think) the most “generic” treatment.
.
Obviously, I can make a specific Java development for each kind of treatment…
What does the pub.schema:validate built-in service not do that you want to do? When iterating over a document using getNextXMLNode you could validate that node using pub.schema:validate, the output of which is an array of validation errors. If there were any for the selected node, it should be added to the “bad nodes” list, if not it could be examined using pub.xml:queryXMLNode to see if it goes into the “A” pile or “B” pile.
I don’t understand the value of dynamically generating an XSD on the fly. If your doc types have been created from the XSD in the first place, you can dynamically set the “conformsTo” parm to validate against the correct one.
Maybe I’m missing something, but I would echo Rob’s oft repeated refrain “Don’t write it in java”.
I know about the “Don’t write Java code” but something we don’t have the choice …
About pub.schema:validate I have try to “validate” node by node with my schema but it doesn’t work … but maybe I have done something wrong …
I have done something like that (I will update this post monday when i’ll go back to my office)
pub.file:getFile in stream mode
pub.xml:stringToXMLNode
pub.xml:xmlNodetoIterator with criteria as (Header, Data, Tail (like my example)
Repeat
[INDENT]pub.xml:getNextXMLNode
Branch on /next
[INDENT]$null:Exit
[/INDENT]pub.schema:validate with schema generate with XSDfile which describe the whole file
[/INDENT]pub.xml:freeXMLNode
But validate always returns false …
Do I make a mistake somewhere ?
Populate the conformsTo parm with the fully qualified name of a document type created from your XSD. I would create one doc type each for Header, Data and Tail and then populate conformsTo based on the name of the node.
You may need to the top level from the doc type and indent its children after generating it from the XSD.
So I have tried to create a document type from my XSD for my header and my data but when I try to validate with those doc type, I got an exception which indicates that :
(note: In order to create my docs type, I generate them from a XSD schema and take off element that I don’t need.)