[jdom-interest] Generating XML files
Bart Read
bart at wdi.co.uk
Fri Nov 30 03:19:14 PST 2001
Hi,
I'm assuming that what you mean by a "JDOM file" is a source code file that
you've written that uses the JDOM classes to parse / manipulate XML, rather
than an XML file, in which case the answers to your questions are:
(1) You save it as a .java file with the name being the same as the public
class in the file (if there is one, but don't worry about this too much at
the moment). So for example if you've got:
public class JDOMTester
{
// Definition in here
....
....
}
You save the file as "JDOMTester.java".
(2) The directory you save in is dictated by the package of which your class
is a member. So for example if the above class had the following package
declaration at the top:
package com.sunreflex.test;
you would save it in a directory called "{project_root}/com/sunreflex/test",
where {project_root} is the root directory for all Java source files in your
current project. If you use an IDE like JBuilder 6 (can be downloaded 4
free from www.borland.com) it'll handle all this for you.
(3) The XML file can be created in any text editor (although from recent
posts to this list you'll see that Windows Notepad is a pain in the butt so
you might want to avoid it) and saved with the .xml extension, for example
"MyXMLFile.xml". Incidentally if you DO use Notepad then ensure that you
use the quotes, otherwise your file will be saved as "MyXMLFile.xml.txt",
which isn't too helpful.
Sounds to me like (and if I'm wrong, I apologise) you need to get to grips
with some of the basics of the Java programming language (like package
structures), which will make using JDOM MUCH easier. There's plenty of info
on http://java.sun.com/ -- go to the Docs and Training link in the menu at
the top left of the screen and you'll find some good tutorials (and they're
free). For the XML and JDOM stuff I'd recommend that you get hold of a copy
of Java and XML by Brett McLaughlin (make sure it's the 2nd edition), which
will tell you virtually everything you need to know about XML and everything
you need to know about JDOM -- the book assumes that you know Java
moderately well though so make sure you do this first.
Regards,
=================================
Bart Read
Senior Developer
Abbotsbury Software Ltd
Abbotsbury, DORSET DT3 4JT
Tel: +44 (0) 1305 871543
E-mail: bart at wdi.co.uk
=================================
----- Original Message -----
From: "sun reflex4" <sunreflex4 at hotmail.com>
To: <jdom-interest at jdom.org>
Sent: Friday, November 30, 2001 10:35 AM
Subject: [jdom-interest] Generating XML files
> Hi,
> i still have a small problem, which is, that I do not know,
> how to compile JDOM files. After writing a JDOM file, i have the
following
> small questions:
> 1)Do i save it as a java file(.java), or as JDOM file(.jdom) ?
> 2)In which directory?
> 3)I want to create the corresponding XML file. How do i do that ?
>
> I thank you for your help.
> With best regards
>
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
> _______________________________________________
> To control your jdom-interest membership:
>
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
>
> ---------- Automatically inserted by WDI Mailserver ----------------
> This message has been scanned for virus, trojans, illegal relays and
> spam. If you have any comments, problems or questions please do not
> hesitate to contact:
> Abbotsbury Software Ltd
> Tel: +44 1305 871543 Fax: +44 1305 871688
> Email: postmaster at wdi.co.uk
> Web: http://www.wdi.co.uk/virus.phtml
More information about the jdom-interest
mailing list