When generating serialized XML output both <xx></xx> and the minimized form
<xx/> are technically acceptable.  Different processors (i.e. serializers)
may do different things.

In the case of Xalan-J, depending on the version, you may find that a text
node with no characters may, and I say "may", cause the non-minimized form.

For example:
ch.StartElement("","xx","xx",atts);
ch.characters(new ch[] { }, 0,0);   // might cause it to think that the
element xx is not empty and close the start tag
ch.endElement("","xx","xx");

Even if this works, in the long run you can't count on this. Xalan-J won't
consider generating the minimized form, or not generating the minimized
form, a bug in XML serialization.


- Brian



                                                                           
             David Bertoni                                                 
             <[EMAIL PROTECTED]                                             
             org>                                                       To 
                                       "'Xalan J Users List'"              
             12/19/2007 06:43          <xalan-j-users@xml.apache.org>      
             PM                                                         cc 
                                                                           
                                                                   Subject 
                                       Re: closed tags                     
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




ra wrote:
>
> David Bertoni wrote:
>> ra wrote:
>>> How to force xalan to not closing tags, I mean I've for example tag
>>>  and after transformation it's changed to  , it's not desired behaviour
>>> for
>>> me
>> Well, it looks like something along the way has stripped the sample
markup
>> from your post, so I'm going to have to guess what you're asking for.
>>
>> Xalan-J's XML serialization method can only generate well-formed markup,
>> so
>> you cannot generate unclosed tags, without resorting to hacks like
>> disable-output-escaping.
>>
>> You'll have to post-process the serialized XML to remove whatever
closing
>> tags you don't want.
>>
>> Dave
>>
>>
>
>
> Here is a sample, it should be visible
> <xx></xx> is change to <xx/>
> I belive both samples are well-formed but only first one is accepted for
> example if instead of xx we put a (like anchor link)
OK, so you meant an empty tag, not an unclosed tag.  The two forms are
considered identical in XML, so there's no way to tell the serializer to
use one or the other.  It sounds like you really need to generate XHTML for

a broken browser, and that's tricky to do without a custom output method.

Dave


Reply via email to