← Prev in month
← Prev in thread
dom and jsp interacation
Hello Techies,
I am having one jsp thru which I am getting tag's of the xml file. I want to get the values of these tags when perticular tag is required.
Here is sample xml file
<Date>
<Today>
<Today_Id>12345</Today_Id>
<Today_Name>TODAY</Today_Name>
<Today_Data_Type>date</Today_Data_Type>
</Today>
<EndOfWeek>
<EndOfWeek_Id>6789</EndOfWeek_Id>
<EndOfWeek_Name>ENDOFWEEK</EndOfWeek_Name>
<EndOfWeek_Data_Type>date</EndOfWeek_Data_Type>
</EndOfWeek>
</Date>
lets us suppose that from jsp I got "Today" as request. Now I created the instance and parsing the xml file.
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document document = parser.parse(xmlFileName);
Element documentElement = document.getDocumentElement();
NodeList nl = documentElement
.getElementsByTagName("Today");
ArrayList mapp = iteratingEachNodeChildValueList(nl);
For the next request is EndOfWeek. Here the question arises
"does i need to create the instance of parser and read the file for each request??"
Here's a new way to find what you're looking for - Yahoo! Answers
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW
I am having one jsp thru which I am getting tag's of the xml file. I want to get the values of these tags when perticular tag is required.
Here is sample xml file
<Date>
<Today>
<Today_Id>12345</Today_Id>
<Today_Name>TODAY</Today_Name>
<Today_Data_Type>date</Today_Data_Type>
</Today>
<EndOfWeek>
<EndOfWeek_Id>6789</EndOfWeek_Id>
<EndOfWeek_Name>ENDOFWEEK</EndOfWeek_Name>
<EndOfWeek_Data_Type>date</EndOfWeek_Data_Type>
</EndOfWeek>
</Date>
lets us suppose that from jsp I got "Today" as request. Now I created the instance and parsing the xml file.
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document document = parser.parse(xmlFileName);
Element documentElement = document.getDocumentElement();
NodeList nl = documentElement
.getElementsByTagName("Today");
ArrayList mapp = iteratingEachNodeChildValueList(nl);
For the next request is EndOfWeek. Here the question arises
"does i need to create the instance of parser and read the file for each request??"
regards,
ramu
Here's a new way to find what you're looking for - Yahoo! Answers
Send FREE SMS to your friend's mobile from Yahoo! Messenger Version 8. Get it NOW
← Prev in month
← Prev in thread