org.faktorips.runtime.internal
Class InternationalStringXmlReaderWriter

java.lang.Object
  extended by org.faktorips.runtime.internal.InternationalStringXmlReaderWriter

public class InternationalStringXmlReaderWriter
extends Object

Helper class to read international strings from XML and write them back to XML.

The helper should not be initialized, just use the static utility methods.


Field Summary
static String XML_ATTR_LOCALE
           
static String XML_ATTR_TEXT
           
static String XML_ELEMENT_LOCALIZED_STRING
           
static String XML_TAG
           
 
Method Summary
static Collection<org.faktorips.values.LocalizedString> fromXml(Element element)
          Reads the localized strings stored in the given XML Element.
static Collection<org.faktorips.values.LocalizedString> fromXml(Element element, String tagName)
          Reads the localized strings stored in the child Element with the specified name.
static Element toXml(Document doc, Collection<org.faktorips.values.LocalizedString> localizedStrings)
          Creates a new Element containing the given localized strings.
static Element toXml(Document doc, org.faktorips.values.DefaultInternationalString internationalString)
          Creates a new Element containing the given DefaultInternationalString.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_TAG

public static final String XML_TAG
See Also:
Constant Field Values

XML_ELEMENT_LOCALIZED_STRING

public static final String XML_ELEMENT_LOCALIZED_STRING
See Also:
Constant Field Values

XML_ATTR_LOCALE

public static final String XML_ATTR_LOCALE
See Also:
Constant Field Values

XML_ATTR_TEXT

public static final String XML_ATTR_TEXT
See Also:
Constant Field Values
Method Detail

toXml

public static Element toXml(Document doc,
                            org.faktorips.values.DefaultInternationalString internationalString)
Creates a new Element containing the given DefaultInternationalString.

Parameters:
doc - the xml Document used to store the new element.
internationalString - the DefaultInternationalString to be saved.
Returns:
the new element representing the given international string.

toXml

public static Element toXml(Document doc,
                            Collection<org.faktorips.values.LocalizedString> localizedStrings)
Creates a new Element containing the given localized strings. The element that is created represents an DefaultInternationalString even though the element can be created from passing only the contents (the localized strings) of an international string.

Parameters:
doc - the xml Document used to store the new element.
localizedStrings - the localized strings to be saved.
Returns:
the new element representing an international string.

fromXml

public static Collection<org.faktorips.values.LocalizedString> fromXml(Element element)
Reads the localized strings stored in the given XML Element. If the given element is not representing an international string, an empty collection is returned.

Parameters:
element - the XML Element representing an international string
Returns:
a collection of all localized strings defined in the international string represented by the given Element.

fromXml

public static Collection<org.faktorips.values.LocalizedString> fromXml(Element element,
                                                                       String tagName)
Reads the localized strings stored in the child Element with the specified name. If the given element does not contain a child of the given name or if that child does not represent an international string, an empty collection is returned.

Parameters:
element - the XML Element representing the parent of an international string.
tagName - the name of the child node representing an international string.
Returns:
a collection of all localized strings defined in the international string.


Copyright © 2015. All rights reserved.