Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Simple Java DOM XML Tutorial

Reply
Thread Tools

Simple Java DOM XML Tutorial

 
 
Gene Davis
Guest
Posts: n/a
 
      04-06-2004
I've added a tutorial/example to my site that shows
the creation of a simple DOM XML tree and then
spitting it out as a String.

Hopefully this is useful to someone

http://www.genedavis.com/library/welcome.cgi

Gene Davis
www.genedavissoftware.com

 
Reply With Quote
 
 
 
 
Mohun Biswas
Guest
Posts: n/a
 
      04-06-2004
Gene Davis wrote:
> I've added a tutorial/example to my site that shows
> the creation of a simple DOM XML tree and then
> spitting it out as a String.
>
> Hopefully this is useful to someone


I certainly found it useful - thanks very much! I've been generating a
little XML document using a StringBuffer for a while now and converting
it to DOM has been on my to-do list. Your tutorial made it look so easy
I pushed it to the top of the stack and just did it.

One thing, though - it doesn't cover how to add a CDATA section and I
can't see the answer immediately from the JavaDocs. Any chance you could
add an example of that?

Thanks a lot,
MB
 
Reply With Quote
 
 
 
 
Mohun Biswas
Guest
Posts: n/a
 
      04-06-2004
Mohun Biswas wrote:
> One thing, though - it doesn't cover how to add a CDATA section and I
> can't see the answer immediately from the JavaDocs. Any chance you could
> add an example of that?


Never mind, got it:

CDATASection cds = doc.createCDATASection(<string>);
root.appendChild(cds);
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Begin Learning Java ! - Most simple java tutorial - ( Begin Learning Java Java 5 03-17-2010 11:41 PM
getNextSibling() never ends? DOM XML nodes (org.w3c.dom) Alan Java 6 10-13-2008 05:48 PM
Replacing _xmlplus.dom.minidom with xml.dom.minidom aine_canby@yahoo.com Python 3 08-03-2007 03:50 PM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Convert a XML DOM Object to a HTML DOM Object manjunath.d@gmail.com XML 0 09-20-2005 08:16 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57