XML Server Getting Started    
     } catch (e) { 
        util.messageBox("Login failed", e.description); 
     } 
   } 
 
The first characteristic element of the above code is the standard sequence of  Java statements related to receiving and parsing 
the input XML: 
      InputSource in = new InputSource(request.getInputStream()); 
      DOMParser parser = new DOMParser(); 
      parser.parse(in); 
      Node requestRoot = parser.getDocument().getDocumentElement(); 
Next is the way your code can apply XPath statements to  query  the document via XPathAPI: 
      XPathAPI xp = new XPathAPI(); 
       .    .    .   .   .   .  .   
      String userid = getNodeValue(xp.selectSingleNode(requestRoot, "//userid"));  
On the other hand, you can bypass XPathAPI class and use Xalan directly. 
And last, but not least, is the encoding of the `<', `&', and the quote characters, like in the following fragment: 
      StringBuffer sb = new StringBuffer(getStackTraceAsString(e)); 
      StringFunctions.replaceAll(sb, "&", "&"); 
      StringFunctions.replaceAll(sb, "<", "<"); 
      StringFunctions.replaceAll(sb, "\"", """); 
      result = "" + sb.toString() +  "" ; 
  
Remember, well formed XML should replace these characters with references to predefined entities `<', `&' and 
`"' correspondingly (that is   if presented inside so called  parsed character data . There is an alternative method   
declare a non parsed character or CDATA section.) 
 2000 2002 Computer Technology Inc. All rights reserved. 
Page 16 




J2EE Web Hosting Tundra XML Server Pages J2EE Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.