ok don't complain if it is a lot of code:
the Sequence.xml is also pasted inside
public Processor(){
ResourceBundle sequence = ResourceBundle.getBundle("Sequence");
inFile = new File(sequence.getString("Sequence"));
LoggerFactory.getLogger().log(this.getClass
(),ILogger.LEVEL_DEBUG,"Initialisatie van de Processor\nSequenca file : " +
inFile);
init();
}
public void init(){
try{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance
();
DocumentBuilder db = dbf.newDocumentBuilder();
Document DocSeq = db.parse(inFile);
NodeList sequencesList = DocSeq.getDocumentElement
().getElementsByTagName("Sequences");
for(int a=0;a<sequencesList.getLength();a++){
Element sequenceElem = (Element) sequencesList.item(a);
NodeList subseqsList = sequenceElem.getElementsByTagName
("Seq");
for (int i=0;i<subseqsList.getLength();i++){
Element subSequenceElem = (Element)
subseqsList.item(i);
Sequence sequence = new Sequence();
NodeList stepsList =
subSequenceElem.getElementsByTagName("Step");
for(int x = 0;x<stepsList.getLength();x++){
Element stepElem = (Element)stepsList.item(x);
LoggerFactory.getLogger().log(this.getClass
(),ILogger.LEVEL_DEBUG,"\nStep Element : " +stepElem.getAttribute
("class"));
IProcess process = (IProcess)
Class.forName(stepElem.getAttribute("class")).newInstance();
Map initProps = new HashMap();
NodeList parmList = stepElem.getElementsByTagName
("param");
for(int y = 0;y < parmList.getLength();y++){
LoggerFactory.getLogger().log(this.getClass
(),ILogger.LEVEL_DEBUG,"\n Element Name : " +
parmList.item(y).getAttributes().getNamedItem("name").getNodeValue());
initProps.put(parmList.item(y).getAttributes
().getNamedItem("name").getNodeValue(),parmList.item(y).getAttributes
().getNamedItem("value").getNodeValue());
}
process.init(initProps);
sequence.addStep(process);
}
//add created sequence to container;
mapsequences.put(sequenceElem.getAttribute("type") +
subSequenceElem.getAttribute("type"), sequence);
}
}
} catch (ParserConfigurationException pce){
LoggerFactory.getLogger().log(this.getClass(),pce, true);
rtnBean.setErrorMessage("MSGXXXX");//Document kon niet gemaakt
worden
rtnBean.setOk(false);
} catch (SAXException se){
LoggerFactory.getLogger().log(this.getClass(), se, true);
rtnBean.setErrorMessage("MSGXXXX");
rtnBean.setOk(false);
} catch (IOException ie){
LoggerFactory.getLogger().log(this.getClass(), ie, true);
} catch (Exception e){
LoggerFactory.getLogger().log(this.getClass(), e, true);
}
}
Sequence.xml
<XML_Stream>
<Sequences type="PRINT">
<Seq type="PORTFOLIO">
<Step id="1" class
="com.kbcsecurities.rendering.processes.XMLParser">
<param name="sourceKey" value="inPath"/>
<param name="targetKey" value="XMLDoc"/>
</Step>
<Step id="2" class
="com.kbcsecurities.rendering.processes.PFPrintSettings">
<param name="sourceKey" value="XMLDoc"/>
<param name="fileToRender" value="FilePDF"/>
<param name="languageKey" value="Language"/>
</Step>
<Step id="3" class
="com.kbcsecurities.rendering.processes.XSLFOTransformer">
<param name="NL_XSL" value
="d:/projects/fop/XSL/OverzichtEffectenPortefeuille_NL.xsl"/>
<param name="FR_XSL" value
="d:/projects/fop/XSL/OverzichtEffectenPortefeuille_FR.xsl"/>
<param name="UK_XSL" value
="d:/projects/fop/XSL/OverzichtEffectenPortefeuille_UK.xsl"/>
<param name="sourceKey" value="XMLDoc"/>
<param name="targetKey" value="FODoc"/>
<param name="languageKey" value="Language"/>
</Step>
<Step id="4" class
="com.kbcsecurities.rendering.processes.FopTransformer">
<param name="sourceKey" value="FODoc"/>
<param name="targetKey" value="TmpPDF"/>
<param name="configFile" value
="d:/java/fop/userconfig.xml"/>
</Step>
<Step id="5" class
="com.kbcsecurities.rendering.processes.WatermarkTransformer">
<param name="backgroundimage" value
="file:///d:/images/Logo/Kbcs.jpg"/>
<param name="sourceKey" value="TmpPDF"/>
<param name="targetKey" value="FinalPDF"/>
</Step>
<Step id="6" class
="com.kbcsecurities.rendering.processes.FileWriter">
<param name="sourceKey" value="FinalPDF"/>
<param name="targetKey" value="FilePDF"/>
</Step>
</Seq>
</Sequences>
</XML_Stream>
Jochen Maes
ICT Development
KBC Securities (kbcsecurities.com)
Havenlaan 12 Avenue du Port SIF 8683
B-1080 Brussels
Belgium
Tel : +32 2 429 96 81
GSM : +32 496 57 90 99
E-mail : [EMAIL PROTECTED]
This message and any attachments hereto are for the named person's use
only. It may contain confidential, proprietary or legally privileged
information. You may not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the
intended recipient. If you have received this e-mail message without being
the intended recipient, please notify KBC Securities promptly and delete
this e-mail. Any views expressed in this message are those of the
individual sender, except where the message states otherwise and the sender
is authorised to state them to be the views of KBC Securities. KBC
Securities reserves the right to monitor all e-mail communications through
its networks and any messages addressed to, received or sent by KBC
Securities or its employees are deemed to be professional in nature. The
sender or recipient of any messages to or of KBC Securities agrees that
those may be read by other employees of KBC Securities than the stated
recipient or sender in order to ensure the continuity of work-related
activities and allow supervision thereof. KBC Securities does not accept
liability for the correct and complete transmission of the information, nor
for any delay or interruption of the transmission, nor for damages arising
from the use of, or reliance on, the information.
Oleg
Tkachenko To: [EMAIL PROTECTED]
<[EMAIL PROTECTED] cc:
onn.com> Subject: Re: stykesheet attribute
version
11/06/2002
16:10
Please
respond to
fop-user
[EMAIL PROTECTED] wrote:
> "java -cp
>
kbcs_fop.jar;batik.jar;avalonframework.jar;fop.jar;xalan.jar;iText.jar;logkit1b4.jar;jaxp.jar;xerces.jar;.
>
> com.kbcsecurities.test.Startup"
You didn't show us how you build initprops Map, please.
> public void process(Map props) throws ProcessException {
> DOMResult res = null;
> TransformerFactory transFactory;
> Transformer transForm;
> String language;
> // XML Parsen en de preparatie van het document zodat de renderer
> // de juiste gegevens heeft.
> try{
> language = (String)props.get(languageKey);
> transFactory = TransformerFactory.newInstance();
At this point you can check whether
(Node)TransformDocs.get(((String)props.get(languageKey)) + "_XSL") returns
you
valid stylesheet DOM document, e.g. try to serialize it and inspect.
--
Oleg Tkachenko
Multiconn International Ltd, Israel