-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Let me see 1... 2... 3... 4... 5.. 6... 7..., oops lost count, 1...
2...
Not 10 lines, but short enough. Good job!
- --Brian Curtis
- -----Original Message-----
From: IT Man [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 27, 2000 1:14 AM
To: [EMAIL PROTECTED]; Paul Williams; [EMAIL PROTECTED]
Subject: RE: A FEW VERY SIMPLE QUESTION!!!
Brian, Challenge taken ;)
(Sorry if the non-techies are annoyed!)
import javax.xml.parsers.*;
import org.w3c.dom.*;
import java.sql.*;
public class DBParser {
public static void main(String args[]) {
String url = "jdbc:odbc:SQLServer";
String temp = new String();
Connection con;
Statement stmt;
Element[] elem = new Element[10];
int i = 0;
try {
DocumentBuilderFactory dbf = new
com.sun.xml.parser.DocumentBuilderFactoryImpl();
DocumentBuilder db = dbf.newDocumentBuilder();
Document outDoc = db.newDocument();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection(url,
"myLogin", "myPassword");
stmt = con.createStatement();
ResultSet res = stmt.executeQuery("Select * from
Categories ");
Element data = outDoc.createElement("Data");
outDoc.appendChild(data);
while (res.next()) {
temp = res.getString("CategoryName");
elem[i] = outDoc.createElement("CatName");
elem[i].setAttribute("CategoryName", temp);
data.appendChild(elem[i]);
i++;
}
stmt.close();
con.close();
} catch(Throwable t) {
System.err.println("Exception: " +
t.getMessage());
}
}
}
Paul Aoun
- --- Brian Curtis <[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> The concepts are mostly correct, however, having
> done extensive
> programming in java (and some with XML technology) I
> challenge "IT
> Man" (or Paul Aoun) to produce 10 lines of Java code
> that provide
> this functionality... :)
>
>
> - --Brian Curtis
>
> - -----Original Message-----
> From: IT Man [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 26, 2000 1:03 AM
> To: Paul Williams; [EMAIL PROTECTED]
> Subject: Re: A FEW VERY SIMPLE QUESTION!!!
>
>
> Dear Paul,
>
> To a simple question a simple answer:
> 1-Get data from database using a Select statment or
> the provided APIs (if any).
> 2-Parse it to XML using one of the XML parsers
> available from Sun, IBM, Oracle...
> 3-Open a TCP/IP connection to your destination: FTP,
> HTTP, SMTP...
> 4-Send document.
>
> In summery, you need:TCP/IP, Application connection
> method(API, JDBC, ODBC..) and an XML parser.
>
> You can do the above steps in Java in app. 10 lines
> of
> code.
>
> If encryption is needed, it can be done between
> after
> step 2.
>
> Hope to have clarified a bit the work to be done.
>
> Paul Aoun, Technical Manager
>
>
> - --- Paul Williams <[EMAIL PROTECTED]>
> wrote:
> >
> > To: [EMAIL PROTECTED]
> > Hi all,
> >
> > The question I have now, is a very simple one in
> > theory?. But I have tried to
> > find out the answer by searching the Internet, but
> > yet to no avail.
> >
> > My questions are:
> >
> > What do I need to send an XML document over the
> > Internet, or using SMTP.
> >
> > How is the above done?. i.e, how does the message
> > get from the application onto
> > the Internet and arrive at it destination?.
> >
> > How does the XML get it's address
> > information
> > Where does any encryption take
> place
> >
> > I hope there is somebody out there that could just
> > clarify these couple of
> > questions. As this I feel is just the gap that is
> > missing in my basic knowledge
> > of the XML process.
> >
> > Thanks
> >
> > Paul
> >
> >
> >
> >
> > ------ XML/edi Group Discussion List ------
> > Homepage = http://www.XMLedi-Group.org
> >
> > Unsubscribe = send email to:
> > [EMAIL PROTECTED]
> > Leave the subject and body of the message blank
> >
> > Questions/requests: [EMAIL PROTECTED]
> >
> > To receive only one message per day (digest
> format)
> > send the following message to [EMAIL PROTECTED],
> > (leave the subject line blank)
> >
> > digest xmledi-group your-email-address
> >
> > To join the XML/edi Group complete the form
> located
> > at:
> > http://www.xmledi-group.org/xmledigroup/mail1.htm
> >
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Get Yahoo! Mail � Free email you can access from
> anywhere!
> http://mail.yahoo.com/
>
>
> - ------ XML/edi Group Discussion List ------
> Homepage = http://www.XMLedi-Group.org
>
> Unsubscribe = send email to:
> [EMAIL PROTECTED]
> Leave the subject and body of the message blank
>
> Questions/requests: [EMAIL PROTECTED]
>
> To receive only one message per day (digest format)
> send the following message to [EMAIL PROTECTED],
> (leave the subject line blank)
>
> digest xmledi-group your-email-address
>
> To join the XML/edi Group complete the form located
> at:
> http://www.xmledi-group.org/xmledigroup/mail1.htm
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGPfreeware 6.5.3 for non-commercial use
> <http://www.pgp.com>
>
>
iQA/AwUBOX93AydXKV6T/lvVEQII0QCeJQ7FIXg2iR/Wzr0+PNQqiW0QdFYAoIZ2
> NPr6yFraAt1NdSK/oG5pMtiR
> =V89G
> -----END PGP SIGNATURE-----
>
__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
- ------ XML/edi Group Discussion List ------
Homepage = http://www.XMLedi-Group.org
Unsubscribe = send email to: [EMAIL PROTECTED]
Leave the subject and body of the message blank
Questions/requests: [EMAIL PROTECTED]
To receive only one message per day (digest format)
send the following message to [EMAIL PROTECTED],
(leave the subject line blank)
digest xmledi-group your-email-address
To join the XML/edi Group complete the form located at:
http://www.xmledi-group.org/xmledigroup/mail1.htm
-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBOYBTcCdXKV6T/lvVEQIsSgCfaTDW0XXe5wHE5g6cRRiLgzMdqQ4AnRMp
5x0DbJ1oSCfgYcNvFnYjpiAi
=xP25
-----END PGP SIGNATURE-----
------ XML/edi Group Discussion List ------
Homepage http://www.XMLedi-Group.org
Unsubscribe send email to: [EMAIL PROTECTED]
Leave the subject and body of the message blank
Questions/requests: [EMAIL PROTECTED]
To receive only one message per day (digest format)
send the following message to [EMAIL PROTECTED],
(leave the subject line blank)
digest xmledi-group your-email-address
To join the XML/edi Group complete the form located at:
http://www.xmledi-group.org/xmledigroup/mail1.htm