You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xml.apache.org by Jeff Williams <jw...@darkphoton.com> on 2000/04/06 07:52:46 UTC

Proper use of Serializers

Hello,

    I looked in the archives and my code as well as any examples I can find all cause the same problem on my machine.  I get the following trace:

Exception in thread "main" java.lang.NoSuchMethodError: org.w3c.dom.DocumentType: method getPublicId()Ljava/lang/String not found
        at org.apache.xml.serialize.BaseMarkupSerializer.serializeNode(BaseMarkupSerializer.java, Compiled Code)
        at org.apache.xml.serialize.BaseMarkupSerializer.serialize(BaseMarkupSerializer.java:421)
        at CatalogParser.definitionXMLOut(CatalogParser.java:130)
        at CatalogParser.main(CatalogParser.java:37)

    This is useing the jar in Xerces-J-bin.1.0.3.zip. The trace looks wrong with the NoSuchMethodError giving what looks like a malformed method.  Is this a problem within the 1.0.3 build and should I use the CVS to get the newest to fix this?

    I have a Document variable (called doc) for my parsed file and now I want to change a node value (done) and write the new document to a file (or System.out).  Can someone either point me to an example or help me out?  In future releases of Xerces would would be nice if there was an example showing the use of the serialize code since I couldn't find one.  

Thanks In Advance, Jeff

Getting value of data found at TagName/TagName/TagName

Posted by Jeff Williams <jw...@darkphoton.com>.
Hello,

    I have a Document that has been parsed.  (Example found below) I want to
get the value found at a specific TAG location (don't know any other way of
putting it).
    For example (Using XML below) I want to get the value of
Service/ServiceIdentitifer/Identifier which would return "DSL Highspeed
Internet".  This is the same way XSL match document parts.

    Once I have the Document what methods can I use to do this within
Xerces?  Or do I have to walk the tree?  Or more likly I am just missing
something in the API docs.

Thanks, Jeff


<?xml version="1.0"?>
<!DOCTYPE Service SYSTEM
"http://www.cnerds.org/eOSS/Catalog/product%20catalog.dtd">
<Service>
<ServiceIdentifier><Identifier>DSL Highspeed
Internet</Identifier></ServiceIdentifier>
<Description>Provides highspeed internet over the 3DSL
service.</Description>
<Status>Available</Status>
<Availability>April 1, 2000</Availability>
<Version>1.0</Version>
<BillingID></BillingID>
<ProductList>
<ProductIdentifier><Identifier>ADSL Modem</Identifier></ProductIdentifier>
<ProductIdentifier><Identifier>ADSL Line</Identifier></ProductIdentifier>
<ProductIdentifier><Identifier>Internet
Access</Identifier></ProductIdentifier>
<ProductIdentifier><Identifier>Internet
E-Mail</Identifier></ProductIdentifier>
</ProductList>
<AttributeList>
<AttributeValue
AttributeName="TrialService"><AttributeIdentifier><Identifier>Trial</Identif
ier></AttributeIdentifier>
<Field
FieldName="Value"><FieldValue>Yes</FieldValue></Field></AttributeValue>
</AttributeList>
</Service>


Re: Proper use of Serializers

Posted by Jeff Williams <jw...@darkphoton.com>.
Hello,

    Thanks Andy.  Once I switched around some of the CLASSPATH it all
worked.  Seems one of the other developers added the Sun JAXP to the app
server and it was finding classes in it?!  I just have to make sure my
changes to the CLASSPATH don't effect anyone else.

TTYL, Jeff

----- Original Message -----
From: "Andy Clark" <an...@apache.org>
To: <ge...@xml.apache.org>
Sent: Thursday, April 06, 2000 2:52 PM
Subject: Re: Proper use of Serializers


> > Jeff Williams wrote:
> > Exception in thread "main" java.lang.NoSuchMethodError:
> > org.w3c.dom.DocumentType: method getPublicId()Ljava/lang/String not
>
> It sounds like you have a JAR file containing DOM Level 1 classes
> in your CLASSPATH *before* the Xerces parser which contains the
> new DOM Level 2 (CR) classes. The code in CVS has been updated to
> allow this to work even if used with DOM Level 1. Just do an update
> of the java/src/org/apache/xml/serialize directory.
>
> --
> Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
>


Re: Proper use of Serializers

Posted by Andy Clark <an...@apache.org>.
> Jeff Williams wrote:
> Exception in thread "main" java.lang.NoSuchMethodError:
> org.w3c.dom.DocumentType: method getPublicId()Ljava/lang/String not

It sounds like you have a JAR file containing DOM Level 1 classes
in your CLASSPATH *before* the Xerces parser which contains the
new DOM Level 2 (CR) classes. The code in CVS has been updated to
allow this to work even if used with DOM Level 1. Just do an update
of the java/src/org/apache/xml/serialize directory.

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