I have done that.
By mapping the DTD into a tree and then by restricting the insertion of 
Nodes into XML file only through tree (by double click), that allows the 
insertion of only valid Nodes.



Balamuthukumar Namasivayam wrote:

>How do u validate your xml file against DTD or Schema withour using XML
>parser?.For generating XML file you no need to have a parser.
>
>Regards
>
>Bala
>Mobile  0415 654 273
>Office   02-8845 8617
>
>
>
>
>                                                                                      
>                             
>                    "saurabh"                                                         
>                             
>                    <skedia@itil.        To:     "JDJList" 
><[EMAIL PROTECTED]>                           
>                    com>                 cc:                                          
>                             
>                                         Subject:     [jdjlist] Xml generation        
>                             
>                    2002/05/23                                                        
>                             
>                    16:12                                                             
>                             
>                    Please                                                            
>                             
>                    respond to                                                        
>                             
>                    "JDJList"                                                         
>                             
>                                                                                      
>                             
>                                                                                      
>                             
>
>
>
>
>Hi all,
>I have used a strange approach to generating XML based on data retrieved
>from database and have consequently displayed it in HTML format using XSL
>
>here is the code ihave used:
>
>Properties pEnv = new Properties();
>  pEnv.load(new FileInputStream("C:
>\\jboss-2.4\\tomcat\\webapps\\ROOT\\jspxml\\abc.dtd"));//loaded my DTD file
>in same directory where my XML file will be generated
>
>  try{
>*****Creating a string that looks like XML*****
>
>  String xmlG="<?xml version=\"1.0\" ?>\n";
>         xmlG=xmlG+"<!DOCTYPE abc >\n\n";
>         xmlG=xmlG+"<abc>\n";
>
>  v5=remote1.getEmployeeNames();//fetching data from database and writng it
>as part of string using EJB  method call
>  for(int i=0;i<v5.size();i++)
>  {
>   vRow=new Vector();
>   vRow=(Vector)v5.elementAt(i);
>
>   xmlG=xmlG+"<people>\n"+
>   "<person>\n"+
>   "<name>\n"+
>   "<firstname>"+(String)vRow.get(1)+"</firstname>\n"+
>   "<lastname>"+(String)vRow.get(2)+"</lastname>\n"+
>   "<ecn>"+(String)vRow.get(0)+"</ecn>\n"+
>   "</name>\n"+
>
>   "</person>\n"+
>   "</people>";
>  }
>
>  xmlG=xmlG+"</abc>";
>
>******making a xml file using the String*****
>
>  FileOutputStream f= new FileOutputStream
>("C:/jboss-2.4/tomcat/webapps/ROOT/jspxml/myxml.xml");
>  DataOutputStream d= new DataOutputStream(f);
>  d.writeBytes(xmlG);
>
>       }catch(Exception ex)
>   {
>    out.println(" Exceptionin in exp.jsp: "+ex);
>   }
>
>       response.sendRedirect("bookdata.jsp");//here,the xml file generated
>together  with xsl(written separately) is being converted into html format
>for display using Taglibs.
>%>
>I have not used any XML parser for the xml generation ...this works...I had
>also written a DTD .
>Is this the correct approach...what would the negative implications
>be...can anyone comment..
>
>thanks in advance,
>Saurabh
>
>To change your membership options, refer to:
>http://www.sys-con.com/java/list.cfm
>
>
>
>
>------------------------------------------
>This e-mail is confidential.  If you are not the intended recipient, any use, 
>disclosure or copying of this document is unauthorised and prohibited.  If you have 
>received this document in error, please delete the email and notify me by return 
>email or by phoning the NEMMCO Helpdesk on 1300 300 295.
>
>To change your membership options, refer to:
>http://www.sys-con.com/java/list.cfm
>
>



To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm

Reply via email to