commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <>
Subject Re: betwixt and namespace
Date Thu, 18 Nov 2004 22:57:29 GMT
hi matt

i've very sorry to say that i can't remember right now and i can't find  
an example in the document!

i'm probably not going to find time (before i head off to bed) to find  
out how (in detail) to make namespaces work and write up an example for  
the documentation (or fix up what's left to do if support isn't  
finished yet). however, i do recommend taking a look at the source for  
org.apache.commons.betwixt.schema - this package contains an  
(experimental) w3c schema generator which produces namespace aware  
output. setting uri attributes for element tags in the betwixt files  
should do it. there should be a way to coursely set namespaces (but i'm  
not sure if this is in as yet).

if you're using a DTD then you'll need to set an appropriate  
NamespacePrefixMapper so that your uri can be converted to a suitable  

hope this helps

- robert

On 18 Nov 2004, at 22:34, Matt Goodwin wrote:

> I have an object and I am trying to output as xml.  That part is  
> working fine, but I need to put a namespace on the elements.  How is  
> the namespace set?  I am using the following code.  In my startElement  
> method in my ContentHandler, the namespaceURI is "".  What am I doing  
> wrong?
> HardErrorContentHandler beanHandler =  
> HardErrorContentHandlerFactory.getInstance(obj);
> beanHandler.setPrettyPrint(prettyPrint);
> SAXBeanWriter beanWriter = new SAXBeanWriter(beanHandler);
>  if(capitalize) {
> beanWriter.getXMLIntrospector().getConfiguration().setElementNameMapper 
> (new CapitalizeNameMapper());
>  }
> // set namespace
> NamespacePrefixMapper namespaceMapper = new NamespacePrefixMapper();
> namespaceMapper.setPrefix("xmlns","");
> beanWriter.getXMLIntrospector().getConfiguration().setPrefixMapper(name 
> spaceMapper);
>       Thanks,
> Matt
> -- 
> Matt Goodwin
> (515)708-0114
> Metalexis
> "Transcending the Ordinary"
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message