首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > XML SOAP >

cacheConfig.xml中读取配置文件信息32010-07-07

2012-10-16 
cacheConfig.xml中读取配置文件信息三2010-07-07/** 解析默认Keyspace.*/private String readDefaultKeysp

cacheConfig.xml中读取配置文件信息三2010-07-07



    /** 解析默认Keyspace.
     */
    private String readDefaultKeyspace(XPath aXpath, Document aDoc)
        throws XPathExpressionException
    {
        XPathExpression pathExpression = aXpath.compile("//defaultKeyspace");
        Node node = (Node) pathExpression.evaluate(aDoc, XPathConstants.NODE);
        return node.getTextContent();
    }

    /** 解析默认ColumnFamily
     * @param aDoc 文档对象
     * @return String 默认ColumnFamily
     */
    private String readDefaultColumnFamily(XPath aXpath, Document aDoc)
        throws XPathExpressionException
    {
        XPathExpression pathExpression =
            aXpath.compile("//defaultColumnFamily");
        Node node = (Node) pathExpression.evaluate(aDoc, XPathConstants.NODE);
        return node.getTextContent();
    }

    /** 解析DataBindings.
     * @param aDoc 文档对象
     */
    private Map<String, String> readDataBindingMap(XPath aXpath, Document aDoc)
        throws XPathExpressionException
    {
        Map<String, String> dataBindingMap = new HashMap<String, String>();
        XPathExpression pathExpression =
            aXpath.compile("//dataBindings/property");
        NodeList nodeList = (NodeList) pathExpression.evaluate(aDoc,
                XPathConstants.NODESET);
        String name = null;
        String value = null;
        for (int i = 0; i < nodeList.getLength(); i++)
        {
            name = nodeList.item(i)
                    .getAttributes()
                    .getNamedItem("name")
                    .getNodeValue();
            value = nodeList.item(i)
                    .getAttributes()
                    .getNamedItem("value")
                    .getNodeValue();
            dataBindingMap.put(name, value);
        }
        return dataBindingMap;
    }
}

热点排行