|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.framework.logger.AbstractLogEnabled org.apache.cocoon.xml.AbstractXMLConsumer org.apache.cocoon.forms.util.XMLAdapter
public class XMLAdapter
Adapter class that wraps a Form
object and makes it
possible to populate a widget hierarchy from XML in form of SAX
events and serialize the content of the widget hierarchy as XML.
The XML format is such that there is one XML element for each
widget and the element get the widgets id as name. Exceptions from
this is that the elements in a repeater gets the name
item
and a attribute position
with the
position of the repeater child, instead of just a number (which is
not allowed as element name). Childs of a
MultiValueField
are also embeded within a
item
element. If the Form
widget does
not have an id it get the name uknown
.
An AggregateField
can both be interpreted as one value
and as several widgets. This ambiguity is resolved by chosing to emit
the single value rather than the fields as XML. For population of the
form both forms are however allowed.
Constructor Summary | |
---|---|
XMLAdapter(Widget widget)
Wrap a Form with an XMLAdapter |
Method Summary | |
---|---|
void |
characters(char[] ch,
int start,
int len)
Receive notification of character data. |
void |
endElement(String uri,
String loc,
String raw)
Receive notification of the end of an element. |
Locale |
getLocale()
Get the locale used for conversion between XML data and Java objects |
void |
setLocale(Locale locale)
Set the locale used for conversion between XML data and Java objects |
void |
startElement(String uri,
String loc,
String raw,
Attributes a)
Receive notification of the beginning of an element. |
void |
toSAX(ContentHandler handler)
Generates SAX events representing the object's state. |
Methods inherited from class org.apache.cocoon.xml.AbstractXMLConsumer |
---|
comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping |
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled |
---|
enableLogging, getLogger, setupLogger, setupLogger, setupLogger |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XMLAdapter(Widget widget)
Form
with an XMLAdapter
Method Detail |
---|
public void setLocale(Locale locale)
public Locale getLocale()
public void startElement(String uri, String loc, String raw, Attributes a) throws SAXException
startElement
in interface ContentHandler
startElement
in class AbstractXMLConsumer
uri
- The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace
processing is not being performed.loc
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.raw
- The raw XML 1.0 name (with prefix), or the empty string if
raw names are not available.a
- The attributes attached to the element. If there are no
attributes, it shall be an empty Attributes object.
SAXException
public void endElement(String uri, String loc, String raw) throws SAXException
endElement
in interface ContentHandler
endElement
in class AbstractXMLConsumer
uri
- The Namespace URI, or the empty string if the element has no
Namespace URI or if Namespace
processing is not being performed.loc
- The local name (without prefix), or the empty string if
Namespace processing is not being performed.raw
- The raw XML 1.0 name (with prefix), or the empty string if
raw names are not available.
SAXException
public void characters(char[] ch, int start, int len) throws SAXException
characters
in interface ContentHandler
characters
in class AbstractXMLConsumer
ch
- The characters from the XML document.start
- The start position in the array.len
- The number of characters to read from the array.
SAXException
public void toSAX(ContentHandler handler) throws SAXException
toSAX
in interface XMLizable
SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |