Re: DOM API usage question

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 UTC