Hi

If you are creating xml file using DOM API, you can't validate it against DTD even 
after 
adding  DOCTYPE node to DOM tree. Entity and Notation declared in your DTD are not 
made 
avaiable. Entity References expansion and default attribute addition do not occur.It 
is 
expected in future version  of DOM will provide a way for populating a Document Type.

Robert Wrote:-
> 
>     Document doc=new DocumentImpl();
>     Element root=doc.createElement("Envelope");
>     doc.appendChild(root);
>     Element item=doc.createElement("Sender");
>     root.appendChild(item);
>     item.appendChild(doc.createTextNode("Mr.A"));
>     item=doc.createElement("Receiver");
>     root.appendChild(item);
>     item.appendChild(doc.createTextNode("Mr.B")); 
>     ...
> 
> but how to add a DocumentType entry? (<!DOCTYPE Envelope SYSTEM
> "thedtd.dtd">)
> using CoreDocumentImpl instead of DocumentImpl?
> but creatingDocumentType() doesn't work. it does nothing. (no exception, no
> error, nothing)


DOMImplementation docImpl= new DOMImplementationImpl();
DocType docType=domImpl.createDoctype("qualifiedName","publicId","systemID");
Document doc=new DocumentImpl(docType);



Cheers,
Arun

Sun Microsystem,Inc.


Ph:



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to