1 19 package org.netbeans.modules.xml.tools.generator; 20 21 import java.util.*; 22 23 29 final class SAXBindingsGenerator { 30 31 32 public static String toXML(SAXGeneratorModel model) { 33 StringBuffer s = new StringBuffer (); 34 35 s.append("<?xml version='1.0' encoding='UTF-8'?>\n"); s.append("<!DOCTYPE SAX-bindings PUBLIC \"-//XML Module//DTD SAX Bindings 1.0//EN\" \"\">\n"); s.append("<SAX-bindings version='1'>\n"); s.append(elementBindings(model)); 39 s.append("</SAX-bindings>"); 43 return s.toString(); 44 } 45 46 private static String elementBindings(SAXGeneratorModel model) { 47 StringBuffer s = new StringBuffer (); 48 49 Iterator it = model.getElementBindings().values().iterator(); 50 while (it.hasNext()) { 51 ElementBindings.Entry next = (ElementBindings.Entry) it.next(); 52 s.append("\t<bind element='" + next.getElement() + "' method='" + next.getMethod() + "' "); s.append("type='" + next.getType() + "' "); if (next.getParslet() != null) { 55 s.append("parslet='" + next.getParslet() + "' "); } 57 s.append("></bind>\n"); } 59 return s.toString(); 60 } 61 62 65 76 } 77 | Popular Tags |