1 28 29 package com.caucho.eswrap.org.xml.sax; 30 31 import com.caucho.es.Call; 32 33 import org.xml.sax.InputSource ; 34 import org.xml.sax.XMLReader ; 35 36 import java.io.IOException ; 37 import java.io.InputStream ; 38 39 public class XMLReaderEcmaWrap { 40 public static void parse(XMLReader parser, Call call, int length) 41 throws Throwable 42 { 43 Object obj = call.getArgObject(0, length); 44 45 if (obj instanceof InputSource ) 46 parser.parse((InputSource ) obj); 47 else if (obj instanceof InputStream ) { 48 String systemId = call.getArgString(1, length); 49 InputStream is = (InputStream ) obj; 50 InputSource source = new InputSource (is); 51 source.setSystemId(systemId); 52 parser.parse(source); 53 } 54 else if (obj instanceof String ) { 55 parser.parse((String ) obj); 56 } 57 else 58 throw new IOException (String.valueOf(obj.getClass())); 59 } 60 } 61 | Popular Tags |