Re: Creating internal DTD subset with Xerces-J

2008-01-15 Thread Mukul Gandhi
Thanks for your remarks. I do agree that future W3C standardization efforts should be focused on schemas. DTD is an old technology, and trying to put efforts now, to incorporate DTD related features in DOM will not bear much fruits very soon. In Java XML parser market, Xerces-J is clearly the mar

Re: Creating internal DTD subset with Xerces-J

2008-01-15 Thread Michael Glavassevich
Hi Mukul, "Mukul Gandhi" <[EMAIL PROTECTED]> wrote on 01/14/2008 10:59:41 PM: > Hi Michael, >Thanks for your response. Please see my comments below. > > On Jan 14, 2008 7:51 PM, Michael Glavassevich <[EMAIL PROTECTED]> wrote: > > You can but I wouldn't expect much of a response. I believe the

Re: Creating internal DTD subset with Xerces-J

2008-01-15 Thread keshlam
>I believe, this is a critical shortcoming in DOM (i.e., not able to >create/modify internal DTD subset in standard DOM). Is there some >place, where I can ask for this functionality in DOM? DOM Level 3 considered adding DTD/schema support, but in the end the validation module was all that surviv

Re: Creating internal DTD subset with Xerces-J

2008-01-14 Thread Mukul Gandhi
Hi Michael, Thanks for your response. Please see my comments below. On Jan 14, 2008 7:51 PM, Michael Glavassevich <[EMAIL PROTECTED]> wrote: > You can but I wouldn't expect much of a response. I believe the DOM Working > Group disbanded shortly after the various DOM Level 3 Recommendations were

Re: Creating internal DTD subset with Xerces-J

2008-01-14 Thread Michael Glavassevich
"Mukul Gandhi" <[EMAIL PROTECTED]> wrote on 01/14/2008 12:32:52 AM: > I have further question related to this: > I still have to use, Xerces specific class DocumentTypeImpl, which is > deprecated, and I have a risk to loose this functionality in future > Xerces releases. Can we ask for API enhan

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Mukul Gandhi
Hi Prashant, Thanks for reply. The following code works for me: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); DOMImplementation domImplementation = docBuilder.getDOMImplementation(); DocumentTypeImpl documentType = (D

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Prashant Reddy
Try this code : DocumentBuilder builder = factory.newDocumentBuilder(); final DOMImplementation domImplementation = builder.getDOMImplementation(); /* See this sttmt */ final DocumentType documentType = domImplementation.createDocumentType(rootName, /* this is null ?*/

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Prashant Reddy
On Mon, 2008-01-14 at 09:35 +0530, Mukul Gandhi wrote: > public boolean write(Node nodeArg, LSOutput destination) >throws LSException > > Shouldn't the 1st argument be, Document ? (so we should be able to > serialize the whole Document object, including the interna

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Mukul Gandhi
On Jan 14, 2008 9:35 AM, Mukul Gandhi <[EMAIL PROTECTED]> wrote: > But LSSerializer.write has following signature (copied from Xerces javadocs): > > public boolean write(Node nodeArg, LSOutput destination) > throws LSException > > Shouldn't the 1st argument be, Documen

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Mukul Gandhi
Hi Dick, Please see my comments below. On Jan 13, 2008 10:53 PM, Dick Deneer <[EMAIL PROTECTED]> wrote: > You are also not serializing the Document but only the root. I also think so, but still not able to find the correct way. > I always use document = impl.createDocument(namespace, qualifie

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Mukul Gandhi
On Jan 13, 2008 10:34 PM, Dick Deneer <[EMAIL PROTECTED]> wrote: > Have you tried to document.appendChild(docType) ? This does not solve the problem. I am getting the same output (i.e., without the internal DTD subset). -- Regards, Mukul Gandhi --

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Dick Deneer
After a a closer look to your coding: You are also not serializing the Document but only the root. I always use document = impl.createDocument(namespace, qualifiedName, null); to define the Document and root. I am not sure if in your case the root is actually connected to the document. Rega

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Dick Deneer
Have you tried to document.appendChild(docType) ? Op 13-jan-2008, om 15:01 heeft Mukul Gandhi het volgende geschreven: I am using LSSerializer to serializing the DOM. Below is the complete code: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = d

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Mukul Gandhi
I am using LSSerializer to serializing the DOM. Below is the complete code: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = dbf.newDocumentBuilder(); CoreDocumentImpl document = (CoreDocumentImpl)docBuilder.newDocument(); DocumentTypeImpl docType =

Re: Creating internal DTD subset with Xerces-J

2008-01-13 Thread Dick Deneer
Are you using a Transformer class to serialize the document ? If so, then try to use the LSSerializer instead to serialize the DOM and you will also have the DTD subset in your output. Regards Dick Deneer Op 13-jan-2008, om 6:29 heeft Mukul Gandhi het volgende geschreven: I found that Xer

Re: Creating internal DTD subset with Xerces-J

2008-01-12 Thread Mukul Gandhi
I found that Xerces-J provides non-DOM classes CoreDocumentImpl and DocumentTypeImpl for this. I tried this code: CoreDocumentImpl document = (CoreDocumentImpl)docBuilder.newDocument(); DocumentTypeImpl docType = (DocumentTypeImpl)document.createDocumentType("root", null, null); docType.setInter

Creating internal DTD subset with Xerces-J

2008-01-11 Thread Mukul Gandhi
Hi all, I am using Xerces-J 2.9.1. I need to create a simple XML document using DOM APIs. The XML will have an internal DTD subset, declaring an entity. [1] Following is the XML I want to create (in this lexical form only): ]> &x; world The program I have written so far is: DocumentBu