Class XMLResourceBundleParser
java.lang.Object
org.exoplatform.services.resources.XMLResourceBundleParser
A parser for XML resource bundle having the following rules:
- The root document element is named "bundle"
- Any non root element can have any name
- Any non root element content must not have mixed content (i.e text and children elements)
- Any element having textual content is considered as a bundle entry with they key formed by the dot concatenation of its parent element name except the root element and the value is the text content
- foo.A=1
- foo.B=2
- C=3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasMap(InputStream in) asMap(InputSource in) Load an xml resource bundle as aMap<String,String>object.static Propertiesstatic PropertiesasProperties(Reader in) static Properties
-
Constructor Details
-
XMLResourceBundleParser
public XMLResourceBundleParser()
-
-
Method Details
-
asProperties
public static Properties asProperties(InputStream in) throws IOException, SAXException, ParserConfigurationException, IllegalArgumentException - Throws:
IOExceptionSAXExceptionParserConfigurationExceptionIllegalArgumentException- See Also:
-
asProperties
public static Properties asProperties(Reader in) throws IOException, SAXException, ParserConfigurationException, IllegalArgumentException - Throws:
IOExceptionSAXExceptionParserConfigurationExceptionIllegalArgumentException- See Also:
-
asProperties
public static Properties asProperties(InputSource in) throws IOException, SAXException, ParserConfigurationException, IllegalArgumentException - Throws:
IOExceptionSAXExceptionParserConfigurationExceptionIllegalArgumentException- See Also:
-
asMap
public static Map<String,String> asMap(InputStream in) throws IOException, SAXException, ParserConfigurationException, IllegalArgumentException - Throws:
IOExceptionSAXExceptionParserConfigurationExceptionIllegalArgumentException- See Also:
-
asMap
public static Map<String,String> asMap(Reader in) throws IOException, SAXException, ParserConfigurationException, IllegalArgumentException - Throws:
IOExceptionSAXExceptionParserConfigurationExceptionIllegalArgumentException- See Also:
-
asMap
public static Map<String,String> asMap(InputSource in) throws IOException, SAXException, ParserConfigurationException, IllegalArgumentException Load an xml resource bundle as aMap<String,String>object.- Parameters:
in- the input source- Returns:
- the properties object
- Throws:
IOException- any IOExceptionSAXException- any SAXExceptionParserConfigurationException- any ParserConfigurationExceptionIllegalArgumentException- if the argument is null
-