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:xmlNodetoIterator with criteria as (Header, Data, Tail (like my example)
Branch on /next
[/INDENT]pub.schema:validate with schema generate with XSDfile which describe the whole file
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.