Jump to: navigation, search

Difference between revisions of "EclipseLink/Release/2.4.0/JAXB RI Extensions"

Line 13: Line 13:
 
==Object Identitity Cycle Detection==
 
==Object Identitity Cycle Detection==
  
Usage: marshaller.setProperty("com.sun.xml.bind.objectIdentitityCycleDetection", false);
+
Usage: <code>marshaller.setProperty("com.sun.xml.bind.objectIdentitityCycleDetection", false);</code>
  
 
Used to configure the strategy EclipseLink will use to detect an Object cycle. By default, EclipseLink will use Object identity to determine if a cycle exists; setting this property to false will tell EclipseLink to use the equals() method instead.
 
Used to configure the strategy EclipseLink will use to detect an Object cycle. By default, EclipseLink will use Object identity to determine if a cycle exists; setting this property to false will tell EclipseLink to use the equals() method instead.
Line 20: Line 20:
 
==XML Declaration==
 
==XML Declaration==
  
Usage: marshaller.setProperty("com.sun.xml.bind.xmlDeclaration", true);
+
Usage: <code>marshaller.setProperty("com.sun.xml.bind.xmlDeclaration", true);</code>
  
 
Allows the user to omit the XML processing instruction from marshalled documens.  This property is the opposite of Marshaller.JAXB_FRAGMENT, and is included for backwards compatibility only.
 
Allows the user to omit the XML processing instruction from marshalled documens.  This property is the opposite of Marshaller.JAXB_FRAGMENT, and is included for backwards compatibility only.
Line 27: Line 27:
 
==XML Headers==
 
==XML Headers==
  
Usage: marshaller.setProperty("com.sun.xml.bind.xmlHeaders", headerString);
+
Usage: <code>marshaller.setProperty("com.sun.xml.bind.xmlHeaders", headerString);</code>
  
 
Allows the user to supply a header string, which  will appear after the XML processing instruction (&lt;?xml ...&gt;), but before the start of the document's data.
 
Allows the user to supply a header string, which  will appear after the XML processing instruction (&lt;?xml ...&gt;), but before the start of the document's data.
Line 34: Line 34:
 
==Indent String==
 
==Indent String==
  
Usage: marshaller.setProperty("com.sun.xml.bind.indentString", indentString);
+
Usage: <code>marshaller.setProperty("com.sun.xml.bind.indentString", indentString);</code>
       marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.INDENT_STRING, indentString);
+
       <code>marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.INDENT_STRING, indentString);</code>
  
 
Allows the user to override the indent string that is used when marshalling objects.
 
Allows the user to override the indent string that is used when marshalling objects.
Line 41: Line 41:
 
==Character Escape Handler==
 
==Character Escape Handler==
  
Usage: marshaller.setProperty("com.sun.xml.bind.marshaller.CharacterEscapeHandler", new MyCharacterEscapeHandler());
+
Usage: <code>marshaller.setProperty("com.sun.xml.bind.marshaller.CharacterEscapeHandler", new MyCharacterEscapeHandler());</code>
       marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.CHARACTER_ESCAPE_HANDLER, new MyCharacterEscapeHandler());
+
       <code>marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.CHARACTER_ESCAPE_HANDLER, new MyCharacterEscapeHandler());</code>
  
 
Allows the user to provide their own character-escaping logic by supplying their own implementation of the CharacterEscapeHandler interface.
 
Allows the user to provide their own character-escaping logic by supplying their own implementation of the CharacterEscapeHandler interface.
Line 54: Line 54:
 
==ID Resolver==
 
==ID Resolver==
  
Usage: unmarshaller.setProperty("com.sun.xml.bind.IDResolver", new MyIdResolver());
+
Usage: <code>unmarshaller.setProperty("com.sun.xml.bind.IDResolver", new MyIdResolver());</code>
       unmarshaller.setProperty(org.eclipse.persistence.jaxb.UnmarshallerProperties.ID_RESOLVER, new MyIdResolver());
