Class JaxbXmlConverter
- java.lang.Object
-
- org.opennms.features.config.dao.impl.util.JaxbXmlConverter
-
- All Implemented Interfaces:
ConfigConverter
public class JaxbXmlConverter extends Object implements ConfigConverter
It handles xml <> json conventions base on xsd.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getRootElement()
XmlSchema
getXmlSchema()
org.json.JSONObject
removeEmptyValueTag(org.json.JSONObject json)
Remove empty XmlValue tagString
xmlToJson(String sourceXml)
Convert xml to json.
-
-
-
Field Detail
-
VALUE_TAG
public static final String VALUE_TAG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JaxbXmlConverter
public JaxbXmlConverter(String xsdName, String rootElement, Map<String,String> elementNameToValueNameMap) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getRootElement
public String getRootElement()
-
xmlToJson
public String xmlToJson(String sourceXml)
Convert xml to json. If elementNameToValueNameMap is not null, it will setup XmlValue attribute name properly- Specified by:
xmlToJson
in interfaceConfigConverter
- Parameters:
sourceXml
-- Returns:
- json string
-
removeEmptyValueTag
public org.json.JSONObject removeEmptyValueTag(org.json.JSONObject json)
Remove empty XmlValue tag- Parameters:
json
-- Returns:
- json without empty value tag
-
getXmlSchema
public XmlSchema getXmlSchema()
-
-