Added entity masking &quote;

This commit is contained in:
Aidan Butler 2002-10-24 08:19:55 +00:00
parent fc48d6160c
commit a57090bed3
3 changed files with 19 additions and 7 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: FlatXml.cxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: aidan $ $Date: 2002-10-23 15:52:16 $
* last change: $Author: aidan $ $Date: 2002-10-24 09:19:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -189,6 +189,9 @@ OUString needsMask(OUString origString){
if (origString.indexOf(rtl::OUString::createFromAscii("&"))!=-1){
origString=replace(origString,rtl::OUString::createFromAscii("&"),rtl::OUString::createFromAscii("&"));
}
if (origString.indexOf(rtl::OUString::createFromAscii("\""))!=-1){
origString=replace(origString,rtl::OUString::createFromAscii("\""),rtl::OUString::createFromAscii("""));
}
if (origString.indexOf(rtl::OUString::createFromAscii("<"))!=-1){
origString=replace(origString,rtl::OUString::createFromAscii("<"),rtl::OUString::createFromAscii("&lt;"));
}

View file

@ -258,6 +258,9 @@ public class XFlatXml {
if (origString.indexOf("&")!=-1){
origString=replace(origString,"&","&amp;");
}
if (origString.indexOf("\"")!=-1){
origString=replace(origString,"\"","&quot;");
}
if (origString.indexOf("<")!=-1){
origString=replace(origString,"<","&lt;");
}

View file

@ -251,9 +251,7 @@ public class XMergeBridge {
XInputStream.class , xPipeObj );
xOutStream = (XOutputStream) UnoRuntime.queryInterface(
XOutputStream.class , xPipeObj );
convert (xis,xOutStream,false,udJarPath,sFileName,offMime,sdMime);
Object xSaxParserObj=xMSF.createInstance("com.sun.star.xml.sax.Parser");
XParser xParser = (XParser) UnoRuntime.queryInterface(
@ -268,7 +266,6 @@ public class XMergeBridge {
}
aInput.sSystemId = sFileName;
aInput.aInputStream =xInStream;
xParser.setDocumentHandler ( xDocHandler );
xParser.parseStream ( aInput );
@ -386,6 +383,9 @@ public class XMergeBridge {
public String needsMask(String origString){
if (origString.indexOf("&")!=-1){
origString=replace(origString,"&","&amp;");
}
if (origString.indexOf("\"")!=-1){
origString=replace(origString,"\"","&quot;");
}
if (origString.indexOf("<")!=-1){
origString=replace(origString,"<","&lt;");
@ -405,6 +405,7 @@ public class XMergeBridge {
public void endDocument()
{
try{
convert (xInStream,xos,true,udJarPath,sURL,offMime,sdMime);
@ -503,7 +504,6 @@ public class XMergeBridge {
XOutputStreamToOutputStreamAdapter newxos =new XOutputStreamToOutputStreamAdapter(device);
try{
ConverterInfoReader cir = new ConverterInfoReader(jarName,false);
ciEnum =cir.getConverterInfoEnumeration();
@ -579,6 +579,10 @@ public class XMergeBridge {
}
ConverterInfoMgr.removeByJar(jarName);
}
catch (StackOverflowError sOE){
System.out.println("\nERROR : Stack OverFlow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n");
}
catch (Exception e) {
System.out.println("Error:"+e);
throw new IOException("Xmerge Exception");
@ -588,7 +592,6 @@ public class XMergeBridge {
try {
//Check to see if jar contains a plugin Impl
ConverterInfoMgr.addPlugIn(ciEnum);
ConverterFactory cf = new ConverterFactory();
Convert cv = cf.getConverter(ConverterInfoMgr.findConverterInfo(sdMime,offMime),true);
@ -613,6 +616,9 @@ public class XMergeBridge {
}
ConverterInfoMgr.removeByJar(jarName);
}
catch (StackOverflowError sOE){
System.out.println("\nERROR : Stack OverFlow. \n Increase of the JRE by adding the following line to the end of the javarc file \n \"-Xss1m\"\n");
}
catch (Exception e) {
System.out.println("Error:"+e);
throw new IOException("Xmerge Exception");