Quoting your XML schema:
<xsd:element name="FILTERS">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" ref="FILTER"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
As there's no minOccurs defined on the element definition of 'FILTER',
at least one FILTER element has to be available in your XML document
instance, if you want to comply to this XML schema.
Regards
Werner
TGD wrote:
> I'm using Castor 1.2.
>
> The problem is, that when no sub elements (NAME, VALUE and OPERATOR) exist
> in "FILTER" element, then element "FILTER" is still present in xml file.
> Example how it looks like is below.
>
> My question is, how can I avoid empty elements? Should I change .xsd file?
>
> <FILTERS>
> <FILTER />
> </FILTERS>
>
> XSD schema:
> http://www.nabble.com/file/p19156692/FILTER.xsd FILTER.xsd
>
>
>
> Joachim Grüneis wrote:
>> Hello,
>>
>> you give no information what are you doing and how you do it... but
>> expect us to help.
>> From your mail I cannot be sure if you even use Castor.
>>
>> Please provide information about which Java classes you intend to map
>> to XML. How this mapping is configured. If the code has been
>> generated. If you have an XSD. And more such information - and then we
>> might be able to help you.
>>
>> And just from the viewpoint of XML: an empty XML element is totally valid.
>>
>> Regards
>> Joachim
>>
>> 2008/8/25 TGD <[EMAIL PROTECTED]>:
>>> Hi!
>>>
>>> I have a huge problem with empty elements.
>>>
>>> 1) Next example is ok - 'subelement' is NOT empty and 'element' is
>>> created:
>>> <root>
>>> <element>
>>> <subelement>hello</subelement>
>>> </element>
>>> </root>
>>>
>>> 2) Next example is not ok - 'subelement' IS empty and 'element' is still
>>> present which is not ok:
>>> <root>
>>> <element />
>>> </root>
>>>
>>> How can I avoid empty element 'element' in example no. 2?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Empty-subelements-in-xml-tp19142960p19142960.html
>>> Sent from the Castor - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email