CODEFETCH™
            Examples
Searched for 2 expression(s): parse   xml  
Source code below from:
Jakarta Struts Cookbook
By Bill Siggelkow
Published 23 February, 2005
Average rating

      Powells     Alibris

jakartastrutsckbk-code/ch10/src/com/oreilly/strutsckbk/ch10/DigestedList.java (39 lines)
5  
6 import org.apache.commons.digester.Digester; 
7 import org.apache.commons.digester.xmlrules.DigesterLoader;
8 import org.apache.commons.logging.Log; 
9 import org.apache.commons.logging.LogFactory; 
10  
11 public class DigestedList extends RefreshableList { 
12  
13     private static Log log = LogFactory.getLog(DigestedList.class); 
14  
15     public DigestedList(List list, URL sourceUrl, URL rulesUrl) { 
16         this.sourceUrl = sourceUrl; 
17         this.rulesUrl = rulesUrl; 
18         this.backingList = list; 
19     } 
20  
21     public synchronized void refresh() throws CacheException { 
22         Digester digester = DigesterLoader.createDigester(rulesUrl); 
23         try { 
24             List list = (List) digester.parse(sourceUrl.openStream());
25             if (list != null)  
26                 backingList = list; 

jakartastrutsckbk-code/ch01/r7/src/org/apache/struts/webapp/example/memory/MemoryUserDatabase.java (457 lines)
80 import org.apache.struts.webapp.example.UserDatabase; 
81 import org.xml.sax.Attributes;
82  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
85 * <p>Concrete implementation of {@link UserDatabase} for an in-memory 86 * database backed by an XML data file.</p> 87 *
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
239 240 // Parse the input stream to initialize our database 241 digester.parse(bis); 242 bis.close();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
312 // Print the file prolog 313 writer.println("<?xml version='1.0'?>"); 314 writer.println("<database>");

jakartastrutsckbk-code/ch02/r1/src/org/apache/struts/webapp/example/memory/MemoryUserDatabase.java (457 lines)
80 import org.apache.struts.webapp.example.UserDatabase; 
81 import org.xml.sax.Attributes;
82  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
85 * <p>Concrete implementation of {@link UserDatabase} for an in-memory 86 * database backed by an XML data file.</p> 87 *
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
239 240 // Parse the input stream to initialize our database 241 digester.parse(bis); 242 bis.close();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
312 // Print the file prolog 313 writer.println("<?xml version='1.0'?>"); 314 writer.println("<database>");

jakartastrutsckbk-code/ch03/src/org/apache/struts/webapp/example/memory/MemoryUserDatabase.java (457 lines)
80 import org.apache.struts.webapp.example.UserDatabase; 
81 import org.xml.sax.Attributes;
82  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
85 * <p>Concrete implementation of {@link UserDatabase} for an in-memory 86 * database backed by an XML data file.</p> 87 *
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
239 240 // Parse the input stream to initialize our database 241 digester.parse(bis); 242 bis.close();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
312 // Print the file prolog 313 writer.println("<?xml version='1.0'?>"); 314 writer.println("<database>");

jakartastrutsckbk-code/ch10-spring/src/org/apache/struts/webapp/example/memory/MemoryUserDatabase.java (375 lines)
39 import org.apache.struts.webapp.example.ExpiredPasswordException; 
40 import org.xml.sax.Attributes;
41  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
44 * <p>Concrete implementation of {@link UserDatabase} for an in-memory 45 * database backed by an XML data file.</p> 46 *
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
174 175 // Parse the input stream to initialize our database 176 digester.parse(bis); 177 bis.close();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
236 // Print the file prolog 237 writer.println("<?xml version='1.0'?>"); 238 writer.println("<database>");
Source code below from:
Jakarta Commons Cookbook
By Timothy O'Brien
Published 16 November, 2004
Average rating

      Powells     Alibris

src/java/com/discursive/jccook/xml/bardsearch/PlayIndexer.java (93 lines)
19  */ 
20 package com.discursive.jccook.xml.bardsearch;
21  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
56 context = new DigestContext(); 57 digester.push( context ); 58 digester.parse( playXml ); 59 logger.info( "Parsed: " + playXml.getAbsolutePath() ); 60 } 61
Additional matches viewable in cache of src/java/com/discursive/jccook/xml/bardsearch/PlayIndexer.java.
src/java/com/discursive/jccook/xml/bean/NamespaceDigest.java (87 lines)
19  */ 
20 package com.discursive.jccook.xml.bean;
21  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46 digester.push(pages); 47 48 InputStream input = getClass().getResourceAsStream("./content.xml"); 49 digester.parse(input); 50 51 Page page = (Page) pages.getPages().get(0);
Additional matches viewable in cache of src/java/com/discursive/jccook/xml/bean/NamespaceDigest.java.
src/java/com/discursive/jccook/xml/bean/ProgrammaticDigesterExample.java (70 lines)
19  */ 
20 package com.discursive.jccook.xml.bean;
21  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
63 digester.push(plays); 64 65 InputStream input = getClass().getResourceAsStream("./plays.xml"); 66 digester.parse( input ); 67 68 System.out.println("Number of plays: " + plays.size());
Additional matches viewable in cache of src/java/com/discursive/jccook/xml/bean/ProgrammaticDigesterExample.java.
src/java/com/discursive/jccook/xml/bean/XMLNamespaceDigest.java (59 lines)
19  */ 
20 package com.discursive.jccook.xml.bean;
21  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
50 digester.push(pages); 51 52 InputStream input = getClass().getResourceAsStream("./content.xml"); 53 digester.parse(input); 54 55 Page page = (Page) pages.getPages().get(0);
Additional matches viewable in cache of src/java/com/discursive/jccook/xml/bean/XMLNamespaceDigest.java.
src/java/com/discursive/jccook/xml/bean/BetwixtExample.java (90 lines)
19  */ 
20 package com.discursive.jccook.xml.bean;
21  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
51 52 InputStream input = getClass().getResourceAsStream("./plays.xml"); 53 URL rules = getClass().getResource("./play-rules.xml"); 54 Digester digester = DigesterLoader.createDigester(rules); 55 digester.push(plays); 56 Object root = digester.parse(input); 57 58 logger.debug("Number of plays: " + plays.size());
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72 73 InputStream input = getClass().getResourceAsStream("./plays.xml"); 74 URL rules = getClass().getResource("./play-rules.xml"); 75 Digester digester = DigesterLoader.createDigester(rules); 76 digester.push(plays); 77 Object root = digester.parse(input); 78 79 logger.debug("Number of plays: " + plays.size());
Additional matches viewable in cache of src/java/com/discursive/jccook/xml/bean/BetwixtExample.java.
Source code below from:
Programming Jakarta Struts, 2nd Edition
By Chuck Cavaness
Published 21 June, 2004
Average rating

      Powells     Alibris

storefront-source/com/oreilly/struts/storefront/service/memory/StorefrontMemoryDatabase.java (280 lines)
13 import org.apache.commons.logging.LogFactory; 
14 import org.xml.sax.Attributes;
15  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
173 174 // Parse the input stream to initialize our database 175 digester.parse(bis); 176 bis.close();

storefront-source/org/apache/struts/webapp/example/memory/MemoryUserDatabase.java (457 lines)
80 import org.apache.struts.webapp.example.UserDatabase; 
81 import org.xml.sax.Attributes;
82  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
85 * <p>Concrete implementation of {@link UserDatabase} for an in-memory 86 * database backed by an XML data file.</p> 87 *
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
239 240 // Parse the input stream to initialize our database 241 digester.parse(bis); 242 bis.close();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
312 // Print the file prolog 313 writer.println("<?xml version='1.0'?>"); 314 writer.println("<database>");
Source code below from:
JavaServer Faces
By Hans Bergsten
Published 30 April, 2004
Average rating

      Powells     Alibris

src/src/com/mycompany/jsf/pl/XMLViewHandler.java (409 lines)
23  
24 import org.xml.sax.Attributes;
25 import org.xml.sax.SAXException;
26 import org.xml.sax.SAXParseException;
27 import org.xml.sax.helpers.DefaultHandler;
28 import javax.xml.parsers.SAXParserFactory;
29 import javax.xml.parsers.ParserConfigurationException;
30 import javax.xml.parsers.SAXParser;
31  
32 /** 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
43 * previously registered ViewHandler. 44 */ 45 public XMLViewHandler(ViewHandler origViewHandler) { 46 super(origViewHandler); 47 } 48 49 /** 50 * Returns the UIViewRoot for the specified view, by parsing 51 * the view specification file and processing the elements in 52 * the specification with an instance of the ViewSpecHandler 53 * class. 54 */ 55 protected UIViewRoot createViewRoot(FacesContext context, String viewId) { 56 57 SAXParserFactory factory = SAXParserFactory.newInstance(); 58 SAXParser saxParser = null; 59 try {
Additional matches viewable in cache of src/src/com/mycompany/jsf/pl/XMLViewHandler.java.
Source code below from:
JavaServer Pages, 3rd Edition
By Hans Bergsten
Published 01 December, 2003
Average rating

      Powells     Alibris

ora/ch15/news.jsp (93 lines)
2 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
3 <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
4  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
12 <c:import url="http://meerkat.oreillynet.com/?&p=4999&_fl=xml&t=ALL" 13 varReader="xmlSource"> 14 <x:parse var="doc" xml="${xmlSource}" scope="application" /> 15 </c:import> 16 <c:set var="cacheTime" value="${now.time}" scope="application" />
Additional matches viewable in cache of ora/ch15/news.jsp.
ora/ch14/process_nw.jsp (22 lines)
14  
15     Text string converted to a Java Unicode string: 
16     ${fn:escapeXml(param.text)}
17     <p> 
18     Date string converted to the internal Java Date type: 
19     <fmt:parseDate value="${param.date}" dateStyle="full" />
20  
21   </body> 

src/src/com/ora/jsp/servlets/ResourceManagerListener2.java (55 lines)
22  
23         /* 
24          * Get the JDBC URL, user, password and limit from the web.xml
25          * context init parameters 
26          */ 
27         String jdbcURL = application.getInitParameter("jdbcURL"); 
28         String user = application.getInitParameter("user"); 
29         String password = application.getInitParameter("password"); 
30         String maxLimit = application.getInitParameter("maxLimit"); 
31  
32         try { 
33             ds = new OracleConnectionCacheImpl(); 
34             ds.setURL(jdbcURL); 
35             ds.setMaxLimit(Integer.parseInt(maxLimit));
36             ds.setUser("scott"); 
37             ds.setPassword("tiger"); 
Source code below from:
Java Servlet & JSP Cookbook
By Bruce Perry
Published 01 December, 2003
Average rating

      Powells     Alibris

jspcookbook/chap23/xmlCore.jsp (31 lines)
1 <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
2 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8 <c:import url="http://localhost:8080/home/web.xml" var="webXml" /> 9 10 <x:parse xml="${webXml}" var="doc" /> 11 12 <h3>First the context params...</h3>
Additional matches viewable in cache of jspcookbook/chap23/xmlCore.jsp.
jspcookbook/chap5/com/jspservletcookbook/ValidateHandler.java (52 lines)
2  
3 import org.xml.sax.Attributes;
4 import org.xml.sax.SAXParseException;
5 import org.xml.sax.SAXException;
6 import org.xml.sax.helpers.DefaultHandler;
7 import javax.xml.parsers.SAXParserFactory;
8 import javax.xml.parsers.FactoryConfigurationError;
9 import javax.xml.parsers.ParserConfigurationException;
10 import javax.xml.parsers.SAXParser;
11  
12 import java.io.IOException; 
Additional matches viewable in cache of jspcookbook/chap5/com/jspservletcookbook/ValidateHandler.java.
Source code below from:
Art of Java Web Development: Struts, Tapestry, Commons, Velocity, JUnit, Axis, Cocoon, InternetBeans, WebWork
By Neal Ford
Published 01 November, 2003
Average rating

      Powells     Alibris

art_emotherearth_logging/src/com/nealford/art/logging/emotherearth/controller/Welcome.java (76 lines)
21         Handler outputHandler = null; 
22         try { 
23             outputHandler = new FileHandler("/temp/basic_log.xml");
24         } catch (Exception x) { 
25             logger.severe("Can't create handler: "+ x.getMessage()); 
26         } 
27         if (outputHandler != null) 
28             logger.addHandler(outputHandler); 
29         String logLevel = getServletContext(). 
30                           getInitParameter("logLevel"); 
31         if (logLevel != null) 
32             logger.setLevel(Level.parse(logLevel.toUpperCase()));
33         else 
34             logger.setLevel(Level.SEVERE); 

art_emotherearth_ws_client/src/com/nealford/art/emotherearth/ws/client/MainFrame.java (115 lines)
90             ws = new localhost.emotherearth.services.OrderStatus.OrderInfoServiceLocator(). 
91                       getOrderStatus(); 
92         } catch (javax.xml.rpc.ServiceException jre) {
93             if (jre.getLinkedCause() != null) { 
94                 jre.getLinkedCause().printStackTrace(); 
95             } 
96             throw new RuntimeException( 
97                     "JAX-RPC ServiceException caught: " + jre); 
98         } 
99  
100         try { 
101             int orderNo = 
102                     Integer.parseInt(jTextField1.getText());
103             ws.getShippingStatus(orderNo); 
104             lblOrderStatus.setText(ws.getOrderStatus(orderNo)); 
Source code below from:
JSTL : Practical Guide for JSP Programmers (The Practical Guides)
By Sue Spielman
Published 22 August, 2003
Average rating

      Powells     Alibris

jstlsample/web/xparse.jsp (12 lines)
1 <%@ include file="/globals.jsp" %> 
2 <b>Parsing XML provided in the body content of x:parse</b>
3 <br> 
4 <x:parse var="doc">
Additional matches viewable in cache of jstlsample/web/xparse.jsp.
jstlsample/web/xparseimport.jsp (7 lines)
1 <%@ include file="/globals.jsp" %> 
2 <b>Parsing XML provided from an imported variable</b>
3 <br> 
4 <c:import var="xmlfile" url="/people.xml" />
5 <x:parse var="doc" xml="${xmlfile}" />
6 Hello <x:out select="$doc/person/firstname" /> 
7  

jstlsample/web/cimportvar.jsp (15 lines)
5 </c:import> 
6 <c:out value="${commonHeader}" escapeXml="false" />
7  
8 <c:import url="/authors.xml" varReader="reader">
9   <x:parse xml="${reader}" var="doc"/>
10 </c:import> 
11 The author's name is: <x:out select="$doc/authors/author/name"/> 

jstlsample/web/jstlbook.jsp (400 lines)
41 - uses configuration settings 
42 from the web.xml to set the datasource. </p>
43 <p><a href="cleandatabase.jsp">cleandatabase.jsp</a> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
197 />view source</a>) 198 - &lt;c:url&gt; with a scoped variable</p> 199 <h2>Chapter 5 - Working with the XML tag library</h2> 200 <p><a href="xparse.jsp">xparse.jsp</a> 201 (<a href= 202 "<c:url value="/source.jsp">
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
205 </c:url>" 206 />view source</a>) 207 - <x:parse> using XML in body content</p> 208 <p><a href="xparseimport.jsp">xparseimport.jsp</a> 209 (<a href=
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
213 </c:url>" 214 />view source</a>) 215 - <x:parse> with an imported XML file</p> 216 <p><a href="xsetout.jsp">xsetout.jsp</a> 217 (<a href=
Additional matches viewable in cache of jstlsample/web/jstlbook.jsp.
jstlsample/web/xconditionals.jsp (38 lines)
4 <title> 
5 <c:out value="Conditional XML Samples" escapeXml="false"/>
6 </title> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13 14 <c:import var="xmlfile" url="/catalog.xml" /> 15 <x:parse var="doc" xml="${xmlfile}" /> 16 17
Additional matches viewable in cache of jstlsample/web/xconditionals.jsp.
Source code below from:
Beginning Jsp 2.0: Build Web Applications Using Jsp, Java, and Struts
By Ben Galbraith, Peter den Haan, Lance Lavandowska, Sathya Narayana Panduranga, Krishnaraj Perrumal, and Erick Sgarbi
Published February, 2003
Average rating

      Powells     Alibris

Wrox Beginning JSP Code/Chapter 14/XML/parseXML.jsp (35 lines)
4   <head> 
5     <title>JSTL XML Support -- Parsing</title>
6   </head> 
7   <body bgcolor="#FFFFFF"> 
8     <h3>Parsing an XML Document using XML tags</h3>
9      
10     <x:parse>
11       <BOOK> 
12        <AUTHOR> 
Additional matches viewable in cache of Wrox Beginning JSP Code/Chapter 14/XML/parseXML.jsp.
Wrox Beginning JSP Code/Chapter 14/XML/iterate.jsp (42 lines)
5   <head> 
6     <title>JSTL XML Support -- Flow Control</title>
7   </head> 
8   <body bgcolor="#FFFFFF"> 
9     <h3>Iterating through an XML document</h3>
10      
11     <x:parse>
12      <items> 
13       <item> 
Additional matches viewable in cache of Wrox Beginning JSP Code/Chapter 14/XML/iterate.jsp.
Source code below from:
JSTL: JSP Standard Tag Library Kick Start
By Jeff Heaton
Published 19 September, 2002
Average rating

      Powells     Alibris

webapps/ROOT/example/ch8/core/parse.jsp (102 lines)
1 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> 
2 <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
3 <html> 
4   <head> 
5     <title>Parse Examples</title>
6   </head> 
7  
8   <body>Please enter an XML file:
9   <br /> 
10  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
69 <c:if test="${pageContext.request.method=='POST'}"> 70 71 <x:parse var="doc" xml="${param.xml}" /> 72 73 <table border="1">
Additional matches viewable in cache of webapps/ROOT/example/ch8/core/parse.jsp.
webapps/ROOT/example/ch8/core/out.jsp (41 lines)
1 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
2 <html> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8 <c:import var="students" url="students.xml" /> 9 10 <x:parse var="doc" xml="${students}" /> 11 12 <table border="1">

webapps/ROOT/example/ch8/core/set.jsp (47 lines)
1 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> 
2 <%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
3 <html> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9 <c:import var="students" url="students.xml" /> 10 11 <x:parse var="doc" xml="${students}" /> 12 13 <x:set var="a" select="$doc/students/student/name/first" />

webapps/ROOT/example/ch8/flow/choose.jsp (65 lines)
1 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
2 <html> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8 <c:import var="students" url="students.xml" /> 9 10 <x:parse var="doc" xml="${students}" /> 11 12 <table border="1">

webapps/ROOT/example/ch8/flow/foreach.jsp (45 lines)
1 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %><%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
2 <html> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8 <c:import var="students" url="students.xml" /> 9 10 <x:parse var="doc" xml="${students}" /> 11 12 <table border="1">
Source code below from:
JSTL in Action
By Shawn Bayern
Published July, 2002
Average rating

      Powells     Alibris

chapter08/rss.jsp (16 lines)
1 <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> 
2 <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
3  
4 <c:import var="xml" url="${param.rssUrl}"/> 
5 <x:parse var="rss" xml="${xml}" />
6  
7 <ul> 

chapter08/rssFollow.jsp (20 lines)
1 <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> 
2 <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
3  
4 <c:import var="xml" url="${param.rssUrl}"/>
5 <x:parse var="rss" xml="${xml}" />
6  
7 <ul> 

chapter08/simpleRss.jsp (16 lines)
1 <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> 
2 <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
3  
4 <c:import var="xml" url="${param.rssUrl}" />
5 <x:parse var="rss" xml="${xml}" />
6  
7 <ul> 

chapter13/rss.jsp (16 lines)
1 <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> 
2 <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
3  
4 <c:import var="xml" url="${param.rssUrl}" />
5 <x:parse var="rss" xml="${xml}" />
6  
7 <ul> 
Source code below from:
JSP(TM) and XML: Integrating XML and Web Services in Your JSP Application
By Casey Kochmer and Erica Frandsen
Published 19 March, 2002
Average rating

      Powells     Alibris

WEB-INF/classes/ProcessXML.java (108 lines)
2 import javax.servlet.*; 
3 import javax.servlet.http.*; 
4 import javax.xml.parsers.*;
5 import javax.xml.transform.*;
6 import javax.xml.transform.stream.*;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
26 // See if we have the data stashed already in app space. 27 String xslpath = (String)application.getAttribute(xmlpath); 28 String errorpage= "/chapter10/XMLError.jsp"; 29 30 /* The data stored in xslpath is null, equals "false" or equals a file 31 name. If it equals a file name, then assign it to xslpath. If null, then 32 the check never has happened yet. So check to see if a XSL file exists*/ 33 if (xslpath == null) 34 { try 35 {String saxparser = "org.apache.xerces.parsers.SAXParser"; 36 XMLReader reader = XMLReaderFactory.createXMLReader(saxparser); 37 reader.setFeature("http://xml.org/sax/features/validation", false); 38
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
46 application.setAttribute(xmlpath,"false"); 47 48 //parse the XML document 49 try {reader.parse(xmlpath);} 50 catch(StopSaxParsing ssp) 51 {/*The XSL stylesheet is only found when we throw StopSaxParsing.
Additional matches viewable in cache of WEB-INF/classes/ProcessXML.java.
WEB-INF/classes/xmlbook/chapter10/DetermineStyleSheet.java (23 lines)
1 package xmlbook.chapter10;
2  
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5 import org.xml.sax.*; 6 import org.xml.sax.helpers.DefaultHandler; 7 import org.xml.sax.SAXParseException; 8 9 public class DetermineStyleSheet extends DefaultHandler
Additional matches viewable in cache of WEB-INF/classes/xmlbook/chapter10/DetermineStyleSheet.java.
chapter6/XMLTable.jsp (39 lines)
1 <%@ page 
2   import="org.xml.sax.helpers.*,
3   org.xml.sax.*,
4   javax.xml.parsers.*,
5   xmlbook.chapter6.*"
6 %> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
13 try{ 14 XMLReader reader = XMLReaderFactory.createXMLReader 15 ("org.apache.xerces.parsers.SAXParser"); 16 reader.setFeature("http://xml.org/sax/features/validation", true); 17 18 //create instance of handler class we wrote
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27 String ls_xml = application.getRealPath(ls_path + "Books.xml"); 28 29 //parse the XML document 30 reader.parse(ls_xml); 31 } 32 catch (Exception e){
Additional matches viewable in cache of chapter6/XMLTable.jsp.
chapter13/ClientScript.jsp (171 lines)
3         org.jdom.output.*, 
4         javax.xml.transform.*,
5         xmlbook.chapter11.*" %>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29 var domParser = new DOMParser(); 30 var strXML = document.getElementById('xmlData').innerHTML; 31 xmlDoc = domParser.parseFromString(strXML, 'text/xml'); 32 status(); 33 }
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
38 xmlDoc.loadXML(xmlData.innerHTML); 39 40 if (xmlDoc.parseError.errorCode != 0) 41 alert("Parse Error!"); 42 } 43 } 44 45 function status(){ 46 if (ns){ 47 createTable(); 48 } 49 else if (ie){ 50 if (xmlDoc.readyState == 4){ 51 createTable(); 52 }
Additional matches viewable in cache of chapter13/ClientScript.jsp.
chapter4/BannerAds_Param.jsp (38 lines)
1 <%@ page 
2   import="javax.xml.transform.*,
3           javax.xml.transform.stream.*,
4           java.io.*, 
5           javax.xml.parsers.*,
6           org.w3c.dom.*" 
7 %> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
18 19 DocumentBuilder builder = factory.newDocumentBuilder(); 20 Document doc = builder.parse(new File(ls_xml)); 21 22 NodeList nodes = doc.getElementsByTagName("BANNERAD");
Additional matches viewable in cache of chapter4/BannerAds_Param.jsp.
Source code below from:
Web Development with JavaServer Pages
By Duane K. Fields, Mark A. Kolb, and Shawn Bayern
Published 15 September, 2001
Average rating

      Powells     Alibris

webdev/src/com/taglib/wdjsp/mut/CopyingTLV.java (52 lines)
14 public class CopyingTLV extends TagLibraryValidator { 
15  
16     private static String DEST_FILE = "/Users/mark/tmp/ParsedPage.xml"; 
17  
18     public ValidationMessage[] validate (String prefix, String uri, 

webdev/src/com/taglib/wdjsp/mut/NestingTLV.java (109 lines)
4 import javax.servlet.jsp.tagext.ValidationMessage; 
5 import javax.servlet.jsp.tagext.PageData; 
6 import javax.xml.parsers.DocumentBuilder;
7 import javax.xml.parsers.DocumentBuilderFactory;
8 import org.w3c.dom.Document; 
9 import org.w3c.dom.Node; 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
17 import java.io.IOException; 18 import org.xml.sax.SAXException; 19 import javax.xml.parsers.ParserConfigurationException; 20 21 public class NestingTLV extends TagLibraryValidator {
Additional matches viewable in cache of webdev/src/com/taglib/wdjsp/mut/NestingTLV.java.
webdev/src/com/taglib/wdjsp/mut/ScriptFreeTLV.java (167 lines)
4 import javax.servlet.jsp.tagext.ValidationMessage; 
5 import javax.servlet.jsp.tagext.PageData; 
6 import javax.xml.parsers.SAXParserFactory;
7 import javax.xml.parsers.SAXParser;
8 import org.xml.sax.Attributes;
9 import org.xml.sax.helpers.DefaultHandler;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
14 import java.io.IOException; 15 import org.xml.sax.SAXException; 16 import javax.xml.parsers.ParserConfigurationException; 17 18 /**
Additional matches viewable in cache of webdev/src/com/taglib/wdjsp/mut/ScriptFreeTLV.java.

Not satisfied? Try this search biased towards software and programming:
Google