[Idrs-commit] CVS: Idrs/dev/src/net/sourceforge/idrs/deploy/macro MacroToXML.java,1.21,1.22
Brought to you by:
bigman921
|
From: Marc B. <big...@us...> - 2004-09-11 20:08:48
|
Update of /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19267/src/net/sourceforge/idrs/deploy/macro Modified Files: MacroToXML.java Log Message: Added a "while" tag that allows a condition for looping : <while condition="value < x"> . . . </while> Previosly a script block had to be used to do while loops. The condition is in the form of whatever the scriptcontext uses Index: MacroToXML.java =================================================================== RCS file: /cvsroot/idrs/Idrs/dev/src/net/sourceforge/idrs/deploy/macro/MacroToXML.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** MacroToXML.java 30 Aug 2004 00:56:07 -0000 1.21 --- MacroToXML.java 11 Sep 2004 20:08:39 -0000 1.22 *************** *** 360,363 **** --- 360,377 ---- + private int findChar(char look,int begin) { + boolean inQuote = false; + for (int i=begin,m=rmlSrc.length();i<m;i++) { + if (rmlSrc.charAt(i) == '"' && rmlSrc.charAt(i-1) != '\\') { + inQuote = ! inQuote; + } else if (! inQuote && rmlSrc.charAt(i) == look) { + return i; + } + } + return -1; + } + + + /** *Reads rmlSrc for position of the end of the current tag *************** *** 366,371 **** protected int readTag(int begin) { int indexGT, indexLT; ! indexGT = rmlSrc.indexOf(">", begin); ! indexLT = rmlSrc.indexOf("<", begin+1); if (indexLT == -1 || indexGT < indexLT) { return indexGT + 1; --- 380,385 ---- protected int readTag(int begin) { int indexGT, indexLT; ! indexGT = findChar('>', begin); ! indexLT = findChar('<', begin+1); if (indexLT == -1 || indexGT < indexLT) { return indexGT + 1; *************** *** 463,466 **** --- 477,492 ---- } + + private int findChar(char look,String str) { + boolean inQuote = false; + for (int i=0,m=str.length();i<m;i++) { + if (str.charAt(i) == '"' && str.charAt(i-1) != '\\') { + inQuote = ! inQuote; + } else if (! inQuote && str.charAt(i) == look) { + return i; + } + } + return -1; + } /** *Writes the RML tag as full XML 1.0 tag *************** *** 473,476 **** --- 499,503 ---- }*/ + int begin=0, end=0,tmp,retEnd; int tokBegin, tokEnd; *************** *** 489,493 **** begin = end; ! end = tag.indexOf(">"); begin = tag.indexOf(tagName) + tagName.length(); --- 516,520 ---- begin = end; ! end = findChar('>',tag); begin = tag.indexOf(tagName) + tagName.length(); |