public FXGNode parse(InputStream stream,String documentName) throws FXGException, IOException {
  try {
    scanner.setDocumentName(documentName);
    SAXParserFactory saxFactory=SAXParserFactory.newInstance();
    saxFactory.setValidating(false);
    saxFactory.setNamespaceAware(true);
    SAXParser parser=saxFactory.newSAXParser();
    parser.parse(stream,scanner);
    FXGNode node=scanner.getRootNode();
    return node;
  }
 catch (  ParserConfigurationException ex) {
    throw new FXGException(scanner.getStartLine(),scanner.getStartColumn(),"ErrorParsingFXG",ex.getLocalizedMessage(),ex);
  }
catch (  SAXException ex) {
    throw new FXGException(scanner.getStartLine(),scanner.getStartColumn(),"ErrorParsingFXG",ex.getLocalizedMessage(),ex);
  }
 finally {
    stream.close();
  }
}

public FXGNode parse ( InputStream stream , String documentName ) throws FXGException , IOException { try { scanner . setDocumentName ( documentName ) ; SAXParserFactory saxFactory = SAXParserFactory . newInstance ( ) ; saxFactory . setValidating ( false ) ; saxFactory . setNamespaceAware ( true ) ; SAXParser parser = saxFactory . newSAXParser ( ) ; parser . parse ( stream , scanner ) ; FXGNode node = scanner . getRootNode ( ) ; return node ; } catch ( ParserConfigurationException ex ) { throw new FXGException ( scanner . getStartLine ( ) , scanner . getStartColumn ( ) , "ErrorParsingFXG" , ex . getLocalizedMessage ( ) , ex ) ; } catch ( SAXException ex ) { throw new FXGException ( scanner . getStartLine ( ) , scanner . getStartColumn ( ) , "ErrorParsingFXG" , ex . getLocalizedMessage ( ) , ex ) ; } finally { stream . close ( ) ; } }
parses an fxg document inputstream to produce an fxgnode based dom .
