Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: gef/src/org/tigris/gef/persistence SVGWriter.java

gef
Discussion topic

Back to topic list

CVS update: gef/src/org/tigris/gef/persistence SVGWriter.java

Reply

Author toby
Full name Toby Baier
Date 2001-03-12 08:11:27 PST
Message User: toby
  Date: 01/03/12 08:11:27

  Modified: src/org/tigris/gef/persistence SVGWriter.java
  Log:
  fixes < and > in SVG
  Obtained from:Luc
  Submitted by:Toby
  
  Revision Changes Path
  1.3 +29 -7 gef/src/org/tigris/g​ef/persistence/SVGWr​iter.java
  
  Index: SVGWriter.java
  ====================​====================​====================​=======
  RCS file: /cvs/gef/src/org/tig​ris/gef/persistence/​SVGWriter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SVGWriter.java 2000/11/29 07:43:11 1.2
  +++ SVGWriter.java 2001/03/12 16:11:27 1.3
  @@ -24,7 +24,7 @@
   // File: SVGWriter.java
   // Classes: SVGWriter
   // Original Author: Andreas Rueckert <a_rueckert at gmx dot net>
  -// $Id: SVGWriter.java,v 1.2 2000/11/29 07:43:11 carnold Exp $
  +// $Id: SVGWriter.java,v 1.3 2001/03/12 16:11:27 toby Exp $
   
   package org.tigris.gef.persistence;
   
  @@ -144,12 +144,34 @@
           p.print("]]>");
           break;
           }
  - // print text
  - case Node.TEXT_NODE:
  - {
  - p.print(node.getNodeValue());
  - break;
  - }
  + // print text
  + case Node.TEXT_NODE:
  + {
  + String text = node.getNodeValue();
  + for (int i = 0; i < text.length(); i++) {
  + // escape reserved characters
  + switch (text.charAt(i)) {
  + case '&' :
  + {
  + p.print("&amp;");
  + break;
  + }
  + case '<' :
  + {
  + p.print("&lt;");
  + break;
  + }
  + case '>' :
  + {
  + p.print("&gt;");
  + break;
  + }
  + default :
  + p.print(text.charAt(i));
  + }
  + }
  + break;
  + }
           // print processing instruction
       case Node.PROCESSING_INST​RUCTION_NODE:
           {

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

Messages

Show all messages in topic

CVS update: gef/src/org/tigris/gef/persistence SVGWriter.java toby Toby Baier 2001-03-12 08:11:27 PST
Messages per page: