FileDocCategorySizeDatePackage
ArbitraryGOMXml.javaAPI DocApache Lucene 2.1.04684Wed Feb 14 10:45:58 GMT 2007org.apache.lucene.gdata.gom.core

ArbitraryGOMXml

public class ArbitraryGOMXml extends AbstractGOMElement
author
Simon Willnauer

Fields Summary
private List
children
private List
attributes
Constructors Summary
public ArbitraryGOMXml(QName qname)
Class constructor

param
qname - the elements qname

		if (qname == null)
			throw new IllegalArgumentException("QName must not be null");

		this.qname = qname;
		this.localName = qname.getLocalPart();
	
Methods Summary
public java.util.ListgetAttributes()
this method will never return null

return
Returns the attributes of this xml element.


	               	 
	   
		return this.attributes;
	
public AtomParsergetChildParser(javax.xml.namespace.QName aName)
{@inheritDoc}

see
org.apache.lucene.gdata.gom.core.AbstractGOMElement#getChildParser(javax.xml.namespace.QName)

		if (aName == null)
			throw new GDataParseException("QName must not be null");
		/*
		 * either a text value or a child
		 */
		if (this.textValue != null)
			throw new GDataParseException(String.format(
					AtomParser.UNEXPECTED_ELEMENT_CHILD, this.localName));
		GOMElement element = new ArbitraryGOMXml(aName);
		this.children.add(element);
		return element;
	
public java.util.ListgetChildren()
this method will never return null

return
- the child elements of this xml element

		return this.children;
	
public voidprocessAttribute(javax.xml.namespace.QName aQName, java.lang.String aValue)
{@inheritDoc}

see
org.apache.lucene.gdata.gom.core.AbstractGOMElement#processAttribute(javax.xml.namespace.QName, java.lang.String)

		if (aQName == null)
			throw new GDataParseException("QName must not be null");
		GOMAttributeImpl impl = new GOMAttributeImpl(aQName.getNamespaceURI(),
				aQName.getPrefix(), aQName.getLocalPart(), aValue);
		this.attributes.add(impl);

	
public voidprocessElementValue(java.lang.String aValue)
{@inheritDoc}

see
org.apache.lucene.gdata.gom.core.AbstractGOMElement#processElementValue(java.lang.String)

		if (aValue == null)
			throw new GDataParseException("Element value must not be null");
		/*
		 * either a text value or a child
		 */
		if (this.children.size() > 0)
			throw new GDataParseException(String.format(
					AtomParser.UNEXPECTED_ELEMENT_VALUE, this.localName));
		if (this.textValue != null)
			throw new GDataParseException(String.format(
					AtomParser.UNEXPECTED_ELEMENT_VALUE, this.localName));
		this.textValue = aValue;

	
public voidwriteAtomOutput(org.apache.lucene.gdata.gom.writer.GOMOutputWriter aStreamWriter)
{@inheritDoc}

see
org.apache.lucene.gdata.gom.GOMElement#writeAtomOutput(org.apache.lucene.gdata.gom.writer.GOMStaxWriter)

		if (aStreamWriter == null)
			throw new NullPointerException("StreamWriter is null");
		aStreamWriter.writeStartElement(this.qname, this.attributes);
		if (this.textValue == null) {
			for (GOMElement element : this.children) {
				element.writeAtomOutput(aStreamWriter);
			}
		} else {
			aStreamWriter.writeContent(this.textValue);
		}
		aStreamWriter.writeEndElement();

	
public voidwriteRssOutput(org.apache.lucene.gdata.gom.writer.GOMOutputWriter aStreamWriter)
{@inheritDoc}

see
org.apache.lucene.gdata.gom.GOMElement#writeRssOutput(org.apache.lucene.gdata.gom.writer.GOMStaxWriter)

		// delegate it by default
		this.writeAtomOutput(aStreamWriter);