Hi, For example, I have a result set about 41300 in size like the following…
I am now using jsp & servlet and using the following coding with org.w3c.dom API to get the values of position.sequence (i.e. A02, A04 etc) in distinct values…
public String getDistinctAttributeValues(TXMLObjectIterator iterator, String tag) throws Exception{ int posTag = 0; int itemNo = 1; ArrayList list = new ArrayList(); while (iterator.hasNext()){ Document doc = (Document) iterator.next().getDocument(); String attribValue = doc.getElementsByTagName(tag).item(posTag++).getAttributes().item(itemNo).getNodeValue(); if (!list.contains(attribValue)) list.add(attribValue); } String sortlist= (String)list.toArray(new String
have you considered using a sax parser instead of a DOM parser? to me, it looks as if the overhead for building a dom tree out of these small instances could be enormous. (this is more than likely only one part of the problem.)
I loaded 41300 documents and with a java program that uses the Tamino API for Java SAX event based parsing I can read in all 41300 documents in 13 seconds. In my test data I generated 50 distinct values so sorting took less than 1 second.
where cnews is the collection name an xql is the query ‘/NewsML’ for searching the root node of the XML document… I have XML documents in the database and they are in the following format…
3com.softwareag.tamino.db.API.accessor.TQueryException Response could not be built NestedException:Response could not be built for XML access. NestedException:Interpreting the input stream for JDOM failed! NestedException:Error in building: null
How to solve this, thx
Actually, my aim is to retrive the value of Element A and the attribute values of C … hope I can do it quickly in using SAX