* * *

Eclipse java doc XML not properly displayed

58 Views Asked by At

I have following passage in my java doc:

 * <pre>
 * {@code
 * <?xml version="1.0" encoding="UTF-8"?>
 * <beans xmlns="http://www.springframework.org/schema/beans"
 *  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 *  xmlns:context="http://www.springframework.org/schema/context"
 *  xmlns:task="http://www.springframework.org/schema/task"
 *  xmlns:tx="http://www.springframework.org/schema/tx"
 *  xsi:schemaLocation="http://www.springframework.org/schema/beans 
 *             http://www.springframework.org/schema/beans/spring-beans.xsd
 *             http://www.springframework.org/schema/context
 *      http://www.springframework.org/schema/context/spring-context.xsd
 *      http://www.springframework.org/schema/tx  http://www.springframework.org/schema/tx/spring-tx.xsd
 *      http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">
 * 
 *  <bean class="path.to.job.Class"
 *      id="jobBeanName" parent="baseJob">
 *      <!-- PROPERTIES OMITTED -->
 *  </bean>
 * 
 *  <task:scheduled-tasks scheduler="scheduler">
 *      <task:scheduled ref="jobBeanName" method="execute"
 *          cron="${cron_expression}" />
 *  </task:scheduled-tasks>
 * 
 * </beans>
 * }
 * </pre>

This part should illustrate a quick guide on how a new definition should be done. Yet, for some reason, the "translation" is not complete.

This is what it results to:

 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:task="http://www.springframework.org/schema/task"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
               http://www.springframework.org/schema/beans/spring-beans.xsd
               http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/tx  http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">

    <bean class="path.to.job.Class"
        id="jobBeanName" parent="baseJob">
        <!-- PROPERTIES OMITTED -->
    </bean>

    <task:scheduled-tasks scheduler="scheduler">
        <task:scheduled ref="jobBeanName" method="execute"
            cron="${cron_expression}" />



 }

It is missing these parts:

    </task:scheduled-tasks>
</beans>

And includes } which is part of {@code }.

The only way to make them visible, is by adding a space after < on both elements. Though this space is then also visible in the docs which makes it very ugly.


I checked following links:


Actually I just found a way which was replacing < with &lt; for the parts that were not displayed. Though that doesn't explain why it sometimes does work and sometimes it doesn't. Also, I am still having the fragment (}) of the {@code } part that is displayed as well.

So the question is, how should one format XML in JAVADOC without the need for "hacks" like &lt; and having fragments that are no supposed to be shown?

0

There are 0 best solutions below