commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Goodwin <mgood...@metalexis.com>
Subject Re: betwixt and namespace
Date Thu, 18 Nov 2004 23:12:27 GMT
Thanks for the quick response. I looked at your PersonWithNamespaces 
example (wish I had done that before I posted).  I wasn't using betwixt 
files and was just using bean introspection, but I am going to use a 
betwixt file now.  Thanks!!!!  Good night.

Matt


robert burrell donkin wrote:

> 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  
> prefix.
>
> 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","http://tempuri.org/segHedge.xsd");
>> beanWriter.getXMLIntrospector().getConfiguration().setPrefixMapper(name 
>> spaceMapper);
>>       Thanks,
>>
>> Matt
>>
>> -- 
>> Matt Goodwin
>> mgoodwin@metalexis.com
>> (515)708-0114
>> Metalexis
>> "Transcending the Ordinary"
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>

-- 
Matt Goodwin
mgoodwin@metalexis.com
(515)708-0114
Metalexis
"Transcending the Ordinary"


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message