You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Jarek Wilkiewicz <ja...@sonic.net> on 2000/03/17 19:52:31 UTC

Does java serializer API work with DOM Level 1 Core ?

Hello,

I used the sample test code by Andy Clark http://xml-archive.webweaving.org/xml-archive-xerces/0852.html , my classpath has DOM Level 1 Core w3c classes (that come with JAXP distribution) before the rest of the xerces (1.0.3) distribution, and I get the following error :

xception in thread "main" java.lang.NoSuchMethodError: org.w3c.dom.DocumentType: method getPublicId()Ljava/lang/String; not found
        at org.apache.xml.serialize.BaseMarkupSerializer.serializeNode(Compiled Code)
        at org.apache.xml.serialize.BaseMarkupSerializer.serialize(BaseMarkupSerializer.java:421)
        at test.Test.main(Compiled Code)


I've checked the code and DOM Level 1 Core DocumentType does not have getPublicId().
Can I make the serializers work with DOM L1 ? After reading some of the threads I was under the impression that this should work.

Thanks,
Jarek





Re: Does java serializer API work with DOM Level 1 Core ?

Posted by Andy Clark <an...@apache.org>.
I went ahead and fixed this in BaseMarkupSerializer.java to
remove the DOM Level 2 dependency. If you check out the code
from the CVS repository, you will get the change.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org

Re: Does java serializer API work with DOM Level 1 Core ?

Posted by Arkin <ar...@exoffice.com>.
> That's interesting. Because I suggested that the serializer
> code use reflection to discover if the implementation had
> a getPublicId(). In this way, even DOM Level 1 DOMs would
> work with the serialization code. And I thought that Arkin
> was in favor...

In favor, but forgot to do it.

> 
> (checking...)
> 
> Well, the code in CVS definitely assumes DOM Level 2. I
> only searched for direct calls to getSystemId() so I don't
> know if there are other new Level 2 methods being used in
> the code.
> 
> Arkin: Are there any other places in the code that are
> strictly reliant on DOM Level 2 methods added to the
> interfaces? Can we put in my reflection code?

Only this place for now, but we need to figure out how to support
namespaces for DOM Level 2.

And yes, you can go ahead and add the reflection methods, I'll try not
to kill them when I do a check in.

arkin

> 
> --
> Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org

-- 
----------------------------------------------------------------------
Assaf Arkin                                           www.exoffice.com
CTO, Exoffice Technologies, Inc.                        www.exolab.org

Re: Does java serializer API work with DOM Level 1 Core ?

Posted by Andy Clark <an...@apache.org>.
> Jarek Wilkiewicz wrote:
> I used the sample test code by Andy Clark
> http://xml-archive.webweaving.org/xml-archive-xerces/0852.html , my

That message I posted was when I first started using the
serializers and there were bugs in the DOM serialization
code.

> classpath has DOM Level 1 Core w3c classes (that come with JAXP
> distribution) before the rest of the xerces (1.0.3) distribution, and
> I get the following error :
> 
> xception in thread "main" java.lang.NoSuchMethodError:
> org.w3c.dom.DocumentType: method getPublicId()Ljava/lang/String; not

That's interesting. Because I suggested that the serializer
code use reflection to discover if the implementation had
a getPublicId(). In this way, even DOM Level 1 DOMs would
work with the serialization code. And I thought that Arkin
was in favor...

(checking...)

Well, the code in CVS definitely assumes DOM Level 2. I
only searched for direct calls to getSystemId() so I don't
know if there are other new Level 2 methods being used in
the code.

Arkin: Are there any other places in the code that are
strictly reliant on DOM Level 2 methods added to the
interfaces? Can we put in my reflection code?

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org