on 03-14-2011 4:52 AM
Hi all,
i have an xml data which contains the fields as 1.user type, 2. client, 3.vendor number
in webdynpro java how i validate or fetch the details of the user type, when ever user login's in portal i can show some data to user 'A' and invisible to user 'B', based on the xml data.
help me in doing step by step'
Thanks&Regards
charan
Hi
Follow the steps .
This is the XML file .
<?xml version="1.0"?>
<company>
<employee>
<firstname>Tom</firstname>
<lastname>Cruise</lastname>
</employee>
<employee>
<firstname>Paul</firstname>
<lastname>Enderson</lastname>
</employee>
<employee>
<firstname>George</firstname>
<lastname>Bush</lastname>
</employee>
</company>
Java Code of this to fetch the details.
public class XMLReader {
public static void main(String argv[]) {
try {
File file = new File("c:\\MyXMLFile.xml");
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(file);
doc.getDocumentElement().normalize();
System.out.println("Root element " + doc.getDocumentElement().getNodeName());
NodeList nodeLst = doc.getElementsByTagName("employee");
System.out.println("Information of all employees");
for (int s = 0; s < nodeLst.getLength(); s++) {
Node fstNode = nodeLst.item(s);
if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
Element fstElmnt = (Element) fstNode;
NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("firstname");
Element fstNmElmnt = (Element) fstNmElmntLst.item(0);
NodeList fstNm = fstNmElmnt.getChildNodes();
System.out.println("First Name : " + ((Node) fstNm.item(0)).getNodeValue());
NodeList lstNmElmntLst = fstElmnt.getElementsByTagName("lastname");
Element lstNmElmnt = (Element) lstNmElmntLst.item(0);
NodeList lstNm = lstNmElmnt.getChildNodes();
System.out.println("Last Name : " + ((Node) lstNm.item(0)).getNodeValue());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
BR
Satish Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi satish,
Thanks for your quick reply and valuable answer
i have 2 xml files as below:
1) xml file for client combination:
- <Combination>
<eccClient>100</eccClient>
<apoClient>120</apoClient>
<eccClientJCo>ecc.name.100</eccClientJCo>
<apoClientJCo>apo.name.120</apoClientJCo>
</Combination>
- <Combination>
<eccClient>101</eccClient>
<apoClient>120</apoClient>
<eccClientJCo>ec2.arm.jco.name</eccClientJCo>
<apoClientJCo>apo11.arm.jco.name</apoClientJCo>
</Combination>
- <Combination>
<eccClient>101</eccClient>
<apoClient>122</apoClient>
<eccClientJCo>ec2.arm.jco.name</eccClientJCo>
<apoClientJCo>apo10.arm.jco.name</apoClientJCo>
</Combination>
- <Combination>
<eccClient>102</eccClient>
<apoClient>121</apoClient>
<eccClientJCo>ec3.arm.jco.name</eccClientJCo>
<apoClientJCo>apo13.arm.jco.name</apoClientJCo>
</Combination>
.................
2)clients data by user:
................................
.........................
.................................
user id,user type, region,ecc client and apo client and reference number
as same as above xml.
with the help of reference number in xml 2. i need to pass the reference number in xml 1. so that trigger a perticular rfc
java code:
just i need to check when the user logins in portal wheather he belongs to usertype "A" or user type "B".
based on the user type i need to trigger the perticular rfc.
for this where i need to write the code in Component controller or view controller,
help me in doing this step by step
Thanks&Regards
charan
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.