提交 f4b4f28f 编写于 作者: T Thomas Risberg

added language element to programlisting for syntax highlighting

上级 b7ab939d
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
Spring abstracts all marshalling operations behind the Spring abstracts all marshalling operations behind the
<interfacename>org.springframework.oxm.Marshaller</interfacename> interface, the main methods of which <interfacename>org.springframework.oxm.Marshaller</interfacename> interface, the main methods of which
is listed below. is listed below.
<programlisting><![CDATA[ <programlisting language="java"><![CDATA[
public interface Marshaller { public interface Marshaller {
/** /**
...@@ -115,7 +115,7 @@ public interface Marshaller { ...@@ -115,7 +115,7 @@ public interface Marshaller {
<para> <para>
Similar to the <interfacename>Marshaller</interfacename>, there is the Similar to the <interfacename>Marshaller</interfacename>, there is the
<interfacename>org.springframework.oxm.Unmarshaller</interfacename> interface. <interfacename>org.springframework.oxm.Unmarshaller</interfacename> interface.
<programlisting><![CDATA[ <programlisting language="java"><![CDATA[
public interface Unmarshaller { public interface Unmarshaller {
/** /**
...@@ -205,7 +205,7 @@ public interface Unmarshaller { ...@@ -205,7 +205,7 @@ public interface Unmarshaller {
Spring's OXM can be used for a wide variety of situations. In the following example, we will use it to Spring's OXM can be used for a wide variety of situations. In the following example, we will use it to
marshal the settings of a Spring-managed application as an XML file. We will use a simple JavaBean to marshal the settings of a Spring-managed application as an XML file. We will use a simple JavaBean to
represent the settings: represent the settings:
<programlisting><![CDATA[ <programlisting language="java"><![CDATA[
public class Settings { public class Settings {
private boolean fooEnabled; private boolean fooEnabled;
...@@ -223,7 +223,7 @@ public class Settings { ...@@ -223,7 +223,7 @@ public class Settings {
methods: <methodname>saveSettings</methodname> saves the settings bean to a file named methods: <methodname>saveSettings</methodname> saves the settings bean to a file named
<filename>settings.xml</filename>, and <methodname>loadSettings</methodname> loads these settings again. A <filename>settings.xml</filename>, and <methodname>loadSettings</methodname> loads these settings again. A
<methodname>main</methodname> method constructs a Spring application context, and calls these two methods. <methodname>main</methodname> method constructs a Spring application context, and calls these two methods.
<programlisting><![CDATA[ <programlisting language="java"><![CDATA[
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
...@@ -284,7 +284,7 @@ public class Application { ...@@ -284,7 +284,7 @@ public class Application {
The <classname>Application</classname> requires both a <property>marshaller</property> The <classname>Application</classname> requires both a <property>marshaller</property>
and <property>unmarshaller</property> property to be set. We can do so using the following and <property>unmarshaller</property> property to be set. We can do so using the following
<filename>applicationContext.xml</filename>: <filename>applicationContext.xml</filename>:
<programlisting><![CDATA[ <programlisting language="xml"><![CDATA[
<beans> <beans>
<bean id="application" class="Application"> <bean id="application" class="Application">
<property name="marshaller" ref="castorMarshaller" /> <property name="marshaller" ref="castorMarshaller" />
...@@ -302,7 +302,7 @@ public class Application { ...@@ -302,7 +302,7 @@ public class Application {
</para> </para>
<para> <para>
This sample application produces the following <filename>settings.xml</filename> file: This sample application produces the following <filename>settings.xml</filename> file:
<programlisting><![CDATA[ <programlisting language="xml"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<settings foo-enabled="false"/> <settings foo-enabled="false"/>
]]></programlisting> ]]></programlisting>
...@@ -315,7 +315,7 @@ public class Application { ...@@ -315,7 +315,7 @@ public class Application {
To make these tags available, the appropriate schema has to be referenced first in the preamble of the XML configuration file. To make these tags available, the appropriate schema has to be referenced first in the preamble of the XML configuration file.
The emboldened text in the below snippet references the OXM schema: The emboldened text in the below snippet references the OXM schema:
</para> </para>
<programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?> <programlisting language="xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
]]><emphasis role="bold"><![CDATA[xmlns:oxm="http://www.springframework.org/schema/oxm"]]></emphasis> ]]><emphasis role="bold"><![CDATA[xmlns:oxm="http://www.springframework.org/schema/oxm"]]></emphasis>
...@@ -342,7 +342,7 @@ public class Application { ...@@ -342,7 +342,7 @@ public class Application {
Each tag will be explained in its respective marshaller's section. As an example though, here is how Each tag will be explained in its respective marshaller's section. As an example though, here is how
the configuration of a JAXB2 marshaller might look like: the configuration of a JAXB2 marshaller might look like:
</para> </para>
<programlisting><![CDATA[<oxm:jaxb2-marshaller id="marshaller" contextPath="org.springframework.ws.samples.airline.schema"/>]]></programlisting> <programlisting language="xml"><![CDATA[<oxm:jaxb2-marshaller id="marshaller" contextPath="org.springframework.ws.samples.airline.schema"/>]]></programlisting>
</section> </section>
<section id="oxm-jaxb"> <section id="oxm-jaxb">
<title>JAXB</title> <title>JAXB</title>
...@@ -368,7 +368,7 @@ public class Application { ...@@ -368,7 +368,7 @@ public class Application {
classes to be supported by the marshaller. Schema validation is performed by specifying one or more classes to be supported by the marshaller. Schema validation is performed by specifying one or more
schema resource to the bean, like so: schema resource to the bean, like so:
</para> </para>
<programlisting><![CDATA[ <programlisting language="xml"><![CDATA[
<beans> <beans>
<bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
...@@ -389,11 +389,11 @@ public class Application { ...@@ -389,11 +389,11 @@ public class Application {
The <literal>jaxb2-marshaller</literal> tag configures a <classname>org.springframework.oxm.jaxb.Jaxb2Marshaller</classname>. The <literal>jaxb2-marshaller</literal> tag configures a <classname>org.springframework.oxm.jaxb.Jaxb2Marshaller</classname>.
Here is an example: Here is an example:
</para> </para>
<programlisting><![CDATA[<oxm:jaxb2-marshaller id="marshaller" contextPath="org.springframework.ws.samples.airline.schema"/>]]></programlisting> <programlisting language="xml"><![CDATA[<oxm:jaxb2-marshaller id="marshaller" contextPath="org.springframework.ws.samples.airline.schema"/>]]></programlisting>
<para> <para>
Alternatively, the list of classes to bind can be provided to the marshaller via the <literal>class-to-be-bound</literal> child tag: Alternatively, the list of classes to bind can be provided to the marshaller via the <literal>class-to-be-bound</literal> child tag:
</para> </para>
<programlisting><![CDATA[<oxm:jaxb2-marshaller id="marshaller"> <programlisting language="xml"><![CDATA[<oxm:jaxb2-marshaller id="marshaller">
<oxm:class-to-be-bound name="org.springframework.ws.samples.airline.schema.Airport"/> <oxm:class-to-be-bound name="org.springframework.ws.samples.airline.schema.Airport"/>
<oxm:class-to-be-bound name="org.springframework.ws.samples.airline.schema.Flight"/> <oxm:class-to-be-bound name="org.springframework.ws.samples.airline.schema.Flight"/>
... ...
...@@ -450,7 +450,7 @@ public class Application { ...@@ -450,7 +450,7 @@ public class Application {
<interfacename>Marshaller</interfacename> and <interfacename>Unmarshaller</interfacename> interface. <interfacename>Marshaller</interfacename> and <interfacename>Unmarshaller</interfacename> interface.
It can be wired up as follows: It can be wired up as follows:
</para> </para>
<programlisting><![CDATA[ <programlisting language="xml"><![CDATA[
<beans> <beans>
<bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller" /> <bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller" />
...@@ -469,7 +469,7 @@ public class Application { ...@@ -469,7 +469,7 @@ public class Application {
The mapping can be set using the <property>mappingLocation</property> resource property, indicated The mapping can be set using the <property>mappingLocation</property> resource property, indicated
below with a classpath resource. below with a classpath resource.
</para> </para>
<programlisting><![CDATA[ <programlisting language="xml"><![CDATA[
<beans> <beans>
<bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller" > <bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller" >
<property name="mappingLocation" value="classpath:mapping.xml" /> <property name="mappingLocation" value="classpath:mapping.xml" />
...@@ -500,7 +500,7 @@ public class Application { ...@@ -500,7 +500,7 @@ public class Application {
and <interfacename>Unmarshaller</interfacename> and <interfacename>Unmarshaller</interfacename>
interfaces. It can be configured as follows: interfaces. It can be configured as follows:
</para> </para>
<programlisting><![CDATA[ <programlisting language="xml"><![CDATA[
<beans> <beans>
<bean id="xmlBeansMarshaller" class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller" /> <bean id="xmlBeansMarshaller" class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller" />
...@@ -520,7 +520,7 @@ public class Application { ...@@ -520,7 +520,7 @@ public class Application {
The <literal>xmlbeans-marshaller</literal> tag configures a <classname>org.springframework.oxm.xmlbeans.XmlBeansMarshaller</classname>. The <literal>xmlbeans-marshaller</literal> tag configures a <classname>org.springframework.oxm.xmlbeans.XmlBeansMarshaller</classname>.
Here is an example: Here is an example:
</para> </para>
<programlisting><![CDATA[<oxm:xmlbeans-marshaller id="marshaller"/>]]></programlisting> <programlisting language="xml"><![CDATA[<oxm:xmlbeans-marshaller id="marshaller"/>]]></programlisting>
<para> <para>
Available attributes are: Available attributes are:
<informaltable> <informaltable>
...@@ -580,7 +580,7 @@ public class Application { ...@@ -580,7 +580,7 @@ public class Application {
<property>bindingName</property> property. In the next sample, we bind the <property>bindingName</property> property. In the next sample, we bind the
<classname>Flights</classname> class: <classname>Flights</classname> class:
</para> </para>
<programlisting><![CDATA[ <programlisting language="xml"><![CDATA[
<beans> <beans>
<bean id="jibxFlightsMarshaller" class="org.springframework.oxm.jibx.JibxMarshaller"> <bean id="jibxFlightsMarshaller" class="org.springframework.oxm.jibx.JibxMarshaller">
...@@ -600,7 +600,7 @@ public class Application { ...@@ -600,7 +600,7 @@ public class Application {
The <literal>jibx-marshaller</literal> tag configures a <classname>org.springframework.oxm.jibx.JibxMarshaller</classname>. The <literal>jibx-marshaller</literal> tag configures a <classname>org.springframework.oxm.jibx.JibxMarshaller</classname>.
Here is an example: Here is an example:
</para> </para>
<programlisting><![CDATA[<oxm:jibx-marshaller id="marshaller" target-class="org.springframework.ws.samples.airline.schema.Flight"/>]]></programlisting> <programlisting language="xml"><![CDATA[<oxm:jibx-marshaller id="marshaller" target-class="org.springframework.ws.samples.airline.schema.Flight"/>]]></programlisting>
<para> <para>
Available attributes are: Available attributes are:
<informaltable> <informaltable>
...@@ -656,7 +656,7 @@ public class Application { ...@@ -656,7 +656,7 @@ public class Application {
in an application context directly. To further customize the XML, you can set an in an application context directly. To further customize the XML, you can set an
<emphasis>alias map</emphasis>, which consists of string aliases mapped to classes: <emphasis>alias map</emphasis>, which consists of string aliases mapped to classes:
</para> </para>
<programlisting><![CDATA[ <programlisting language="xml"><![CDATA[
<beans> <beans>
<bean id="xstreamMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller"> <bean id="xstreamMarshaller" class="org.springframework.oxm.xstream.XStreamMarshaller">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册