1 50 51 package org.openlaszlo.iv.flash.xml; 52 53 import java.io.*; 54 import java.util.*; 55 56 import org.w3c.dom.Node ; 57 import org.xml.sax.SAXException ; 58 59 import org.openlaszlo.iv.flash.api.*; 60 import org.openlaszlo.iv.flash.url.*; 61 import org.openlaszlo.iv.flash.util.*; 62 63 70 public class XMLDataSource { 71 72 private Node node; 73 74 public XMLDataSource() {} 75 76 public XMLDataSource( String surl, FlashFile flashFile ) throws IVException, IOException, SAXException { 77 if( surl == null || surl.length() == 0 ) { 78 throw new IOException( "null datasource" ); 79 } 80 81 if( surl.charAt(0) == '#' || surl.charAt(0) == '=' ) { 82 byte[] bytes = flashFile.getEncoding() != null? surl.substring(1).getBytes(flashFile.getEncoding()): 83 surl.substring(1).getBytes(); 84 node = XMLHelper.parse( new ByteArrayInputStream( bytes ) ); 85 } else { 86 IVUrl url = IVUrl.newUrl( surl, flashFile ); 87 node = XMLHelper.getNode( url ); 88 } 89 } 90 91 public Node getNode() { 92 return node; 93 } 94 } 95 | Popular Tags |