FileDocCategorySizeDatePackage
CallFile2.javaAPI DocExample3130Fri Feb 01 13:19:54 GMT 2002None

CallFile2

public class CallFile2 extends Object
Exchanging XML with Server (SAX-only version)

Fields Summary
static final String
featurePrefix
Constructors Summary
Methods Summary
private static voidbindAll(org.xml.sax.XMLReader in, java.lang.Object out)

	if (out instanceof ContentHandler)
	    in.setContentHandler ((ContentHandler) out);
	if (out instanceof DTDHandler)
	    in.setDTDHandler ((DTDHandler) out);
	try {
	    if (out instanceof DeclHandler)
		in.setProperty ("http://xml.org/sax/properties/declaration-handler", out);
	} catch (SAXNotRecognizedException e) { /* IGNORE */ }
	try {
	    if (out instanceof LexicalHandler)
		in.setProperty ("http://xml.org/sax/properties/lexical-handler", out);
	} catch (SAXNotRecognizedException e) { /* IGNORE */ }
    
public static voidmain(java.lang.String[] argv)


    // argv [0] == in.xml (file name)
    // argv [1] == url for posting service
          
    
	try {
	    XMLReader		in;
	    CallWriter		caller;
	    XMLWriter		out;

	    out = new XMLWriter (System.out);
	    caller = new CallWriter (new URL (argv [1]), out);

	    in = XMLReaderFactory.createXMLReader ();
	    in.setFeature (featurePrefix + "namespace-prefixes", true);
	    bindAll (in, caller);

	    in.parse (Resolver.fileNameToURL (argv [0]));

	} catch (Exception  e) {
	    e.printStackTrace ();
	    System.exit (1);
	}