cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorg Heymans ...@domek.be>
Subject Re: Question about my Transformer
Date Thu, 29 Jan 2004 13:21:48 GMT
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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message