how to parse a string using Xalan or Xerces?

hi all

got a question here. hope someone can help me out. :)

i have a string containing xml data and i want to parse it so that i can use DOM to alter the information in the xml data. pardon me but i dont know the usage of Xalan and Xerces. i'm a student doing a major project now and my lecturer ask me to use Xalan and Xerces.

an example will be most helpful. :)

thanks in advance

P.S : thanks to thebobster for his help on my previous post although it's not what i wanted :)

[523 byte] By [xerokool] at [2007-9-26 1:37:34]
# 1

import org.apache.xerces.dom.DOMParser;

import org.w3c.dom.Document;

import org.w3c.dm.NodeList;

DOMParser parser new DOMParser();

parser.parse("xyz.xml"); // Instead of xml file it could be a InputStream.. not sure though

// You need to llok at documentation

Document doc = parser.getDocument()

// Once you have got the Document you can manipulate it using DOM api

// For example following code prepares a list of nodes having a tag = "product_id"

NodeList prodList = new NodeList();

prodList = doc.getNodeByTagName("product_id");

Hope this helps !!!

Sunil

SSingh73 at 2007-6-29 2:24:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...