Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * $Id: CommonStringTransformer.java 130 2009-06-05 17:01:24Z karianna $
  * $URL: https://ikasaneip.svn.sourceforge.net/svnroot/ikasaneip/tags/ikasan-0.7.3/common/src/main/java/org/ikasan/common/CommonStringTransformer.java $
  * 
  * ====================================================================
  * Ikasan Enterprise Integration Platform
  * Copyright (c) 2003-2008 Mizuho International plc. and individual contributors as indicated
  * by the @authors tag. See the copyright.txt in the distribution for a
  * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the 
 * Free Software Foundation Europe e.V. Talstrasse 110, 40217 Dusseldorf, Germany 
 * or see the FSF site: http://www.fsfeurope.org/.
 * ====================================================================
 */
package org.ikasan.common;
Common String Transformer provides the base interface for all String Transformation.

Author(s):
Ikasan Development Team
  
public interface CommonStringTransformer

    
Provides functionality to parse a delimited string of single values or name-value pairs into a flat XML structure.

Example 1:

Delimited string of single value: |a|b|c|d|

Resulting xml:

 <root>
   <a/>
   <b/>
   <c/>
   <d/>
 </root>

Example 2:

Delimited string of name-value pair: |a=1|b=2|c=3|d=4|

Resulting xml:

 
 <root>
    <a>1</a>
    <b>2</b>
    <c>3</c>
    <d>4</d>
 </root>

Parameters:
string The delimited string to convert to flat XML string
delimiter The delimiter pattern used to tokenise the input string
tokenSeperator A name-value pair separator (i.e. '=' in "a=b")
rootElementName The root element of the flat xml to be returned
Returns:
String String representation of flat XML document.
Throws:
javax.xml.transform.TransformerException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
    public String delimitedStringToXMLString(String stringString delimiter
            String tokenSeperatorString rootElementName)
New to GrepCode? Check out our FAQ X