+
       <code>unmarshaller.setProperty(org.eclipse.persistence.jaxb.UnmarshallerProperties.ID_RESOLVER, new MyIdResolver());</code>
  
 
Allows the user to provide their own logic for resolving XML IDs/IDREFs.
 
Allows the user to provide their own logic for resolving XML IDs/IDREFs.
  
 
See: http://wiki.eclipse.org/EclipseLink/Development/360249
 
See: http://wiki.eclipse.org/EclipseLink/Development/360249
 +
  
 
==XML Location==
 
==XML Location==
  
Usage: Annotate a property with @XmlLocation
+
Usage: <code>Annotate a property with @XmlLocation</code>
  
 
Allows the user to specify a property on the JAXB object that will be updated (upon unmarshalling) with that object's XML location information (i.e. the line number, column number, and system ID that points to this object's location in the XML input).
 
Allows the user to specify a property on the JAXB object that will be updated (upon unmarshalling) with that object's XML location information (i.e. the line number, column number, and system ID that points to this object's location in the XML input).
  
 
See: http://wiki.eclipse.org/EclipseLink/Development/355766
 
See: http://wiki.eclipse.org/EclipseLink/Development/355766

Revision as of 10:14, 4 June 2012

Marshaller Features

Cycle Recoverable

Usage: Implement the com.sun.xml.bind.CycleRecoverable interface

Allows the user to write their own logic to be used when object cycles are detected during marshal operations.

See: http://wiki.eclipse.org/EclipseLink/Development/372404


Object Identitity Cycle Detection

Usage: marshaller.setProperty("com.sun.xml.bind.objectIdentitityCycleDetection", false);

Used to configure the strategy EclipseLink will use to detect an Object cycle. By default, EclipseLink will use Object identity to determine if a cycle exists; setting this property to false will tell EclipseLink to use the equals() method instead.


XML Declaration

Usage: marshaller.setProperty("com.sun.xml.bind.xmlDeclaration", true);

Allows the user to omit the XML processing instruction from marshalled documens. This property is the opposite of Marshaller.JAXB_FRAGMENT, and is included for backwards compatibility only.


XML Headers

Usage: marshaller.setProperty("com.sun.xml.bind.xmlHeaders", headerString);

Allows the user to supply a header string, which will appear after the XML processing instruction (<?xml ...>), but before the start of the document's data.


Indent String

Usage: marshaller.setProperty("com.sun.xml.bind.indentString", indentString);

      marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.INDENT_STRING, indentString);

Allows the user to override the indent string that is used when marshalling objects.

Character Escape Handler

Usage: marshaller.setProperty("com.sun.xml.bind.marshaller.CharacterEscapeHandler", new MyCharacterEscapeHandler());

      marshaller.setProperty(org.eclipse.persistence.jaxb.MarshallerProperties.CHARACTER_ESCAPE_HANDLER, new MyCharacterEscapeHandler());

Allows the user to provide their own character-escaping logic by supplying their own implementation of the CharacterEscapeHandler interface.

See: http://wiki.eclipse.org/EclipseLink/Development/370589


Unmarshaller Features

ID Resolver

Usage: unmarshaller.setProperty("com.sun.xml.bind.IDResolver", new MyIdResolver());

      unmarshaller.setProperty(org.eclipse.persistence.jaxb.UnmarshallerProperties.ID_RESOLVER, new MyIdResolver());

Allows the user to provide their own logic for resolving XML IDs/IDREFs.

See: http://wiki.eclipse.org/EclipseLink/Development/360249


XML Location

Usage: Annotate a property with @XmlLocation

Allows the user to specify a property on the JAXB object that will be updated (upon unmarshalling) with that object's XML location information (i.e. the line number, column number, and system ID that points to this object's location in the XML input).

See: http://wiki.eclipse.org/EclipseLink/Development/355766