当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Configuration API unable to access xml files

问题描述:

I created a xml files named Config.xml. Below is the content:

<?xml version="1.0"?>

<configuration>

<property>

<name>

color

</name>

<value>

yellow

</value>

<description>

Color

</description>

</property>

</configuration>

I tried to access this xml file using the below code:

 Configuration conf = new Configuration();

conf.addResource("/Users/XXX/Documents/Config.xml");

System.out.println(conf.get("color"));

null is getting printed in the console. Please advice.

分享给朋友:
您可能感兴趣的文章:
随机阅读: