Is there any particular reason why you want to implement this as a transformer? A stylesheet seems to be easier in this case IMHO.

If you extend abstractdomtransformer you have access to the Document instance, but i don't know if that makes your problem any easier.

Jorg

Han Jon Theus wrote:

Hello

I just implemented a simple transformer with the start method below:

public void startElement(String namespaceURI, String localName, String qualifiedName, Attributes attributes)
throws SAXException {

String newLocalName = localName;
String newQualifiedName = qualifiedName;

//System.out.println(localName);

if (localName.equals(ELEMENT_ADDRESS)) {
newLocalName = "nickname";
String[] parts = qualifiedName.split(":");

if (parts.length == 2) {
newQualifiedName = parts[0] + ":" + newLocalName;
}
else
{
newQualifiedName = newLocalName;
}

}

super.startElement(namespaceURI, newLocalName, newQualifiedName, attributes);
}


The transformer changes the local name "firstname" into "nickname". I would like to extend this transformer: it should be able to rename all xml tags. do i have to program a loop? do i have to implement multiple startElement()-methodes ?

Thx for you help

Han J. Theus-Student

        


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to