* This is a complete URL to be written inside <Adress> element of the EPR,
* such as "http://foo.bar/abc/def"
*/
public @NotNull WSEndpointReference createWithAddress(@NotNull final String newAddress) {
MutableXMLStreamBuffer xsb = new MutableXMLStreamBuffer();
XMLFilterImpl filter = new XMLFilterImpl() {
private boolean inAddress = false;
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
if(localName.equals("Address") && uri.equals(version.nsUri))
inAddress = true;
super.startElement(uri,localName,qName,atts);
}
public void characters(char ch[], int start, int length) throws SAXException {
if(!inAddress)
super.characters(ch, start, length);
}
public void endElement(String uri, String localName, String qName) throws SAXException {
if(inAddress)
super.characters(newAddress.toCharArray(),0,newAddress.length());
inAddress = false;
super.endElement(uri, localName, qName);
}
};
filter.setContentHandler(xsb.createFromSAXBufferCreator());
try {
infoset.writeTo(filter,false);
} catch (SAXException e) {
throw new AssertionError(e); // impossible since we are writing from XSB to XSB.
}