Women in Technology

Hear us Roar



Article:
  Parsing an XML Document with XPath
Subject:   Parsing a Namespace node with JDK 5.0
Date:   2005-01-14 08:56:42
From:   dvohra09
Response to: Parsing a Namespace node with JDK 5.0

XPath xpath;
NamespaceContext namepsaceContext=new NamespaceContextImpl(prefix, uri);
xpath.setNamespaceContext(namespaceContext);



public class NamespaceContextImpl implements NamespaceContext{
public String uri;
public String prefix;
public NamespaceContextImpl(){}
public NamespaceContextImpl(String prefix, String uri){
this.uri=uri;
this.prefix=prefix;
}
public String getNamespaceURI(String prefix){
return uri;
}
public void setNamespaceURI(String uri){
this.uri=uri;
}
public String getPrefix(String uri){
return prefix;
}
public void setPrefix(String prefix){
this.prefix=prefix;
}
public Iterator getPrefixes(String uri){return null;}
}