Skip to content

Instantly share code, notes, and snippets.

@daneshk
Created August 28, 2017 15:47
Show Gist options
  • Save daneshk/e8136a95bec50e77c46d6f5bfc772580 to your computer and use it in GitHub Desktop.
Save daneshk/e8136a95bec50e77c46d6f5bfc772580 to your computer and use it in GitHub Desktop.
String resourcePath = "/esb/abc.xml";
boolean resourceExists = configRegistry.resourceExists(resourcePath);
if (resourceExists) {
Resource registryResource = configRegistry.get(resourcePath);
try {
OMElement contentElement = AXIOMUtil.stringToOM(
new String((byte[]) registryResource.getContent()));
contentElement.addChild(garElement); //edit content
registryResource.setContent(contentElement.toString());
configRegistry.put(resourcePath, registryResource);
} catch (XMLStreamException e) {
log.warn("Error occurred while retrieving the content of registry resource", e);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment