[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/deploy/macro MacroToXML.class,1.3,1.4 MacroToXM
Brought to you by:
bigman921
|
From: Marc B. <big...@us...> - 2002-01-21 21:28:03
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro
In directory usw-pr-cvs1:/tmp/cvs-serv3829/dev/src/net/sourceforge/idrs/deploy/macro
Modified Files:
MacroToXML.class MacroToXML.java MacroToXMLHandler.class
MacroToXMLHandler.java
Log Message:
THe macro processor is nearly complete, just a few kinks to work out
Index: MacroToXML.class
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXML.class,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
Binary files /tmp/cvsSmBYq8 and /tmp/cvsSsqTy6 differ
Index: MacroToXML.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXML.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** MacroToXML.java 2002/01/19 17:42:46 1.6
--- MacroToXML.java 2002/01/21 21:06:00 1.7
***************
*** 12,21 ****
MacroToXMLHandler info;
boolean inSimple;
! boolean inHead;
String currentTagName;
public MacroToXML(String parser, String xmlSrc, boolean isFile) throws Exception {
! inHead = false;
inSimple = false;
XMLReader xmlParser = XMLReaderFactory.createXMLReader(parser);
--- 12,33 ----
MacroToXMLHandler info;
boolean inSimple;
! boolean writeText;
! boolean isBody;
! boolean popTag;
! boolean lastTagWrite;
! boolean lookLastTag;
!
! Stack writeStack;
!
String currentTagName;
public MacroToXML(String parser, String xmlSrc, boolean isFile) throws Exception {
! lastTagWrite = false;
! lookLastTag = false;
! writeText = false;
! isBody = false;
inSimple = false;
+ writeStack = new Stack();
+
XMLReader xmlParser = XMLReaderFactory.createXMLReader(parser);
***************
*** 107,118 ****
if (txt.length() == 0) return;
! if ((! this.inSimple) && (! this.inHead))
out.write("<" + info.getNameSpace() + ":" + info.getTextTag() + ">");
out.write(xmlEncode(txt));
! if ((! this.inSimple) && (! this.inHead))
out.write("</" + info.getNameSpace() + ":" + info.getTextTag() + ">");
inSimple = false;
}
--- 119,131 ----
if (txt.length() == 0) return;
! if (shouldWrite())
out.write("<" + info.getNameSpace() + ":" + info.getTextTag() + ">");
out.write(xmlEncode(txt));
! if (shouldWrite())
out.write("</" + info.getNameSpace() + ":" + info.getTextTag() + ">");
+ lookLastTag = false;
inSimple = false;
}
***************
*** 123,131 ****
protected boolean isRMLTag(String tag) {
int begin=0, end=0,tmp;
char c;
c = tag.charAt(1);
String tagName;
! boolean inTag, isTag;
if (c == '/') {
--- 136,147 ----
protected boolean isRMLTag(String tag) {
+
int begin=0, end=0,tmp;
char c;
c = tag.charAt(1);
String tagName;
! boolean inTag, isTag=false;
!
! //writeText = isBody;
if (c == '/') {
***************
*** 148,156 ****
isTag = info.isRMLTag(tagName.toLowerCase().trim());
! if (inTag && isTag)
! this.inSimple = info.isTagSimple(tagName.toLowerCase().trim());
! if (isTag && tagName.toLowerCase().trim().equalsIgnoreCase("head"))
! this.inHead = ! this.inHead;
return isTag;
--- 164,196 ----
isTag = info.isRMLTag(tagName.toLowerCase().trim());
!
! if (isTag) {
! if (inTag) {
! popTag = true;
! }
! else {
! this.inSimple = info.isTagSimple(tagName.toLowerCase().trim());
! if (! writeStack.empty()) {
! this.lastTagWrite = ((Boolean) writeStack.peek()).booleanValue();
! }
! else {
! this.lastTagWrite = false;
! }
!
! this.lookLastTag = true;
! writeStack.push(new Boolean(this.inSimple));
! System.out.println("PUSH " + tagName);
! popTag = false;
! }
! }
!
! /*
! if (isTag && (tagName.toLowerCase().trim().equalsIgnoreCase("body") || tagName.toLowerCase().trim().equalsIgnoreCase("head")))
! if (inTag)
! isBody = false;
! else {
! isBody = true;
! }*/
return isTag;
***************
*** 183,187 ****
token = tok.nextToken();
out.write(token);
! out.write(" \"");
out.write(xmlEncode(tok.nextToken()));
out.write("\"");
--- 223,227 ----
token = tok.nextToken();
out.write(token);
! out.write("\"");
out.write(xmlEncode(tok.nextToken()));
out.write("\"");
***************
*** 192,195 ****
--- 232,253 ----
out.write(">");
+ if (popTag) {
+ System.out.println("POP " + tagName);
+ writeStack.pop();
+ popTag = false;
+ }
+
+
+
+
+ }
+
+ protected boolean shouldWrite() {
+ if (lookLastTag) {
+ return ! this.lastTagWrite;
+ }
+ else {
+ return ! ((! writeStack.empty()) && (((Boolean) writeStack.peek()).booleanValue()));
+ }
}
Index: MacroToXMLHandler.class
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXMLHandler.class,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
Binary files /tmp/cvsL1EzQp and /tmp/cvsg4OIzF differ
Index: MacroToXMLHandler.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXMLHandler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MacroToXMLHandler.java 2002/01/19 17:42:46 1.3
--- MacroToXMLHandler.java 2002/01/21 21:06:01 1.4
***************
*** 15,19 ****
SCRIPT_TAG = "scripttag",
ECHO_SCRIPT_TAG = "echoscripttag",
! RML_TRANS = "rmltrans";
String nameSpace,rmlSchema,textTag,scriptTag,echoScriptTag;
--- 15,21 ----
SCRIPT_TAG = "scripttag",
ECHO_SCRIPT_TAG = "echoscripttag",
! RML_TRANS = "rmltrans",
! IS_SIMPLE = "simple",
! OWN_LINE = "ownLine";
String nameSpace,rmlSchema,textTag,scriptTag,echoScriptTag;
***************
*** 50,54 ****
System.out.println("Found Tag : " + currBuff.toString().trim().toLowerCase());
! rmlTags.put(currBuff.toString().trim().toLowerCase(),new Tag(currBuff.toString().trim(), Boolean.valueOf(atts.getValue(0)).booleanValue() ));
}
else if (name.equals(TEXT_TAG)) {
--- 52,56 ----
System.out.println("Found Tag : " + currBuff.toString().trim().toLowerCase());
! rmlTags.put(currBuff.toString().trim().toLowerCase(),new Tag(currBuff.toString().trim(), Boolean.valueOf(atts.getValue(IS_SIMPLE)).booleanValue(), Boolean.valueOf(atts.getValue(OWN_LINE)).booleanValue()));
}
else if (name.equals(TEXT_TAG)) {
***************
*** 124,131 ****
String name;
boolean isSimple;
! Tag (String name, boolean isSimple) {
this.name=name;
this.isSimple = isSimple;
}
}
--- 126,135 ----
String name;
boolean isSimple;
+ boolean ownLine;
! Tag (String name, boolean isSimple,boolean ownLine) {
this.name=name;
this.isSimple = isSimple;
+ this.ownLine = ownLine;
}
}
|