"Koerdt, Monika" wrote:
>
> I'm using the following schema to generate the classes:RetrieveData and
> Function
>
> <?xml version="1.0" encoding="utf-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
> <xs:element name="RetrieveData">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="messageID" type="xs:string"/>
> <xs:element name="interfaceName" type="xs:string"/>
> <xs:element name="function">
> <xs:complexType>
> <xs:attribute name="value" type="xs:string">
> </xs:attribute>
> </xs:complexType>
> </xs:element>
> <xs:element name="accountNumber" type="xs:string"/>
> <xs:element name="userID" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>
>
> When call marshal, the code generates the following XML:
>
> <?xml version="1.0"?>
> <RetrieveData>
> <messageID>message1234</messageID>
> <interfaceName>interface1234</interfaceName>
> <function value="AA"/>
> <accountNumber>XXX</cisAccountNumber>
> <userID>monika1234</userID>
> </RetrieveData>
>
The output is valid...
> Is there any way to generate the XML having the closing tag for the element
> that contains the attribute in the following way?
>
> <?xml version="1.0"?>
> <RetrieveData>
> <messageID>message1234</messageID>
> <interfaceName>interface1234</interfaceName>
> <function value="AA"></function>
> <accountNumber>XXX</cisAccountNumber>
> <userID>monika1234</userID>
> </RetrieveData>
>
No...<function value="AA"/> is valid and equivalent to <function
value="AA"></function>
The first is simply short-hand for the second. We use Xerces Serializers
for handing the output of the XML...and they use the "empty-element
short-hand" approach.
THe only way to get it to output the end-tag and not use the short-hand
is by having content, either elements or text inside the element.
Thanks,
--Keith
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev