Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: gef/src/org/tigris/gef/xml/pgml PGMLParser.java

gef
Discussion topic

Back to topic list

CVS update: gef/src/org/tigris/gef/xml/pgml PGMLParser.java

Reply

Author toby
Full name Toby Baier
Date 2001-04-03 08:17:12 PDT
Message User: toby
  Date: 01/04/03 08:17:12

  Modified: src/org/tigris/gef/xml/pgml PGMLParser.java
  Log:
  added stream reading feature (for .zargo files)
  Obtained from:Toby
  Submitted by:Toby
  
  Revision Changes Path
  1.11 +26 -6 gef/src/org/tigris/g​ef/xml/pgml/PGMLPars​er.java
  
  Index: PGMLParser.java
  ====================​====================​====================​=======
  RCS file: /cvs/gef/src/org/tig​ris/gef/xml/pgml/PGM​LParser.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PGMLParser.java 2001/03/14 09:34:52 1.10
  +++ PGMLParser.java 2001/04/03 15:17:12 1.11
  @@ -64,11 +64,23 @@
     // main parsing methods
   
     public synchronized Diagram readDiagram(URL url) {
  + try {
  + return readDiagram(url.openStream());
  + } catch (IOException e) {
  + System.out.println("Couldn't open InputStream! "+e);
  + e.printStackTrace();
  + }
  + return null;
  + }
  +
  + public synchronized Diagram readDiagram(InputStream is) {
  + return readDiagram(is, true);
  + }
  +
  + public synchronized Diagram readDiagram(InputStream is, boolean closeStream) {
       try {
  - InputStream is = url.openStream();
  - String filename = url.getFile();
         System.out.println("​====================​==================="​);
  - System.out.println("== READING DIAGRAM: " + url);
  + System.out.println("== READING DIAGRAM");
         SAXParserFactory factory = SAXParserFactory.newInstance();
         factory.setNamespace​Aware(false);
         factory.setValidating(false);
  @@ -76,10 +88,18 @@
         _figRegistry = new HashMap();
         SAXParser pc = factory.newSAXParser();
         InputSource source = new InputSource(is);
  - source.setSystemId(u​rl.toString());
  +
  + // what is this for?
  + // source.setSystemId(u​rl.toString());
         pc.parse(source,this);
  - source = null;
  - is.close();
  + // source = null;
  + if (closeStream) {
  + System.out.println("closing stream now (in PGMLParser.readDiagram)");
  + is.close();
  + }
  + else {
  + System.out.println("leaving stream OPEN!");
  + }
         return _diagram;
       }
       catch(SAXException saxEx) {

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: gef/src/org/tigris/gef/xml/pgml PGMLParser.java toby Toby Baier 2001-04-03 08:17:12 PDT
Messages per page: