W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2000

Re: DOM API usage question

From: Claude Zervas <claude@utlco.com>
Date: Thu, 13 Jul 2000 00:04:32 -0700
Message-Id: <4.1.20000712235536.00a769d8@mail.blarg.net>
To: "Rahul Naithani" <rnaithani@ssind.stpn.soft.net>, <www-dom@w3.org>
At 10:48 PM 7/12/2000 , Rahul Naithani wrote:
>> I'm afraid I don't know what you mean by the phrase
>>
>> >a vc++ type of help
>I mean, if I want to create an XML document using the DOM API then which
>interface to implement, which method to call?
>Simillarly for other operations there should be some kind of starting point
>in the documentation. The documentation is in a very poor state right now
>because I have to read the methods and guess what it could possible do.
>regards and thanks for writing in . I am going to read the link you had
>kindly sent.
>Rahul.
>>
>>
>> To "create an XML doc, add nodes to it, change the data of the nodes etc",
>> you call the appropriate "methods, methods and more methods." I know, that
>> doesn't tell you a lot about how to get started.
...

Here's a simple example using Xerces (see http://xml.apache.org):

To create the short document <x><y></y></x>:

	DOMImplementation domImpl= DOMImplementationImpl.getDOMImplementation();
	doc = domImpl.createDocument( docURI, "x", docType );
	Element root = doc.getDocumentElement();
	Element anotherElem = doc.createElement( "y" );
	root.insertBefore( anotherElem , null );

A good way to learn is to download a good package such as Xerces, read the
JavaDocs,
and just play around. The OpenXML packages are good for parsing and
serializing.

- Claude
Received on Thursday, 13 July 2000 03:02:10 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:47 GMT