You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Sh...@ssga.com on 2001/05/17 21:47:37 UTC

simple question?

Hello,

I am brand new to xml and parsing with Xerces.

I have an XML String in a Java class that looks like this:

<PLATFORM__CLUSTER_SERVER_DASHBOARD>
<PLATFORM_GET_CLUSTER_ID_FOR_SERVER>
<_data>
<_record>
<CLUSTER_ID><![CDATA[22165]]></CLUSTER_ID>
</_record>
</_data>
</PLATFORM_GET_CLUSTER_ID_FOR_SERVER>
</PLATFORM__CLUSTER_SERVER_DASHBOARD>

All I want to do is pull out the value for CLUSTER_ID, which is "22165" so
I can assign it to a variable.

I have a Xerces parser class and imported

this stuff:

import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;
import org.xml.sax.SAXException;
import java.io.IOException;
import org.xml.sax.ContentHandler;

can anyone tell me how I can accomplish this?

Thanks in advance,

Sharlene




Re: simple question?

Posted by Krzysztof Zielinski <kr...@desy.de>.
How do you get that string ? from a file ?

Sharlene_Sallet@ssga.com schrieb:
> 
> Hello,
> 
> I am brand new to xml and parsing with Xerces.
> 
> I have an XML String in a Java class that looks like this:
> 
> <PLATFORM__CLUSTER_SERVER_DASHBOARD>
> <PLATFORM_GET_CLUSTER_ID_FOR_SERVER>
> <_data>
> <_record>
> <CLUSTER_ID><![CDATA[22165]]></CLUSTER_ID>
> </_record>
> </_data>
> </PLATFORM_GET_CLUSTER_ID_FOR_SERVER>
> </PLATFORM__CLUSTER_SERVER_DASHBOARD>
> 
> All I want to do is pull out the value for CLUSTER_ID, which is "22165" so
> I can assign it to a variable.
> 
> I have a Xerces parser class and imported
> 
> this stuff:
> 
> import org.xml.sax.XMLReader;
> import org.xml.sax.helpers.XMLReaderFactory;
> import org.xml.sax.SAXException;
> import java.io.IOException;
> import org.xml.sax.ContentHandler;
> 
> can anyone tell me how I can accomplish this?
> 
> Thanks in advance,
> 
> Sharlene