ir.thinkinsql
Class XmlMapper
java.lang.Object
ir.thinkinsql.XmlMapper
public class XmlMapper
- extends java.lang.Object
Used to externalize SQL statements. XmlMapper reads xml text node values into a Map
such that the keys will be built as dot-delimited paths not including
the top level node name, such as secondLevelNode.thirdLevelNode...
For example:
<?xml version="1.0" encoding="UTF-8"?>
<sqlbase>
<Chickens>
<CountAll>
select count(*) from tHatchery
</CountAll>
<CountForBarn><![CDATA[
select count(*) from tHatchery where barn=?
]]></CountForBarn>
</Chickens>
</sqlbase>
..would result in the following key-value pairs:
- Chickens.CountAll = select count(*) from tHatchery
- Chickens.CountForBarn = select count(*) from tHatchery where barn=?
One assumption of this class is that any full path will be
unique. If the input xml file has any duplicate paths, only
the last one for a given key will be in the generated map.
|
Method Summary |
static java.util.Map<java.lang.String,java.lang.String> |
getMap(java.net.URL xmlResourceURL)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XmlMapper
public XmlMapper()
getMap
public static java.util.Map<java.lang.String,java.lang.String> getMap(java.net.URL xmlResourceURL)
throws java.lang.Exception
- Throws:
java.lang.Exception