Methods Summary |
---|
public AtomParser | getChildParser(javax.xml.namespace.QName aName)
if (aName == null)
throw new GDataParseException("QName must not be null");
if (this.contentType == ContentType.XHTML
&& aName.getLocalPart().equals("div")) {
if (this.blobParser != null)
throw new GDataParseException(String.format(
DUPLICATE_ELEMENT, "div"));
this.blobParser = new XMLBlobContentParser();
return this.blobParser.getChildParser(aName);
}
return super.getChildParser(aName);
|
public org.apache.lucene.gdata.gom.ContentType | getContentType()
return this.contentType;
|
public void | processAttribute(javax.xml.namespace.QName aQName, java.lang.String aValue)
if (aQName == null)
throw new GDataParseException("QName must not be null");
if ("type".equals(aQName.getLocalPart()) && aValue != null) {
if (this.contentType != null)
throw new GDataParseException(String.format(
DUPLICATE_ATTRIBUTE, "type"));
this.contentType = ContentType.valueOf(aValue.toUpperCase());
if (this.contentType == ContentType.HTML)
this.htmlBuilder = new StringBuilder();
}
super.processAttribute(aQName, aValue);
|
public void | processElementValue(java.lang.String aValue)
if (this.htmlBuilder != null)
this.htmlBuilder.append(aValue);
else {
this.textValue = aValue;
}
|
public void | processEndElement()
if (this.contentType == null)
throw new GDataParseException(String.format(
MISSING_ELEMENT_ATTRIBUTE, this.qname, "type"));
switch (this.contentType) {
case XHTML:
if (this.blobParser != null) {
this.textValue = this.blobParser.toString();
this.blobParser.close();
this.blobParser = null;
}
break;
case HTML:
if (this.htmlBuilder != null) {
this.textValue = this.htmlBuilder.toString();
this.htmlBuilder = null;
}
default:
break;
}
|
public void | writeAtomOutput(org.apache.lucene.gdata.gom.writer.GOMOutputWriter aStreamWriter)
List<GOMAttribute> xmlNamespaceAttributes = getXmlNamespaceAttributes();
xmlNamespaceAttributes.add(GOMUtils
.getAttributeByContentTypeDefaultNs(this.contentType));
if (this.contentType == ContentType.XHTML) {
/*
* if the content is xhtml write it unescaped
*/
aStreamWriter.writeStartElement(this.localName,
xmlNamespaceAttributes);
aStreamWriter.writeContentUnescaped(this.textValue);
aStreamWriter.writeEndElement();
} else {
// html and text will be escaped by stax writer
aStreamWriter.writeSimpleXMLElement(this.localName,
xmlNamespaceAttributes, this.textValue);
}
|
public void | writeRssOutput(org.apache.lucene.gdata.gom.writer.GOMOutputWriter aStreamWriter)
/*
* RSS does not support markup as child elements StaX Writer will encode
* all containing markup into valid xml entities
*/
aStreamWriter.writeSimpleXMLElement(this.rssLocalName,
getXmlNamespaceAttributes(), this.textValue);
|