Shiva,

have a quick look at http://www.xfront.com/DefaultNamespace.html to read
up about namespaces and their relation to the target name space. Somehow
 your XML Schema instance does not look right to me with regards to ..

a) setting the target namespace to http://www.fedex.com/fsmapi";, and at
the same time,
b) setting the XML Schema namespace to default namespace.

Can you try to restructure the definition of your schema element along
the lines of ...


<schema  xmlns="http://www.fedex.com/fsmapi";
         xmlns:xsd="http://www.w3.org/2001/XMLSchema";
         targetNameSpace="http://www.fedex.com/fsmapi";
         elementFormDefault="qualified"
         >

and prefix all schema artefacts with the xsd prefix ?

Are you using any XML editor like Spy that you could use to validate
your XML Schema ?

l4l
Werner

PS Having said that, I am by no means an XML expert, as my main focus is
with Castor JDO .. ;-)

Stephen Bash wrote:
> Shiva-
> 
> I'm not sure, but you may need to turn namespace processing on in
> castor.properties.  Unfortunately I don't remember the exact property
> off the top of my head, but I believe it exists and is commented out
> in the default properties file (check in the JAR file if no where
> else).
> 
> Stephen
> 
> 
> On 2/14/06, Shiva P. Kodityala <[EMAIL PROTECTED]> wrote:
>> I could not get this...
>>
>> XSD:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <schema
>>         xmlns="http://www.w3.org/2001/XMLSchema";
>>         xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>>         targetNameSpace="http://www.fedex.com/fsmapi";
>>         elementFormDefault="qualified"
>>         >
>>         <element name="TryRequest">
>>                 <complexType>
>>                         <sequence>
>>                                 <element name="TryHeader">
>>                                         <complexType>
>>                                                 <sequence>
>>                                                         <element 
>> name="CustomerTransactionIdentifier" type="string"/>
>>                                                         <element 
>> name="AccountNumber" type="integer"/>
>>                                                         <element 
>> name="MeterNumber" type="integer"/>
>>                                                         <element 
>> name="CarrierCode" type="string"/>
>>                                                 </sequence>
>>                                         </complexType>
>>                                 </element>
>>                         </sequence>
>>                         <attribute name="noNamespaceSchemaLocation" 
>> type="string"/>
>>                 </complexType>
>>         </element>
>> </schema>
>>
>> Generated the classes using  org.exolab.castor.builder.SourceGenerator.
>> When an instance of XML is created / marshalled, I am not getting 
>> targetNameSpace in it. For ex:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <TryRequest 
>> noNamespaceSchemaLocation="FDXShipRequest.xsd"><TryHeader><CustomerT
>> ransactionIdentifier>CTID</CustomerTransactionIdentifier><AccountNumber>4321</Ac
>> countNumber><MeterNumber>1234</MeterNumber><CarrierCode>FDXE</CarrierCode></TryH
>> eader></TryRequest>
>>
>>
>> I want to see "http://www.fedex.com/fsmapi"; in TryRequest tag.
>>
>>
>> Marshalling code:
>> TryRequest tryRequest = new TryRequest();
>>                 TryHeader tryHeader = new TryHeader();
>>                 tryHeader.setMeterNumber(1234);
>>                 tryHeader.setCustomerTransactionIdentifier("CTID");
>>                 tryHeader.setCarrierCode("FDXE");
>>                 tryHeader.setAccountNumber(4321);
>>                 tryRequest.setTryHeader(tryHeader);
>>                 
>> tryRequest.setNoNamespaceSchemaLocation("FDXShipRequest.xsd");
>>                 StringWriter stringWriter = new StringWriter();
>>                 tryRequest.marshal(stringWriter);
>>                 System.out.println(stringWriter.getBuffer().toString());
>>
>>
>>
>>
>>
>> Keith advised me to keep targetNameSpace in xsd. May be I am doing something 
>> wrong... Do I need to set it somewhere while marshalling?
>>
>> Thanks for any help.
>>
>>
>> -----Original Message-----
>> From: Shiva P. Kodityala [mailto:[EMAIL PROTECTED]
>> Sent: Friday, February 03, 2006 12:48 PM
>> To: [email protected]
>> Subject: RE: [castor-user] XSD generation
>>
>>
>> Hi Keith
>>
>> Could you help me giving a sample?  I have three attributes here.. 
>> xmlns:api, xmlns:xsi, xsi:noNamespaceSchemaLocation.
>>
>>
>> Thanks
>> Shiva.
>>
>>
>>
>>> <TryRequest xmlns:api="http://www.fedex.com/fsmapi"; 
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>> xsi:noNamespaceSchemaLocation="FDXRateRequest.xsd">
>> --
>> --
>>
>> -----Original Message-----
>> From:  Visco [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, February 02, 2006 10:01 PM
>> To: [email protected]
>> Subject: Re: [castor-user] XSD generation
>>
>>
>> If you set the targetNamespace in your schema you should see the
>> namespaces in the output.
>>
>> --Keith
>>
>> Shiva P. Kodityala wrote:
>>> My sample xml is as below:
>>>
>>> <TryRequest xmlns:api="http://www.fedex.com/fsmapi"; 
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>> xsi:noNamespaceSchemaLocation="FDXRateRequest.xsd">
>>> <TryHeader>
>>> <CustomerTransactionIdentifier>CTIString</CustomerTransactionIdentifier>
>>> <AccountNumber>123456789</AccountNumber>
>>> <MeterNumber>1234567</MeterNumber>
>>> <CarrierCode>FDXE</CarrierCode>
>>> </TryHeader>
>>> </Try>
>>>
>>> When I generated XSD:
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <schema xmlns="http://www.w3.org/2001/XMLSchema"; 
>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
>>> <element name="TryRequest">
>>>  <complexType>
>>>   <sequence>
>>>    <element name="TryHeader">
>>>     <complexType>
>>>      <sequence>
>>>       <element name="CustomerTransactionIdentifier1" 
>>> type="string"/><element name="AccountNumber1" type="integer"/>
>>>       <element name="MeterNumber1" type="integer"/>
>>>       <element name="CarrierCode1" type="string"/>
>>>      </sequence>
>>>     </complexType>
>>>    </element>
>>>   </sequence>
>>>   <attribute name="noNamespaceSchemaLocation" type="string"/>
>>>  </complexType>
>>> </element>
>>> </schema>
>>>
>>> Generated classes for this XSD and created an instance of the TryRequest 
>>> class and unmarshalled it to create XML string. In this XML: I do not see
>>> xmlns:api="http://www.fedex.com/fsmapi"; 
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>> in <TryRequest ...> tag.
>>>
>>> How can I get these strings( into the main tag as attributes..) 
>>> programmatically.
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> -------------------------------------------------
>>> If you wish to unsubscribe from this list, please
>>> send an empty message to the following address:
>>>
>>> [EMAIL PROTECTED]
>>> -------------------------------------------------
>>
>> -------------------------------------------------
>> If you wish to unsubscribe from this list, please
>> send an empty message to the following address:
>>
>> [EMAIL PROTECTED]
>> -------------------------------------------------
>>
>>
>> -------------------------------------------------
>> If you wish to unsubscribe from this list, please
>> send an empty message to the following address:
>>
>> [EMAIL PROTECTED]
>> -------------------------------------------------
>>
>>
>> -------------------------------------------------
>> If you wish to unsubscribe from this list, please
>> send an empty message to the following address:
>>
>> [EMAIL PROTECTED]
>> -------------------------------------------------
>>
>>


-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to