I just wrote this example for a different subject. All you need to do is to encapsule the <tr> related lines in a external loop for each row, then you need to include the <td> lines in a internal loop for each column.
Obviously, you can rename the <style>, <table>, <tr> & <td>, elements for those you consider more appropriate. > Try the following. It is a complete different approach using the XML Writer. > Try it as a console project, just make sure you the gb.xml is selected under > PROJECT\PROPERTIES\COMPONENTS > > ' Gambas module file > PUBLIC SUB Main() > DIM docXML AS XmlWriter > > docXML = NEW XmlWriter > 'this line is to save the xml document in your home folder > docXML.Open(User.Home & "/DoctorRicky.html", TRUE) > > 'This part is the fancy CSS styling only is not important > docXML.StartElement("style", ["type", "text/css"]) > docXML.Text("table.fancyTable {padding: 2pt; widht:100%;}") > docXML.Text("th {font-weight: bold; background-color: #cccc99; > color: #000000}") > docXML.Text("tr.evenRow {background-color: #f5f5dc; text-align: center}") > docXML.Text("tr.oddRow {background-color: #ffffff; text-align: center}") > docXML.EndElement > > docXML.StartElement("table", ["class", "fancyTable"]) > '<th /> is the HTML tab for the headers > docXML.Element("th", "Test") > docXML.Element("th", "Date 1") > docXML.Element("th", "Date 2") > docXML.Element("th", "Date 3") > '<tr /> is the tag for the rows > docXML.StartElement("tr", ["class", "oddRow"]) > '<td /> is the tag for the colums > ' number of <td /> elements must be the same as the number of <th > /> elements > docXML.Element("td", "LDL Fraction") > docXML.Element("td", "50 ml/dl") > docXML.Element("td", "100 ml/dl") > docXML.Element("td", "150 ml/dl") > docXML.EndElement() > > 'On the real life you'll prefer to handle this with a Loop Control Structure > docXML.StartElement("tr", ["class", "evenRow"]) > docXML.Element("td", "HDL Fraction") > docXML.Element("td", "50 ml/dl") > docXML.Element("td", "75 ml/dl") > docXML.Element("td", "100 ml/dl") > docXML.EndElement() > docXML.EndElement() > 'PRINT Xml.EndDocument > END > On Thu, May 7, 2009 at 7:05 AM, wahyu budhi <web...@gmail.com> wrote: > Hi all, > > Can I create xml from table view in gambas2? and can anyone give me an > example, thx > > Regards, > > webs37 > ------------------------------------------------------------------------------ > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your > production scanning environment may not be a perfect world - but thanks to > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 > Series Scanner you'll get full speed at 300 dpi even with all image > processing features enabled. http://p.sf.net/sfu/kodak-com > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user