/** * Get a string representation. * * @return The string. */ public String toString() { return "Summary - content: " + getContent() + " type: " + getType(); } }
/** * @param prefix The prefix. * @param name The local name. * @param namespaceUri The namespace URI. */ public TextConstruct(String prefix, String name, String namespaceUri) { super(prefix, name, namespaceUri); initialise(); }
/** * Unmarshal the text element into this object. * * This unmarshaller only handles plain text content, although it can * recognise the three different type elements of text, html and xhtml. This * is an area that can be improved in a future implementation, if necessary. * * @param text The text element. * @throws UnmarshallException If the specified element is not of * the correct type, where the localname is used * to specify the valid name. Also thrown * if there is an issue accessing the data. */ public void unmarshall(Element text) throws UnmarshallException { unmarshall(text, null); }
if (!isInstanceOf(text, xmlName)) { return handleIncorrectElement(text, validationProperties); initialise(); type = ContentType.XHTML; } else { log.error("Unable to parse extract type in " + getQualifiedName()); SwordValidationInfo info = new SwordValidationInfo(xmlName, new XmlName(attribute), content = unmarshallString(text); log.error("Unable to parse an element in " + getQualifiedName() + ": " + ex.getMessage()); throw new UnmarshallException("Unable to parse an element in " + getQualifiedName(), ex); result = validate(validationItems, attributeItems, validationProperties);
public SwordValidationInfo validate(Properties validationContext) { return validate(null, null, validationContext); }
/** * Marshal the data in this object to an Element object. * * @return The data expressed in an Element. */ public Element marshall() { Element element = new Element(getQualifiedName(), Namespaces.NS_ATOM); if (type != null) { Attribute typeAttribute = new Attribute(ATTRIBUTE_TYPE, type.toString()); element.addAttribute(typeAttribute); } if (content != null) { element.appendChild(content); } return element; }
throws UnmarshallException if( ! isInstanceOf(text, xmlName)) return handleIncorrectElement(text, validationProperties); initialise(); log.error("Unable to parse extract type in " + getQualifiedName() ); SwordValidationInfo info = new SwordValidationInfo(xmlName, new XmlName(attribute), if( length > 0 ) content = unmarshallString(text); log.error("Unable to parse an element in " + getQualifiedName() + ": " + ex.getMessage()); throw new UnmarshallException("Unable to parse an element in " + getQualifiedName(), ex); if( validationProperties != null ) result = validate(validationItems, attributeItems, validationProperties);
public SwordValidationInfo validate(Properties validationContext) { return validate(null, null, validationContext); }
/** * Marshal the data in this object to an Element object. * * @return The data expressed in an Element. */ public Element marshall() { Element element = new Element(getQualifiedName(), Namespaces.NS_ATOM); if( type != null ) { Attribute typeAttribute = new Attribute(ATTRIBUTE_TYPE, type.toString()); element.addAttribute(typeAttribute); } if( content != null ) { element.appendChild(content); } return element; }
throws UnmarshallException if( ! isInstanceOf(text, xmlName)) return handleIncorrectElement(text, validationProperties); initialise(); log.error("Unable to parse extract type in " + getQualifiedName() ); SwordValidationInfo info = new SwordValidationInfo(xmlName, new XmlName(attribute), if( length > 0 ) content = unmarshallString(text); log.error("Unable to parse an element in " + getQualifiedName() + ": " + ex.getMessage()); throw new UnmarshallException("Unable to parse an element in " + getQualifiedName(), ex); if( validationProperties != null ) result = validate(validationItems, attributeItems, validationProperties);
/** * Get a string representation. * * @return The string. */ public String toString() { return "Summary - content: " + getContent() + " type: " + getType(); } }
/** * * @param prefix * @param name * @param namespaceUri */ public TextConstruct(String prefix, String name, String namespaceUri) { super(prefix, name, namespaceUri); initialise(); }
/** * Validate this element, checking that the content stored in the object * matches the requirements for the object as defined in the SWORD profile. * * @param validationContext A property object that is used to pass any context * information through the hierarchy of elements. This * can be used to provide more appropriate validation * information. * @return A validation info object that represents the validation status * for this element. */ public SwordValidationInfo validate(Properties validationContext) { return validate(null, null, validationContext); }
/** * Marshall the data in this object to an Element object. * * @return The data expressed in an Element. */ public Element marshall() { Element element = new Element(getQualifiedName(), Namespaces.NS_ATOM); if( type != null ) { Attribute typeAttribute = new Attribute(ATTRIBUTE_TYPE, type.toString()); element.addAttribute(typeAttribute); } if( content != null ) { element.appendChild(content); } return element; }
/** * Unmarshall the text element into this object. * * This unmarshaller only handles plain text content, although it can * recognise the three different type elements of text, html and xhtml. This * is an area that can be improved in a future implementation, if necessary. * * @param text The text element. * * @throws UnmarshallException If the specified element is not of * the correct type, where the localname is used * to specify the valid name. Also thrown * if there is an issue accessing the data. */ public void unmarshall(Element text) throws UnmarshallException { unmarshall(text, null); }
/** * Get a string representation. * * @return The string. */ public String toString() { return "Summary - content: " + getContent() + " type: " + getType(); } }
/** * * @param prefix * @param name * @param namespaceUri */ public TextConstruct(String prefix, String name, String namespaceUri) { super(prefix, name, namespaceUri); initialise(); }
/** * Unmarshal the text element into this object. * * This unmarshaller only handles plain text content, although it can * recognise the three different type elements of text, html and xhtml. This * is an area that can be improved in a future implementation, if necessary. * * @param text The text element. * * @throws UnmarshallException If the specified element is not of * the correct type, where the localname is used * to specify the valid name. Also thrown * if there is an issue accessing the data. */ public void unmarshall(Element text) throws UnmarshallException { unmarshall(text, null); }
/** * Retrieve the details for a TextConstruct object. * * @param data The text construct object to display. * * @return Either 'Not defined' if the data is <code>null</code>, or * details of the text content element. */ private String getTextConstructDetails(TextConstruct data) { String summaryStr = ""; if (data == null) { summaryStr = "Not defined"; } else { summaryStr = "Content: '" + data.getContent() + "', Type: "; if (data.getType() != null) { summaryStr += "'" + data.getType().toString() + "'"; } else { summaryStr += "undefined."; } } return summaryStr; }
/** * Retrieve the details for a TextConstruct object. * * @param data The text construct object to display. * * @return Either 'Not defined' if the data is <code>null</code>, or * details of the text content element. */ private String getTextConstructDetails(TextConstruct data) { String summaryStr = ""; if( data == null ) { summaryStr = "Not defined"; } else { summaryStr = "Content: '" + data.getContent() + "', Type: "; if( data.getType() != null ) { summaryStr += "'" + data.getType().toString() + "'"; } else { summaryStr += "undefined."; } } return summaryStr; }