I want to store a list of key-value pairs as values to specific key in a properties xml file.
Consider following example:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> <properties> <entry key="led.color"> <color key="r">0</color> <color key="g">100</color> <color key="b">0</color> </entry> </properties>
My initial approach was to retrieve the value of led.color
as String and convert it to a Map. But the retrival failed with following exception:
Caused by: org.xml.sax.SAXParseException; lineNumber: 22; columnNumber: 20; Element type "color" must be declared.
This happens because color is not declared in the DTD and hence, the validation fails.
Is there any build-in way to handle such task or a way to avoid the vaildation of this specific value?
No comments:
Post a Comment