Hi Leo,

        Thanks for ur reply. The xml file i sent to you is not a valid XML file.
That is, that xml document is not according to the XML schema i sent. When i
validate the same XML document with the schema i sent, using XMLSpy 3.5, it
gives me the error. In the XML document, there is a element named "cna" and
that element can have a maximum of 3 characters. Even i parsed the same in
the serlvet. But it is getting validated. But i do the same in a standalone
application, it throws me error. I don't know why it is not working in
servlet environment... Any ideas????

Thanks and Have a great day!!!!

Ragunath








-----Original Message-----
From: Leonardo Battagli [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 07, 2001 4:14 AM
To: [EMAIL PROTECTED]
Subject: RE: XML Schema Validation


At 17.25 06/03/01 -0500, you wrote:
>Hi Keith,
>
>Thanks for your reply. Even i thought in the way you thought. So i
>configured my webserver and i gave the XSD path as
><http://localhost/cv_enterprise.xml>http://localhost/cv_enterprise.xml.
>(My localhost was pointing to the directory where the XSD is. I checked it
>with browser and i'm able to open the XSD file thru browser giving the
>above url). But even then the parser is not validating the xml document.
>Do u think is there any other reason??
>
>Ragunath

I merged your code in the doGet method, after executing the servlet I have
this message from the browser

IXX EXISTS is EXISTS its working

does it means the .XML is valid against the schema ???


   /**Process the HTTP Get request*/
   public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
     try{
     PrintWriter out = response.getWriter();
     DOMParser pt = new DOMParser();
     String sxx = new
String("C://jboss_tomcat/tomcat-3.2-b7/webapps/xslt/WEB-INF/cv_enterprise.xm
l");
     FileInputStream ixx = null;
     try{
       ixx = new FileInputStream(sxx);
     }
     catch(Exception e){ System.out.println("error is  "+
etMessage());    }
     out.println("<html><body>");
     if (ixx != null) {out.println("IXX EXISTS");  } else
{  out.println("IXX NON EXISTS");    }
     InputSource is = new InputSource(ixx);
     if (is != null) {   out.println("is EXISTS");   } else
{   out.println("is NON EXISTS");  }
     pt.setFeature("http://xml.org/sax/features/validation";, true);
     pt.setFeature("http://apache.org/xml/features/validation/schema";,
true);
//      pt.setValidation(true);
//      pt.setValidationSchema(true);
     try{
       pt.parse(is);
     }
     catch (Exception e) {
       System.out.println("NonParserException: " + e.getMessage());
       out.println("QUALCOSA NON VA");
     }
     out.println("its working");
     out.println("</body></html>");
     }catch(Exception e){}
   }


Thks,
Leonardo


==============================================
Lulli Informatica S.r.l.
http://www.lulliinformatica.com
----------------------------------------------
Leonardo Battagli: Java/XML Developer at [EMAIL PROTECTED]
==============================================
Out of the office email address: [EMAIL PROTECTED]
==============================================


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to