Hi, On 09.03.2011 18:01, rag007 wrote: > > Thanks for your reply. > > This is the sample xml i need to generate > > <?xml version="1.0" encoding="UTF-8"?> > <abc:RootDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xyz="http://www.demo.com/ICT/XML/Student/General" > xmlns:abc="http://www.demo.com/ICT/XML/Student/ABC" > xmlns="http://www.demo.com/Student/ABC" > xsi:schemaLocation="http://www.demo.com/ICT/XML/Student/General sample1.xsd > http://www.demo.com/ICT/XML/Student/ABC sample2.xsd"> > <xyz:header> > <xyz:school> > <xyz:schoolid>123</gen:schoolid> > <xyz:schoolname>ABCDD</gen:schoolname> > </xyz:school> > </xyz:header> > <abc:footer> > <abc:result abc:studNr="999"> > <abc:studType>GHJJ</scp:studType> > </abc:result> > </abc:footer> > </abc:RootDocument> > > > But, Through castor i am getting XML like this > > <?xml version="1.0" encoding="UTF-8"?> > <RootDocument xmlns="http://www.demo.com/ICT/XML/Student/ABC"> > <ns1:header xmlns:ns1="http://www.demo.com/ICT/XML/Student/General"> > <ns1:school> > <ns1:schoolid>123</ns1:schoolid> > <ns1:schoolname>ABCDD</ns1:schoolname> > </ns1:school> > </ns1:header> > <footer> > <result xmlns:ns2="http://www.demo.com/ICT/XML/Student/ABC" > ns2:studNr="999"> > <ns2:studType>GHJJ</ns2:studType> > </result> > </footer> > </RootDocument> > > > Please clarify this. I am little confused. I want to know whether both xml > is same or not? Technically speaking, namespace prefixes are not really relevant in an XML document instance. But if you really, really need to use a particular namespace prefix, please have a look at the
Marshaller.setNamespaceMapping() method, which allows you to assign your own (custom) namepace prefixes to given namespaces. Regards Werner > > How to give custom prefix in the XML element? > > Thanks in Advance. > > > > > > > > > Werner Guttmann-6 wrote: >> >> Hi, >> >> On 09.03.2011 17:12, rag007 wrote: >>> >>> Hi All, >>> >>> I am using castor in myapplication. I am new to this. I have one doubt >>> please clarify as soon as possible. >>> >>> I have one xsd file through that i generated java files. Not an issue. >>> Its >>> ok for me. My question, is it possible to get mapping file along with >>> that? >> Why would you need a mapping file at all when you generate Java sources >> from an XML schema. During code generation, Castor generates Java POJOs >> AND descriptor classes, which are an optimized (internal) representation >> of the XML to object mapping. >> >>> I used gen-mapping command but its not working for me. I am using castor >>> 1.3. Because I need to use custom namespace prefix in my xml. >> Where's the issue. If your XML schema has correct namespace definitions, >> Castor will use the right namespace URIs/prefixes for your XML. >>> >>> Kindly help me asap. >>> >>> Thanks in advance. >> Kind Regards >> Werner Guttmann >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> >> >> > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

