Author: bsnyder
Date: Tue May 20 07:00:15 2008
New Revision: 658249

URL: http://svn.apache.org/viewvc?rev=658249&view=rev
Log:
SM-1355 - XML escaping converter for SimpleFlatFileMarshaler

Added:
    
servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/XmlEscapingConverter.java
   (with props)

Added: 
servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/XmlEscapingConverter.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/XmlEscapingConverter.java?rev=658249&view=auto
==============================================================================
--- 
servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/XmlEscapingConverter.java
 (added)
+++ 
servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/XmlEscapingConverter.java
 Tue May 20 07:00:15 2008
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.components.util;
+
+/**
+ *
+ * @author Andrew Skiba <[EMAIL PROTECTED]>
+ */
+public class XmlEscapingConverter implements ContentConverter {
+
+    public String convertToXml(String contents) {
+        return contents.replaceAll("<", "&lt;").replaceAll(">", 
"&gt;").replaceAll("&", "&amp;");
+    }
+
+    public String convertToFlatFileContent(String contents) {
+        return contents.replaceAll("&lt;", "<").replaceAll("&gt;", 
">").replaceAll("&amp;", "&");
+    }
+}

Propchange: 
servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/XmlEscapingConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
servicemix/smx3/branches/servicemix-3.2/core/servicemix-core/src/main/java/org/apache/servicemix/components/util/XmlEscapingConverter.java
------------------------------------------------------------------------------
    svn:keywords = Id Revision


Reply via email to