001/** 002 * 003 * Copyright © 2018 Paul Schaub 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.message_markup.element; 018 019import org.jivesoftware.smack.util.XmlStringBuilder; 020 021public class BlockQuoteElement implements MarkupElement.BlockLevelMarkupElement { 022 023 public static final String ELEMENT = "bquote"; 024 025 private final int start, end; 026 027 /** 028 * Create a new Block Quote element. 029 * 030 * @param start start index 031 * @param end end index 032 */ 033 public BlockQuoteElement(int start, int end) { 034 this.start = start; 035 this.end = end; 036 } 037 038 @Override 039 public int getStart() { 040 return start; 041 } 042 043 @Override 044 public int getEnd() { 045 return end; 046 } 047 048 @Override 049 public String getElementName() { 050 return ELEMENT; 051 } 052 053 @Override 054 public XmlStringBuilder toXML(String enclosingNamespace) { 055 XmlStringBuilder xml = new XmlStringBuilder(); 056 xml.halfOpenElement(this); 057 xml.attribute(ATTR_START, getStart()); 058 xml.attribute(ATTR_END, getEnd()); 059 xml.closeEmptyElement(); 060 return xml; 061 } 062}