I am new to Java and XML. I am trying to figure out how to read in this XML file and use the elements to determine certain conditions. I will paste my XML file below. In my application, I am going to ask the user to enter a username, password and filename. I want to say in my Java code:
if filename = (file name user entered) and user is (username user entered)
print “Access allowed
else
print “Access denied”
As you can see, the XML file will contain the roles and the usernames associated with those roles. I know how to write the Java code for everything else except reading in the XML file. Can someone give me some help on how to get that going?
Code:<?xml version="1.0"?> <security> <role> <title>Admin</title> <name>Kim</name> </role> <role> <title>HR</title> <name>Joyce</name> </role> <role> <title>Accting</title> <name>Michael</name> </role> <role> <title>Manager</title> <name>John</name> </role> </security>


Reply With Quote


Bookmarks