1 package com
.interrupt
.bookkeeping
.cc
.executor
;
3 import java
.io
.ByteArrayInputStream
;
4 import java
.io
.InputStreamReader
;
5 import java
.io
.PushbackReader
;
7 import org
.apache
.log4j
.Logger
;
9 import com
.interrupt
.bob
.base
.BobSystem
;
11 import com
.interrupt
.bookkeeping
.cc
.lexer
.Lexer
;
12 import com
.interrupt
.bookkeeping
.cc
.lexer
.LexerException
;
13 import com
.interrupt
.bookkeeping
.cc
.node
.AXmlCommandInput
;
14 import com
.interrupt
.bookkeeping
.cc
.node
.Start
;
15 import com
.interrupt
.bookkeeping
.cc
.parser
.Parser
;
16 import com
.interrupt
.bookkeeping
.cc
.parser
.ParserException
;
18 public abstract class AbstractHelper
{
20 private Logger logger
= Logger
.getLogger(AbstractHelper
.class);
22 public static AXmlCommandInput
reparse(String xmlString
) {
25 xmlString
= "create( "+xmlString
+" );";
26 Logger
.getLogger(AbstractHelper
.class).debug("");
27 Logger
.getLogger(AbstractHelper
.class).debug("AXmlCommandInput reparse: ");
28 Logger
.getLogger(AbstractHelper
.class).debug(xmlString
);
31 VisitorFindFirstXMLBlock fvisitorBlock
= new VisitorFindFirstXMLBlock();
32 ByteArrayInputStream bs
= null;
35 bs
= new ByteArrayInputStream(xmlString
.getBytes("UTF-8"));
37 PushbackReader pbreader
= new PushbackReader( new InputStreamReader(bs
), 1024 );
39 //** parse the syntax and provide the MODEL
40 Lexer lexer
= new Lexer(pbreader
);
41 Parser parser
= new Parser(lexer
);
44 Start tree
= parser
.parse();
46 // find first XMLBlock
47 tree
.apply( fvisitorBlock
);
50 catch(java
.io
.UnsupportedEncodingException e
) {
53 catch(java
.io
.IOException e
) {
56 catch(LexerException e
) {
59 catch(ParserException e
) {
63 AXmlCommandInput result
= fvisitorBlock
.getXmlCommandInput();
64 //logger.debug("LoadHelper.reparse / THE END["+ result +"]");