Failing to get element values using Element.getAttribute()

后端 未结 4 513
北恋
北恋 2021-01-14 05:14

I would like to read an xml file. I\' ve found an example which is good until the xml element doesn\'t have any attributes. Of course i\'ve tried to look after how could I r

4条回答
  •  无人共我
    2021-01-14 05:44

    If you have a schema for the file, or can make one, you can use XMLBeans. It makes Java beans out of the XML, as the name implies. Then you can just use getters to get the attributes.

提交回复
热议问题