Logo Search packages:      
Sourcecode: icedtea-web version File versions  Download package

static Node net::sourceforge::jnlp::Parser::getRootNode ( InputStream  input  )  throws ParseException [inline, static]

Return the root node from the XML document in the specified input stream.

ParseException if the JNLP file is invalid

Definition at line 1206 of file Parser.java.

References getEncoding(), and net::sourceforge::nanoxml::XMLElement::parseFromReader().

        try {
            /* SAX
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = factory.newDocumentBuilder();

            Document doc = builder.parse(input);
            return doc.getDocumentElement();

            /* TINY
            Node document = new Node(TinyParser.parseXML(input));
            Node jnlpNode = getChildNode(document, "jnlp"); // skip comments

            //A BufferedInputStream is used to allow marking and reseting
            //of a stream.
            BufferedInputStream bs = new BufferedInputStream(input);

            /* NANO */
            final XMLElement xml = new XMLElement();
            final PipedInputStream pin = new PipedInputStream();
            final PipedOutputStream pout = new PipedOutputStream(pin);
            final InputStreamReader isr = new InputStreamReader(bs, getEncoding(bs));
            // Clean the jnlp xml file of all comments before passing
            // it to the parser.
            new Thread(
                new Runnable(){
                    public void run(){
                        (new XMLElement()).sanitizeInput(isr, pout);
                        try {
                        } catch (IOException ioe) {
            xml.parseFromReader(new InputStreamReader(pin));
            Node jnlpNode = new Node(xml);
            return jnlpNode;
        catch(Exception ex) {
            throw new ParseException(R("PBadXML"), ex);

Generated by  Doxygen 1.6.0   Back to index