Skip to content

Commit

Permalink
Add string output of XHTML to description value
Browse files Browse the repository at this point in the history
  • Loading branch information
scottbw committed Jun 21, 2012
1 parent ff726dd commit b6800f0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/org/xcri/types/DescriptiveTextType.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
import org.xcri.Namespaces;
import org.xcri.ParserConfiguration;
import org.xcri.exceptions.InvalidElementException;
Expand Down Expand Up @@ -195,13 +197,12 @@ private void processCDATA(CDATA cdata) throws InvalidElementException{
}

private void processXhtml(Element element) throws InvalidElementException{
xhtml = element;
try {
//
// Check for potentially dangerous elements
//
@SuppressWarnings("rawtypes")
Iterator i = xhtml.getDescendants(new ContentSecurityFilter());
Iterator i = element.getDescendants(new ContentSecurityFilter());
ArrayList<Element> toRemove = new ArrayList<Element>();
while (i.hasNext()){
Element dangerousElement = (Element) i.next();
Expand All @@ -219,7 +220,13 @@ private void processXhtml(Element element) throws InvalidElementException{
}
}

xhtml = element;
isXhtml = true;

//
// Set value to text output of XML
//
this.setValue(new XMLOutputter().outputString(xhtml));

} catch (Exception e) {
throw new InvalidElementException("Error reading content of description element");
Expand Down

0 comments on commit b6800f0

Please sign in to comment.