idrs-commit Mailing List for Internet Document and Report Server (Page 19)
Brought to you by:
bigman921
You can subscribe to this list here.
| 2002 |
Jan
(113) |
Feb
(34) |
Mar
(38) |
Apr
(63) |
May
|
Jun
|
Jul
|
Aug
(40) |
Sep
(26) |
Oct
(4) |
Nov
(5) |
Dec
(3) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(13) |
Feb
(15) |
Mar
(21) |
Apr
(7) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(71) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
|
From: Marc B. <big...@us...> - 2002-01-21 21:28:04
|
Update of /cvsroot/idrs/Idrs/dev/projects/compiler In directory usw-pr-cvs1:/tmp/cvs-serv3829/dev/projects/compiler Modified Files: rmlTrans.xml rmlTransSchema.xml Log Message: THe macro processor is nearly complete, just a few kinks to work out Index: rmlTrans.xml =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/projects/compiler/rmlTrans.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rmlTrans.xml 2002/01/19 17:42:45 1.3 --- rmlTrans.xml 2002/01/21 21:05:59 1.4 *************** *** 2,34 **** <trans:rmlTrans xmlns:trans="rmlTransSchema.xml"> <!-- define valid rml tags --> ! <trans:rml simple="false" >rml</trans:rml> ! <trans:rml simple="true" >ishtml</trans:rml> ! <trans:rml simple="true" >scriptClass</trans:rml> ! <trans:rml simple="false" >head</trans:rml> ! <trans:rml simple="false" >object</trans:rml> ! <trans:rml simple="true" >class</trans:rml> ! <trans:rml simple="false" >constructor</trans:rml> ! <trans:rml simple="true" >vartype</trans:rml> ! <trans:rml simple="false" >method</trans:rml> ! <trans:rml simple="true" >name</trans:rml> ! <trans:rml simple="false" >db</trans:rml> ! <trans:rml simple="true" >dbDriver</trans:rml> ! <trans:rml simple="true" >dbName</trans:rml> ! <trans:rml simple="true" >dbUser</trans:rml> ! <trans:rml simple="true" >dbPass</trans:rml> ! <trans:rml simple="true" >useDb</trans:rml> ! <trans:rml simple="true" >usemethod</trans:rml> ! <trans:rml simple="false" >sql</trans:rml> ! <trans:rml simple="false" >storedProc</trans:rml> ! <trans:rml simple="false" >varlist</trans:rml> ! <trans:rml simple="false" >body</trans:rml> ! <trans:rml simple="true" >field</trans:rml> ! <trans:rml simple="true" >src</trans:rml> ! <trans:rml simple="false" >ifResults</trans:rml> ! <trans:rml simple="false" >yes</trans:rml> ! <trans:rml simple="false" >no</trans:rml> ! <trans:rml simple="false" >repeat</trans:rml> ! <trans:rml simple="false" >ifChange</trans:rml> ! <trans:rml simple="true" >inputResults</trans:rml> <!-- text tag --> --- 2,34 ---- <trans:rmlTrans xmlns:trans="rmlTransSchema.xml"> <!-- define valid rml tags --> ! <trans:rml simple="true" ownLine="true" >rml</trans:rml> ! <trans:rml simple="true" ownLine="true">ishtml</trans:rml> ! <trans:rml simple="true" ownLine="true">scriptClass</trans:rml> ! <trans:rml simple="false" ownLine="true" >head</trans:rml> ! <trans:rml simple="true" ownLine="true" >object</trans:rml> ! <trans:rml simple="true" ownLine="true" >class</trans:rml> ! <trans:rml simple="true" ownLine="true">constructor</trans:rml> ! <trans:rml simple="true" ownLine="true">vartype</trans:rml> ! <trans:rml simple="true" ownLine="true">method</trans:rml> ! <trans:rml simple="true" ownLine="true">name</trans:rml> ! <trans:rml simple="true" ownLine="true">db</trans:rml> ! <trans:rml simple="true" ownLine="true">dbDriver</trans:rml> ! <trans:rml simple="true" ownLine="true">dbName</trans:rml> ! <trans:rml simple="true" ownLine="true">dbUser</trans:rml> ! <trans:rml simple="true" ownLine="true">dbPass</trans:rml> ! <trans:rml simple="true" ownLine="true">useDb</trans:rml> ! <trans:rml simple="true" ownLine="false">usemethod</trans:rml> ! <trans:rml simple="true" ownLine="true">sql</trans:rml> ! <trans:rml simple="true" ownLine="true">storedProc</trans:rml> ! <trans:rml simple="true" ownLine="true">varlist</trans:rml> ! <trans:rml simple="false" ownLine="true">body</trans:rml> ! <trans:rml simple="true" ownLine="false">field</trans:rml> ! <trans:rml simple="true" ownLine="true">src</trans:rml> ! <trans:rml simple="true" ownLine="false">ifResults</trans:rml> ! <trans:rml simple="false" ownLine="true">yes</trans:rml> ! <trans:rml simple="false" ownLine="true" >no</trans:rml> ! <trans:rml simple="false" ownLine="true">repeat</trans:rml> ! <trans:rml simple="false" ownLine="true">ifChange</trans:rml> ! <trans:rml simple="true" ownLine="false">inputResults</trans:rml> <!-- text tag --> Index: rmlTransSchema.xml =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/projects/compiler/rmlTransSchema.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** rmlTransSchema.xml 2002/01/19 17:42:46 1.3 --- rmlTransSchema.xml 2002/01/21 21:05:59 1.4 *************** *** 7,10 **** --- 7,11 ---- <xs:element name="rml" type="xs:string" minOccurrs="1" maxOccurrs="unbound"> <xs:attribute name="simple" type="xs:boolean" /> + <xs:attribute name="ownLine" type="xs:boolean" /> </xs:element> |
|
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;
}
}
|
|
From: Marc B. <big...@us...> - 2002-01-19 17:42:49
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro
In directory usw-pr-cvs1:/tmp/cvs-serv27321/dev/src/net/sourceforge/idrs/deploy/macro
Modified Files:
MacroToXML.class MacroToXML.java MacroToXMLHandler.class
MacroToXMLHandler.java
Log Message:
The macro translation process is MOSTLY working, there are still a couple of bugs to kick out of the system though
Index: MacroToXML.class
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXML.class,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
Binary files /tmp/cvsB3nSyx and /tmp/cvsyHH7SU differ
Index: MacroToXML.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXML.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** MacroToXML.java 2002/01/19 07:00:36 1.5
--- MacroToXML.java 2002/01/19 17:42:46 1.6
***************
*** 11,17 ****
Writer out;
MacroToXMLHandler info;
!
public MacroToXML(String parser, String xmlSrc, boolean isFile) throws Exception {
XMLReader xmlParser = XMLReaderFactory.createXMLReader(parser);
InputSource in;
info = new MacroToXMLHandler();
--- 11,23 ----
Writer out;
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);
+
InputSource in;
info = new MacroToXMLHandler();
***************
*** 39,65 ****
String curr = "", tag="";
! do {
! end = rmlSrc.indexOf("<");
isScript = isScriptTag(end);
curr = rmlSrc.substring(begin,end);
! outText(curr);
if (isScript) {
tagEnd = outScript(end);
}
else {
tagEnd = readTag(end);
- outText(curr);
- tag = rmlSrc.substring(end + 1, tagEnd);
! if (isRMLTag(tag))
outTag(tag);
! else
outText(tag);
}
! begin = tagEnd + 1;
}
! while (end != -1);
}
--- 45,84 ----
String curr = "", tag="";
+ end = rmlSrc.indexOf("<",begin);
! while (end != -1) {
!
isScript = isScriptTag(end);
curr = rmlSrc.substring(begin,end);
!
! //debug
! System.out.println("text : " + curr);
!
!
if (isScript) {
+ outText(curr);
tagEnd = outScript(end);
}
else {
tagEnd = readTag(end);
! tag = rmlSrc.substring(end, tagEnd);
!
! System.out.print("tag : " + tag);
!
! if (isRMLTag(tag)) {
! outText(curr);
outTag(tag);
! }
! else {
! outText(curr);
outText(tag);
+ }
}
! begin = tagEnd;
! end = rmlSrc.indexOf("<",begin);
}
!
}
***************
*** 86,118 ****
protected void outText(String txt) throws IOException {
! out.write("<" + info.getNameSpace() + ":" + info.getTextTag() + ">");
out.write(xmlEncode(txt));
! out.write("</" + info.getNameSpace() + ":" + info.getTextTag() + ">");
}
protected int readTag(int begin) {
! return rmlSrc.indexOf(">", begin);
}
protected boolean isRMLTag(String tag) {
! int begin=0, end=0;
char c;
c = tag.charAt(1);
String tagName;
if (c == '/') {
begin = 2;
}
else {
begin = 1;
}
! tagName = tag.substring(begin,tag.indexOf(" ",begin));
! return info.isRMLTag(tag.toLowerCase().trim());
}
protected void outTag(String tag) throws IOException {
! int begin=0, end=0;
char c;
c = tag.charAt(1);
--- 105,162 ----
protected void outText(String txt) throws IOException {
! 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;
}
protected int readTag(int begin) {
! return rmlSrc.indexOf(">", begin)+1;
}
protected boolean isRMLTag(String tag) {
! int begin=0, end=0,tmp;
char c;
c = tag.charAt(1);
String tagName;
+ boolean inTag, isTag;
if (c == '/') {
begin = 2;
+ inTag = true;
}
else {
begin = 1;
+ inTag = false;
}
! tmp = tag.indexOf(" ",begin);
! if (tmp == -1) {
! tmp = tag.indexOf(">",begin);
! }
! tagName = tag.substring(begin,tmp);
!
! this.currentTagName=tagName;
!
! 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;
}
protected void outTag(String tag) throws IOException {
! int begin=0, end=0,tmp;
char c;
c = tag.charAt(1);
***************
*** 122,136 ****
String token;
! if (c == '/') {
! begin = 2;
! }
! else {
! begin = 1;
! }
!
! end = tag.indexOf(" ",begin);
! tagName = tag.substring(begin,end);
! out.write("<" + ((c=='/') ? "/" : "") + info.getNameSpace() + ":" + info.getCorrectRMLTagName(tagName) + " ");
begin = end;
--- 166,173 ----
String token;
!
! tagName = this.currentTagName;
! out.write("<" + ((c=='/') ? "/" : "") + info.getNameSpace() + ":");
begin = end;
***************
*** 140,150 ****
tok = new StringTokenizer(atts,"\"",false);
! while (tok.hasMoreTokens()) {
token = tok.nextToken();
out.write(token);
! out.write("\"");
out.write(xmlEncode(tok.nextToken()));
out.write("\"");
}
out.write(">");
--- 177,192 ----
tok = new StringTokenizer(atts,"\"",false);
! if (tok.countTokens() == 1)
! out.write(info.getCorrectRMLTagName(tagName));
!
! while (tok.hasMoreTokens() && tok.countTokens() != 1) {
token = tok.nextToken();
out.write(token);
! out.write(" \"");
out.write(xmlEncode(tok.nextToken()));
out.write("\"");
}
+
+
out.write(">");
Index: MacroToXMLHandler.class
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXMLHandler.class,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
Binary files /tmp/cvsolhIcy and /tmp/cvs0qb4hW differ
Index: MacroToXMLHandler.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXMLHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MacroToXMLHandler.java 2002/01/19 07:00:36 1.2
--- MacroToXMLHandler.java 2002/01/19 17:42:46 1.3
***************
*** 13,23 ****
SCHEMA_NAMESPACE = "schemanamespace",
SCRIPT_CHAR = "scriptchar",
! SCRIPT_TAG = "scipttag",
! ECHO_SCRIPT_TAG = "echoscripttag";
String nameSpace,rmlSchema,textTag,scriptTag,echoScriptTag;
char scriptChar;
HashMap rmlTags;
!
StringBuffer currBuff;
--- 13,24 ----
SCHEMA_NAMESPACE = "schemanamespace",
SCRIPT_CHAR = "scriptchar",
! SCRIPT_TAG = "scripttag",
! ECHO_SCRIPT_TAG = "echoscripttag",
! RML_TRANS = "rmltrans";
String nameSpace,rmlSchema,textTag,scriptTag,echoScriptTag;
char scriptChar;
HashMap rmlTags;
! Attributes atts;
StringBuffer currBuff;
***************
*** 40,50 ****
public void startElement(String namespaceURI, String loaclName, String rawName, Attributes atts) throws SAXException {
currBuff = new StringBuffer();
}
! public void endElement(String namespaceURI, String loaclName, String rawName) throws SAXException {
! String name = rawName.toLowerCase();
if (name.equals(RML)) {
! rmlTags.put(currBuff.toString().trim().toLowerCase(),currBuff.toString().trim());
}
else if (name.equals(TEXT_TAG)) {
--- 41,54 ----
public void startElement(String namespaceURI, String loaclName, String rawName, Attributes atts) throws SAXException {
currBuff = new StringBuffer();
+ this.atts=atts;
}
! public void endElement(String namespaceURI, String localName, String rawName) throws SAXException {
! String name = localName.toLowerCase();
if (name.equals(RML)) {
! 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)) {
***************
*** 66,69 ****
--- 70,76 ----
echoScriptTag = currBuff.toString();
}
+ else if (name.equals(RML_TRANS)) {
+ //do nothing
+ }
else {
throw new SAXException("Tag : " + rawName + " is not a valid tag");
***************
*** 72,76 ****
public void characters(char[] ch, int start, int end) {
! currBuff.append(ch);
}
--- 79,85 ----
public void characters(char[] ch, int start, int end) {
! for (int i=start;i<start + end;i++) {
! currBuff.append(ch[i]);
! }
}
***************
*** 96,107 ****
public boolean isRMLTag(String tag) {
! return rmlTags.get(tag) != null;
}
public String getCorrectRMLTagName(String tag) {
! return (String) rmlTags.get(tag);
}
}
--- 105,132 ----
public boolean isRMLTag(String tag) {
! System.out.println("is a rml tag? : " + tag);
! return rmlTags.get(tag.toLowerCase().trim()) != null;
}
public String getCorrectRMLTagName(String tag) {
! return ((Tag) rmlTags.get(tag.toLowerCase().trim())).name;
! }
!
! public boolean isTagSimple(String tag) {
! System.out.println("tag " + tag + " exits " + isRMLTag(tag));
! return ((Tag) rmlTags.get(tag.toLowerCase().trim())).isSimple;
}
+ }
+
+ class Tag {
+ String name;
+ boolean isSimple;
+
+ Tag (String name, boolean isSimple) {
+ this.name=name;
+ this.isSimple = isSimple;
+ }
}
|
|
From: Marc B. <big...@us...> - 2002-01-19 17:42:48
|
Update of /cvsroot/idrs/Idrs/dev/projects/compiler In directory usw-pr-cvs1:/tmp/cvs-serv27321/dev/projects/compiler Modified Files: rmlTrans.xml rmlTransSchema.xml Log Message: The macro translation process is MOSTLY working, there are still a couple of bugs to kick out of the system though Index: rmlTrans.xml =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/projects/compiler/rmlTrans.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rmlTrans.xml 2002/01/19 06:51:26 1.2 --- rmlTrans.xml 2002/01/19 17:42:45 1.3 *************** *** 2,33 **** <trans:rmlTrans xmlns:trans="rmlTransSchema.xml"> <!-- define valid rml tags --> ! <trans:rml>rml</trans:rml> ! <trans:rml>ishtml</trans:rml> ! <trans:rml>scriptClass</trans:rml> ! <trans:rml>head</trans:rml> ! <trans:rml>object</trans:rml> ! <trans:rml>class</trans:rml> ! <trans:rml>constructor</trans:rml> ! <trans:rml>vartype</trans:rml> ! <trans:rml>method</trans:rml> ! <trans:rml>name</trans:rml> ! <trans:rml>db</trans:rml> ! <trans:rml>dbDriver</trans:rml> ! <trans:rml>dbName</trans:rml> ! <trans:rml>dbUser</trans:rml> ! <trans:rml>dbPass</trans:rml> ! <trans:rml>useDb</trans:rml> ! <trans:rml>usemethod</trans:rml> ! <trans:rml>sql</trans:rml> ! <trans:rml>storedProc</trans:rml> ! <trans:rml>varlist</trans:rml> ! <trans:rml>body</trans:rml> ! <trans:rml>field</trans:rml> ! <trans:rml>ifResults</trans:rml> ! <trans:rml>yes</trans:rml> ! <trans:rml>no</trans:rml> ! <trans:rml>repeat</trans:rml> ! <trans:rml>ifChange</trans:rml> ! <trans:rml>inputResults</trans:rml> <!-- text tag --> --- 2,34 ---- <trans:rmlTrans xmlns:trans="rmlTransSchema.xml"> <!-- define valid rml tags --> ! <trans:rml simple="false" >rml</trans:rml> ! <trans:rml simple="true" >ishtml</trans:rml> ! <trans:rml simple="true" >scriptClass</trans:rml> ! <trans:rml simple="false" >head</trans:rml> ! <trans:rml simple="false" >object</trans:rml> ! <trans:rml simple="true" >class</trans:rml> ! <trans:rml simple="false" >constructor</trans:rml> ! <trans:rml simple="true" >vartype</trans:rml> ! <trans:rml simple="false" >method</trans:rml> ! <trans:rml simple="true" >name</trans:rml> ! <trans:rml simple="false" >db</trans:rml> ! <trans:rml simple="true" >dbDriver</trans:rml> ! <trans:rml simple="true" >dbName</trans:rml> ! <trans:rml simple="true" >dbUser</trans:rml> ! <trans:rml simple="true" >dbPass</trans:rml> ! <trans:rml simple="true" >useDb</trans:rml> ! <trans:rml simple="true" >usemethod</trans:rml> ! <trans:rml simple="false" >sql</trans:rml> ! <trans:rml simple="false" >storedProc</trans:rml> ! <trans:rml simple="false" >varlist</trans:rml> ! <trans:rml simple="false" >body</trans:rml> ! <trans:rml simple="true" >field</trans:rml> ! <trans:rml simple="true" >src</trans:rml> ! <trans:rml simple="false" >ifResults</trans:rml> ! <trans:rml simple="false" >yes</trans:rml> ! <trans:rml simple="false" >no</trans:rml> ! <trans:rml simple="false" >repeat</trans:rml> ! <trans:rml simple="false" >ifChange</trans:rml> ! <trans:rml simple="true" >inputResults</trans:rml> <!-- text tag --> *************** *** 38,45 **** <!-- echo script tag --> ! <trans:echoScriptTag>echoScriptTag</trans:echoScriptTag> <!-- Script tag char --> ! <trans:schriptChar>$</trans:scriptChar> <!-- Location of RML Schema --> --- 39,46 ---- <!-- echo script tag --> ! <trans:echoScriptTag>echoScript</trans:echoScriptTag> <!-- Script tag char --> ! <trans:scriptChar>$</trans:scriptChar> <!-- Location of RML Schema --> Index: rmlTransSchema.xml =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/projects/compiler/rmlTransSchema.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** rmlTransSchema.xml 2002/01/19 06:51:26 1.2 --- rmlTransSchema.xml 2002/01/19 17:42:46 1.3 *************** *** 5,27 **** <xs:sequence> <!-- a list of rml elements is used to identify all valid rml tags (db,field,... --> ! <element name="rml" type="xs:string" minOccurrs="1" maxOccurrs="unbound" /> <!-- Used to identify what tag will be used for non-RML text purposes --> ! <element name="textTag" type="xs:string" minOccurrs="1" maxOccurrs="1" /> <!-- Used to identify what tag will be used for script purposes --> ! <element name="scriptTag" type="xs:string" minOccurrs="1" maxOccurrs="1" /> <!-- Used to identify what tag will be used for echo script purposes --> ! <element name="echoScriptTag" type="xs:string" minOccurrs="1" maxOccurrs="1" /> <!-- defines what character will be used to signify a script, currently $ --> ! <element name="schriptChar" type="xs:char" minOccurrs="1" maxOccurrs="1" /> <!-- defines the RML schema's locaton --> ! <element name="schemaLocation" type="xs:string" minOccurrs="1" maxOccurrs="1" /> <!-- defines the RML schema's name space --> ! <element name="schemaNameSpace" type="xs:string" minOccurrs="1" maxOccurrs="1" /> </xs:sequence> </xs:complexType> --- 5,29 ---- <xs:sequence> <!-- a list of rml elements is used to identify all valid rml tags (db,field,... --> ! <xs:element name="rml" type="xs:string" minOccurrs="1" maxOccurrs="unbound"> ! <xs:attribute name="simple" type="xs:boolean" /> ! </xs:element> <!-- Used to identify what tag will be used for non-RML text purposes --> ! <xs:element name="textTag" type="xs:string" minOccurrs="1" maxOccurrs="1" /> <!-- Used to identify what tag will be used for script purposes --> ! <xs:element name="scriptTag" type="xs:string" minOccurrs="1" maxOccurrs="1" /> <!-- Used to identify what tag will be used for echo script purposes --> ! <xs:element name="echoScriptTag" type="xs:string" minOccurrs="1" maxOccurrs="1" /> <!-- defines what character will be used to signify a script, currently $ --> ! <xs:element name="scriptChar" type="xs:char" minOccurrs="1" maxOccurrs="1" /> <!-- defines the RML schema's locaton --> ! <xs:element name="schemaLocation" type="xs:string" minOccurrs="1" maxOccurrs="1" /> <!-- defines the RML schema's name space --> ! <xs:element name="schemaNameSpace" type="xs:string" minOccurrs="1" maxOccurrs="1" /> </xs:sequence> </xs:complexType> |
|
From: Marc B. <big...@us...> - 2002-01-19 07:00:39
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro
In directory usw-pr-cvs1:/tmp/cvs-serv17234/dev/src/net/sourceforge/idrs/deploy/macro
Modified Files:
MacroToXML.class MacroToXML.java MacroToXMLHandler.class
MacroToXMLHandler.java
Log Message:
Initial macro system built, not yet tested
Index: MacroToXML.class
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXML.class,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
Binary files /tmp/cvsfVMUlV and /tmp/cvsiDSotG differ
Index: MacroToXML.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXML.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** MacroToXML.java 2002/01/18 21:34:39 1.4
--- MacroToXML.java 2002/01/19 07:00:36 1.5
***************
*** 1,5 ****
package net.sourceforge.idrs.deploy.macro;
-
import org.xml.sax.*;
import org.xml.sax.helpers.*;
--- 1,4 ----
***************
*** 10,18 ****
public class MacroToXML {
String rmlSrc;
public MacroToXML(String parser, String xmlSrc, boolean isFile) throws Exception {
XMLReader xmlParser = XMLReaderFactory.createXMLReader(parser);
InputSource in;
! MacroToXMLHandler info = new MacroToXMLHandler();
if (isFile) {
in = new InputSource(new InputStreamReader(new FileInputStream(new File(xmlSrc))));
--- 9,19 ----
public class MacroToXML {
String rmlSrc;
+ Writer out;
+ MacroToXMLHandler info;
public MacroToXML(String parser, String xmlSrc, boolean isFile) throws Exception {
XMLReader xmlParser = XMLReaderFactory.createXMLReader(parser);
InputSource in;
! info = new MacroToXMLHandler();
if (isFile) {
in = new InputSource(new InputStreamReader(new FileInputStream(new File(xmlSrc))));
***************
*** 29,33 ****
--- 30,171 ----
}
+ public void setWriter(Writer out) throws IOException {
+ this.out = out;
+ }
+
+ public void transformToXML() throws IOException{
+ int begin=0,end=0,tagEnd;
+ boolean isScript;
+
+ String curr = "", tag="";
+
+ do {
+ end = rmlSrc.indexOf("<");
+ isScript = isScriptTag(end);
+ curr = rmlSrc.substring(begin,end);
+ outText(curr);
+ if (isScript) {
+ tagEnd = outScript(end);
+ }
+ else {
+ tagEnd = readTag(end);
+ outText(curr);
+ tag = rmlSrc.substring(end + 1, tagEnd);
+
+ if (isRMLTag(tag))
+ outTag(tag);
+ else
+ outText(tag);
+ }
+
+ begin = tagEnd + 1;
+ }
+ while (end != -1);
+ }
+
+ protected boolean isScriptTag(int begin) {
+ return rmlSrc.charAt(begin + 1) == info.getScriptChar();
+ }
+
+ protected int outScript(int begin) throws IOException {
+ int end = rmlSrc.indexOf(info.getScriptChar() + ">",begin);
+ boolean isEcho = rmlSrc.charAt(begin + 2) == '=';
+
+ out.write("<" + info.getNameSpace() + ":");
+ out.write( isEcho ? info.getEchoScriptTag() : info.getScriptTag());
+ out.write(">");
+
+ out.write(xmlEncode(rmlSrc.substring((isEcho ? begin + 3 : begin + 2),end)));
+
+ out.write("</" + info.getNameSpace() + ":");
+ out.write( isEcho ? info.getEchoScriptTag() : info.getScriptTag());
+ out.write(">");
+
+ return end + 2;
+ }
+
+ protected void outText(String txt) throws IOException {
+ out.write("<" + info.getNameSpace() + ":" + info.getTextTag() + ">");
+ out.write(xmlEncode(txt));
+ out.write("</" + info.getNameSpace() + ":" + info.getTextTag() + ">");
+ }
+
+ protected int readTag(int begin) {
+ return rmlSrc.indexOf(">", begin);
+ }
+
+ protected boolean isRMLTag(String tag) {
+ int begin=0, end=0;
+ char c;
+ c = tag.charAt(1);
+ String tagName;
+
+ if (c == '/') {
+ begin = 2;
+ }
+ else {
+ begin = 1;
+ }
+
+ tagName = tag.substring(begin,tag.indexOf(" ",begin));
+
+ return info.isRMLTag(tag.toLowerCase().trim());
+ }
+
+ protected void outTag(String tag) throws IOException {
+ int begin=0, end=0;
+ char c;
+ c = tag.charAt(1);
+ String tagName;
+ String atts;
+ StringTokenizer tok;
+ String token;
+
+ if (c == '/') {
+ begin = 2;
+ }
+ else {
+ begin = 1;
+ }
+
+ end = tag.indexOf(" ",begin);
+ tagName = tag.substring(begin,end);
+
+ out.write("<" + ((c=='/') ? "/" : "") + info.getNameSpace() + ":" + info.getCorrectRMLTagName(tagName) + " ");
+
+ begin = end;
+ end = tag.indexOf(">");
+
+ atts = tag.substring(begin + 1,end);
+ tok = new StringTokenizer(atts,"\"",false);
+
+ while (tok.hasMoreTokens()) {
+ token = tok.nextToken();
+ out.write(token);
+ out.write("\"");
+ out.write(xmlEncode(tok.nextToken()));
+ out.write("\"");
+ }
+
+ out.write(">");
+
+ }
+ protected String xmlEncode(String txt) {
+ StringBuffer buffer = new StringBuffer();
+
+ for (int i = 0;i<txt.length();i++) {
+ switch (txt.charAt(i)) {
+ case '&' : buffer.append("&"); break;
+ case '<' : buffer.append("<"); break;
+ case '>' : buffer.append(">"); break;
+ case '\'' : buffer.append("'"); break;
+ case '\"' : buffer.append("""); break;
+ default : buffer.append(txt.charAt(i));
+ }
+ }
+
+ return buffer.toString();
+ }
Index: MacroToXMLHandler.class
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXMLHandler.class,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
Binary files /tmp/cvsssZwbY and /tmp/cvsiiNe6L differ
Index: MacroToXMLHandler.java
===================================================================
RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXMLHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MacroToXMLHandler.java 2002/01/18 15:21:46 1.1
--- MacroToXMLHandler.java 2002/01/19 07:00:36 1.2
***************
*** 12,20 ****
SCHEMA_LOCATION = "schemalocation",
SCHEMA_NAMESPACE = "schemanamespace",
! SCRIPT_CHAR = "scriptchar";
! String nameSpace,rmlSchema,textTag;
char scriptChar;
! LinkedList rmlTags;
StringBuffer currBuff;
--- 12,22 ----
SCHEMA_LOCATION = "schemalocation",
SCHEMA_NAMESPACE = "schemanamespace",
! SCRIPT_CHAR = "scriptchar",
! SCRIPT_TAG = "scipttag",
! ECHO_SCRIPT_TAG = "echoscripttag";
! String nameSpace,rmlSchema,textTag,scriptTag,echoScriptTag;
char scriptChar;
! HashMap rmlTags;
StringBuffer currBuff;
***************
*** 25,29 ****
public MacroToXMLHandler() {
super();
! rmlTags = new LinkedList();
}
--- 27,31 ----
public MacroToXMLHandler() {
super();
! rmlTags = new HashMap();
}
***************
*** 44,48 ****
if (name.equals(RML)) {
! rmlTags.add(currBuff.toString().trim());
}
else if (name.equals(TEXT_TAG)) {
--- 46,50 ----
if (name.equals(RML)) {
! rmlTags.put(currBuff.toString().trim().toLowerCase(),currBuff.toString().trim());
}
else if (name.equals(TEXT_TAG)) {
***************
*** 58,61 ****
--- 60,69 ----
scriptChar = currBuff.toString().trim().charAt(0);
}
+ else if (name.equals(SCRIPT_TAG)) {
+ scriptTag = currBuff.toString();
+ }
+ else if (name.equals(ECHO_SCRIPT_TAG)) {
+ echoScriptTag = currBuff.toString();
+ }
else {
throw new SAXException("Tag : " + rawName + " is not a valid tag");
***************
*** 65,68 ****
--- 73,104 ----
public void characters(char[] ch, int start, int end) {
currBuff.append(ch);
+ }
+
+ public char getScriptChar() {
+ return this.scriptChar;
+ }
+
+ public String getScriptTag() {
+ return this.scriptTag;
+ }
+
+ public String getEchoScriptTag() {
+ return this.echoScriptTag;
+ }
+
+ public String getNameSpace() {
+ return nameSpace;
+ }
+
+ public String getTextTag() {
+ return textTag;
+ }
+
+ public boolean isRMLTag(String tag) {
+ return rmlTags.get(tag) != null;
+ }
+
+ public String getCorrectRMLTagName(String tag) {
+ return (String) rmlTags.get(tag);
}
|
|
From: Marc B. <big...@us...> - 2002-01-19 06:51:29
|
Update of /cvsroot/idrs/Idrs/dev/projects/compiler In directory usw-pr-cvs1:/tmp/cvs-serv16090/dev/projects/compiler Modified Files: rmlTrans.xml rmlTransSchema.xml Log Message: test commit Index: rmlTrans.xml =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/projects/compiler/rmlTrans.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rmlTrans.xml 2002/01/16 05:24:33 1.1 --- rmlTrans.xml 2002/01/19 06:51:26 1.2 *************** *** 34,37 **** --- 34,43 ---- <trans:textTag>text</trans:textTag> + <!-- script tag --> + <trans:scriptTag>script</trans:scriptTag> + + <!-- echo script tag --> + <trans:echoScriptTag>echoScriptTag</trans:echoScriptTag> + <!-- Script tag char --> <trans:schriptChar>$</trans:scriptChar> Index: rmlTransSchema.xml =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/projects/compiler/rmlTransSchema.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rmlTransSchema.xml 2002/01/16 05:24:33 1.1 --- rmlTransSchema.xml 2002/01/19 06:51:26 1.2 *************** *** 10,13 **** --- 10,19 ---- <element name="textTag" type="xs:string" minOccurrs="1" maxOccurrs="1" /> + <!-- Used to identify what tag will be used for script purposes --> + <element name="scriptTag" type="xs:string" minOccurrs="1" maxOccurrs="1" /> + + <!-- Used to identify what tag will be used for echo script purposes --> + <element name="echoScriptTag" type="xs:string" minOccurrs="1" maxOccurrs="1" /> + <!-- defines what character will be used to signify a script, currently $ --> <element name="schriptChar" type="xs:char" minOccurrs="1" maxOccurrs="1" /> |
|
From: Marc B. <big...@us...> - 2002-01-18 21:34:42
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro In directory usw-pr-cvs1:/tmp/cvs-serv12022 Modified Files: MacroToXML.java Log Message: test commit Index: MacroToXML.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXML.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MacroToXML.java 2002/01/18 17:43:58 1.3 --- MacroToXML.java 2002/01/18 21:34:39 1.4 *************** *** 1,4 **** package net.sourceforge.idrs.deploy.macro; ! //Converts RML Page to XML import org.xml.sax.*; --- 1,4 ---- package net.sourceforge.idrs.deploy.macro; ! import org.xml.sax.*; |