m_hustle 0 Newbie Poster

hi,
i have the attached xml file and i wish to perform some xpath expressions in java which i have declared as follows.

final String xPathexp1 = "sbml_ns:sbml/sbml_ns:model/sbml_ns:annotation/rdf_ns:RDF/rdf_ns:Description/bqmodel_ns:is/rdf_ns:Bag/rdf_ns:li/@rdf_ns:resource";

final String xPathexp2 = "/sbml_ns:sbml/sbml_ns:model/sbml_ns:listOfSpecies/sbml_ns:species/sbml_ns:annotation/rdf_ns:RDF/rdf_ns:Description/bqmodel_ns:is/rdf_ns:Bag/rdf_ns:li/@rdf_ns:resource[starts-with(.,"urn:miriam:uniprot:")]";

I have set the namespaces as follows:

try {        	
			        	
			        	NamespaceContext ctx = new NamespaceContext() {

							@Override
							public String getNamespaceURI(String prefix) {
								if (prefix.equals("rdf_ns")) {
				                    return "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
								}
								else if (prefix.equals("bqmodel_ns")) {
				                    return "http://biomodels.net/model-qualifiers/";
								}
								else if (prefix.equals("bqbiol_ns")){
									return "http://biomodels.net/biology-qualifiers/";
								}
								else if (prefix.equals("sbml_ns")) {
									return "http://www.sbml.org/sbml/level2/version3";
								}
								else if (prefix.equals("xml")) {
									return XMLConstants.XML_NS_URI;
								}
								else {
									return XMLConstants.NULL_NS_URI;
								}
							}

							@Override
							public String getPrefix(String namespaceURI) {
								throw new UnsupportedOperationException("getPrefix() hasn't been implemented.");
							}

							@Override
							public Iterator getPrefixes(String namespaceURI) {
								throw new UnsupportedOperationException("getPrefixes() hasn't been implemented.");
							}	 
							
			        	};
			        	
			        	xPath.setNamespaceContext(ctx);

I can only get the results for the first expression, and not the second one.
In the second expression i want to get the quoted text below:

<rdf:li rdf:resource="urn:miriam:uniprot:P35567"/>
                <rdf:li rdf:resource="urn:miriam:uniprot:P24033"/>