Methods Summary |
---|
public org.apache.lucene.gdata.gom.AtomMediaType | getAtomMediaType()
return this.mediaType;
|
public AtomParser | getChildParser(javax.xml.namespace.QName aName)
if (aName == null)
throw new GDataParseException("QName must not be null");
if (this.mediaType == AtomMediaType.XML) {
if (this.blobParser != null)
throw new GDataParseException(String.format(
DUPLICATE_ELEMENT, aName.getLocalPart()));
this.blobParser = new XMLBlobContentParser();
return this.blobParser.getChildParser(aName);
}
return super.getChildParser(aName);
|
public java.lang.String | getSrc()
return this.src;
|
public void | processAttribute(javax.xml.namespace.QName aQName, java.lang.String aValue)
if (aQName == null)
throw new GDataParseException("QName must not be null");
if (aValue == null)
throw new GDataParseException("Value must not be null");
if ("src".equals(aQName.getLocalPart())) {
if (this.src != null)
throw new GDataParseException(String.format(
DUPLICATE_ATTRIBUTE, "src"));
this.src = aValue;
return;
}
if ("type".equals(aQName.getLocalPart())) {
if (this.contentType != null || this.mediaType != null)
throw new GDataParseException(String.format(
DUPLICATE_ATTRIBUTE, "type"));
if (AtomParserUtils.isAtomMediaType(aValue)) {
this.type = aValue;
this.mediaType = AtomParserUtils.getAtomMediaType(aValue);
return;
}
}
super.processAttribute(aQName, aValue);
|
public void | processElementValue(java.lang.String aValue)
if (this.src != null)
throw new GDataParseException(String.format(
AtomParser.UNEXPECTED_ELEMENT_VALUE, this.localName
+ " with attribute src set "));
super.processElementValue(aValue);
|
public void | processEndElement()
if (this.src != null)
try {
AtomParserUtils.getAbsolutAtomURI(this.xmlBase, this.src);
} catch (URISyntaxException e) {
throw new GDataParseException(String.format(INVALID_ATTRIBUTE,
"src", "absolute uri"), e);
}
if (this.mediaType == null)
super.processEndElement();
else if (this.blobParser != null) {
this.textValue = this.blobParser.toString();
this.blobParser.close();
this.blobParser = null;
}
|
public void | setAtomMediaType(org.apache.lucene.gdata.gom.AtomMediaType aMediaType)
this.mediaType = aMediaType;
|
public void | setSrc(java.lang.String aSrc)
this.src = aSrc;
|
public void | writeAtomOutput(org.apache.lucene.gdata.gom.writer.GOMOutputWriter aStreamWriter)
if (this.mediaType != null) {
List<GOMAttribute> xmlNamespaceAttributes = getXmlNamespaceAttributes();
xmlNamespaceAttributes.add(GOMUtils.buildDefaultNamespaceAttribute(
this.type, "type"));
aStreamWriter.writeStartElement(this.localName,
xmlNamespaceAttributes);
if (this.src == null)
aStreamWriter.writeContentUnescaped(this.textValue);
else
aStreamWriter.writeAttribute(GOMUtils
.buildDefaultNamespaceAttribute(this.src, "src"));
aStreamWriter.writeEndElement();
} else {
super.writeAtomOutput(aStreamWriter);
}
|
public void | writeRssOutput(org.apache.lucene.gdata.gom.writer.GOMOutputWriter aStreamWriter)
if (this.mediaType != null) {
// if content is atomOutOfLineContent (has not textValue) ->
// generate a <link> element.
if (src != null) {
aStreamWriter.writeSimpleXMLElement("link", null, this.src);
} else if (this.mediaType == AtomMediaType.TEXT) {
aStreamWriter.writeSimpleXMLElement("description", null,
this.textValue);
} else {
// RSS doesn't support non-text content --> write atom type
this.writeAtomOutput(aStreamWriter);
}
} else {
super.writeRssOutput(aStreamWriter);
}
|