Hi Serge, > 1. My input XML file contains the next string: <!DOCTYPE MerchantRequest > SYSTEM "MerchantRequest.dtd"> > I use Castor 0.9.4.1 XML with xerces.jar. The Unmarchaller looks for DTD > file at the "user.dir" directory only, otherwise it throws > java.io.FileNotFoundException. (The last xerces 1.4.4 version does not find > MerchantRequest.dtd even at "user.dir"). How can I set search path or add an > additional path to look for?
You have to implement your own Sax EntityResolver (http://www.saxproject.org/apidoc/org/xml/sax/EntityResolver.html) and pass it to the Unmarshall using the setEntityResolver method. > > 2. I use mapping file generated by org.exolab.castor.tools.MappingTool for > existing objects. The file contains string: > <mapping xmlns="http://castor.exolab.org/" > xmlns:cst="http://castor.exolab.org/"> > > After marshalling I get the next output file: > > <?xml version="1.0" encoding="UTF-8"?> > <MerchantResponse ns1:version="1.0" xmlns:ns1="http://castor.exolab.org/"> > <ns1:Merchant ns1:name="NoName AG" ns1:id="1234567"/> > <ns1:Result ns1:lang="en" ns1:text="blablabla" ns1:code="20733"/> > </MerchantResponse> > > The question is how can I output <!DOCTYPE MerchantRequest SYSTEM > "MerchantResponse.dtd"> instead of xmlns and how can I not output ns1 > prefixes? To set the DTD declaration you'll have to use Marshaller#setProcessingInstruction And to remove the ouput of ns1, you can declare the namespace used as the default namespace by doing: Marshaller myMarshaller = new Marshaller(....); myMarshaller.setNamespaceMapping("", "http://castor.exolab.org"); > > 3. Can I set printing "\n" after each output XML string? In the castor.properties file, set the indent property to true Hope that helps, Arnaud ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
