FileDocCategorySizeDatePackage
Flatten.javaAPI DocGlassfish v2 API4523Fri May 04 22:24:40 BST 2007com.sun.enterprise.config.serverbeans.validation

Flatten

public class Flatten extends Object

Fields Summary
Constructors Summary
Methods Summary
private static org.xml.sax.ContentHandlergetContentHandler(java.io.OutputStream o)

        ToXMLStream xml = new ToXMLStream();
        xml.setOutputStream(o);
        xml.setOmitXMLDeclaration(true);
        return xml.asContentHandler();
    
private static org.xml.sax.XMLReadergetXmlReader()

        return XMLReaderFactory.newInstance(System.err);
    
public static voidmain(java.lang.String[] args)


        String input = null;
        OutputStream output = System.out;
        EntityResolver entityResolver = null;
        
        if ( args.length < 1 || 5 < args.length){
            System.err.println("Flatten [-out output-file] [-dtd dtd] input ");
        }

        for (int i = 0; i < args.length; i++){
            if (args[i].equals("-out")){
                output = new FileOutputStream(new File(args[++i]));
                break;
            }
            if (args[i].equals("-dtd")){
                entityResolver = new MyEntityResolver(args[++i]);
                break;
            }
            input = args[i];
        }

    
        

        VariableResolver vr = new VariableResolver();
        if (null != entityResolver){
            vr.setEntityResolver(entityResolver);
        }
        
//         vr.setParent(getXmlReader());
        vr.setContentHandler(getContentHandler(output));
        vr.parse(new InputSource(input));