I have xml String content which is passed as part of request body in rest API,
<?xml version="1.0" encoding="UTF-8"?>
<sdp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="repository://schemas/sdp-config.xsd">
<helpPage>/mstinc/sdp/help/index.html</helpPage>
<ib>
<siteUrl>/onlineserv/HB/</siteUrl>
<startUpPage>
<sdpUrl>SECONDARY~PRIMARY_BUTTON_ACCOUNT_ACCESS.NAME~ACCOUNT_ACCESS_SECONDARY_BUTTON_SDP.NAME</sdpUrl>
<otherUrl>SECONDARY~PRIMARY_BUTTON_ACCOUNT_ACCESS.NAME~ACCOUNT_ACCESS_SECONDARY_BUTTON_ACCOUNT_SUMMARY.NAME</otherUrl>
<axisConfValue>true</axisConfValue>
</startUpPage>
</ib>
I would like to build HierarchicalConfiguration object so that i can iterate through keys using,
Iterator keys = {hierachicalObject}.getKeys();
I don't want to create a file as the content is passed dynamically for each request. How can i do it?
I think you can get information from the tag in String and work with this string.
For example :
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document doc = documentBuilder.parse(xmlFile);
doc.getDocumentElement().normalize();
String keys = doc.getElementsByTagName("sdpUrl").item(0).getTextContent();
And after that working with keys. But there used file. There you can read how to get data from String XML : Read a XML (from a string) and get some fields - Problems reading XML