Hello, my name is Luis Gomez, i'm the responsable for z3950's client development, i want to thank you for your time and will for help us.

I've already revised de code, i looked some test source code:

/*Test source code */ 
public void testLOC2() throws Exception { 

        app_context = new ClassPathXmlApplicationContext( 
                "spring/applicationContext.xml"); 

        Z3950ServiceFactory factory = new Z3950ServiceFactory("z3950.loc.gov", 
                7090); 
        factory.setApplicationContext(app_context); 
        factory.setDefaultRecordSyntax("usmarc"); 
        factory.setDefaultElementSetName("F"); 
        factory.getRecordArchetypes().put("Default", "usmarc::F"); 
        factory.getRecordArchetypes().put("FullDisplay", "usmarc::F"); 
        factory.getRecordArchetypes().put("BriefDisplay", "usmarc::B"); 
        factory.getRecordArchetypes().put("Holdings", "usmarc::F"); 
        IRQuery query = new IRQuery(); 
        query.collections = new Vector(); 
        query.collections.add("Voyager"); 
        query.query = new org.jzkit.search.util.QueryModel.PrefixString.PrefixString( 
                "@attrset bib-1 @attr 1=4 \"brain\""); 
        Z3950QueryModel zqm = Type1QueryModelBuilder.buildFrom(app_context, 
                query.query, "utf-8"); 
        Searchable s = factory.newSearchable(); 
        s.setApplicationContext(app_context); 
        IRResultSet result = s.evaluate(query); 
        result.waitForStatus(IRResultSetStatus.COMPLETE 
                | IRResultSetStatus.FAILURE, 0); 

 Enumeration e = new org.jzkit.search.util.ResultSet.ReadAheadEnumeration( 
                result, new ArchetypeRecordFormatSpecification("Default")); 

        for (int i = 0; ((e.hasMoreElements()) && (i < 60)); i++) { 
            System.err.println("Processing result " + i); 
            InformationFragment f = (InformationFragment) e.nextElement(); 
            System.err.println(f.getOriginalObject()); 
        } 
    } 

/*Test source code */ 



This works perfectly, but i don't understand the InformationFragment structure, i want transform the InformationFragment object to  a format that i can manipulate, xml wold be my first choice, but i can't find the api methods for do this

 i revised some jzkt2 documentation, i finded this: 

   InformationFragment f2[] = ifs.getFragment(10,10);  
   // Make sure we can call getDocument 
   System.out.println("Test 4 : Get document"); 
   org.w3c.dom.Document d = f2[2].getDocument(); 

I looked for getDocument() method on InformationFragment on jzkit 3 version (at least the source version3 that i have at my pc), i couldn't find something similar for xml approach from InformationFragment objetcs.

I wold know how can extract the data from

Enumeration e = new org.jzkit.search.util.ResultSet.ReadAheadEnumeration( 
                result, new ArchetypeRecordFormatSpecification("Default")); 

Any suggestiongs will be very appreciated

regards

Edited 3 Years Ago by Nick Evan: Fixed formatting

I googled what i think is the page for that documment you can get:

http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html

org.w3c.dom
Interface Document

it says: The Document interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.

and has methods like:

Element getElementById(String elementId)
Returns the Element whose ID is given by elementId.
NodeList getElementsByTagName(String tagname)

sounds like you are able to manimpulate it like an html or xml document with traditional methods for traversion the dom structure.

Mike

This article has been dead for over six months. Start a new discussion instead.