User: rinkrank Date: 02/09/29 17:39:01 Added: src/java/xgg/html HTMLUtil.java Log: -DTDs are now converted to HTML, and there are cross-links between the bean interfaces' javadocs and the DTD. This should make the documentation of the XGG generated stuff quite good. -Generation of a factory class for each DTD, that will return the impl bean. -Impl beans are now package private. Let's try to keep them package private. Revision Changes Path 1.1 xgg/src/java/xgg/html/HTMLUtil.java Index: HTMLUtil.java =================================================================== package xgg.html; import java.util.*; import java.io.*; /** * This class represents a child in an ELEMENT declaration. * * @author <a href="mailto:[EMAIL PROTECTED]">Aslak Hellesøy</a> */ public class HTMLUtil { private final String DELIMS = ",|*?+()"; /** * Turns content into HTML with links */ public String toHTML( String element ) { StringBuffer result = new StringBuffer(); StringTokenizer st = new StringTokenizer( element, DELIMS, true ); while( st.hasMoreTokens() ) { String token = st.nextToken(); if( DELIMS.indexOf(token) != -1 ) { result.append(token); } else { result.append(createLink(token.trim())); } } return result.toString(); } private String createLink(String child) { return "<a href=\"#" + child + "\">" + child + "</a>"; } public String commentToHTML( String comment ) throws IOException { StringBuffer result = new StringBuffer(); BufferedReader br = new BufferedReader(new StringReader(comment)); String line = null; while( (line = br.readLine()) != null ) { result.append(escape(line)).append(System.getProperty("line.separator")); } return result.toString(); } private String escape(String s) { StringBuffer sb = new StringBuffer(); for( int i = 0; i < s.length(); i++ ) { char c = s.charAt( i ); if( c == '<' ) { sb.append("<"); } else if( c == '>' ){ sb.append(">"); } else if( c == '"' ){ sb.append("""); } else if( c == '&' ){ sb.append("&"); } else { sb.append(c); } } return sb.toString(); } public String toWalkUpPath(String pakkage) { StringBuffer result = new StringBuffer(); StringTokenizer st = new StringTokenizer(pakkage, "."); int depth = st.countTokens(); for( int i = 0; i < depth; i++ ) { result.append( "../" ); } return result.toString(); } }
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel