Hey Andy, my use case is a practical hack. As user input comes from an XHTML editor, it is a literal with datatype rdf:XMLLiteral but it is not well-formed XML at that point. I check the datatype, and if it is rdf:XMLLiteral I intercept the value and wrap it into "<div></div>" and canonicalize. Only then isWellFormed() becomes true for that literal.
Does this help? Martynas On Wed, May 27, 2015 at 9:48 AM, Andy Seaborne <a...@apache.org> wrote: > On 26/05/15 23:51, Martynas Jusevičius wrote: >> >> Thanks. That does not seem to be available in Jena 2.11.0 though. > > > No - it was added as part of being tidy when adding all the RDF 1.1 support. > Ditto dtLangString. > > Out of curiosity, why do you explicitly check for RDF XMLLiterals? > > I've been wondering [1] if Jena ought to be less enforcing. Not exclusive > canonicalization for example. Much of this is removing the odd API calls > that have a "boolean wellFormed" flag. In Turtle, rdf:XMLLIterals already > do behave like any other literal. > > RDF 1.1 downplays rdf:XMLLiterals [2] making them just another datatype, > when not in RDF/XML. In RDF/XML they are built-in. > > Your thoughts? > > Andy > > [1] https://issues.apache.org/jira/browse/JENA-815 > [2] http://www.w3.org/TR/rdf11-concepts/#section-XMLLiteral > > >> >> On Tue, May 26, 2015 at 10:56 PM, Andy Seaborne <a...@apache.org> wrote: >>> >>> On 26/05/15 15:38, Martynas Jusevičius wrote: >>>> >>>> >>>> Hey, >>>> >>>> is there a better way than >>>> >>>> import com.hp.hpl.jena.datatypes.xsd.impl.XMLLiteralType; >>>> >>>> ... >>>> >>>> if (!stmt.getObject().isLiteral() || >>>> >>>> !stmt.getLiteral().getDatatype().equals(XMLLiteralType.theXMLLiteralType)) >>>> >>> >>> >>> RDF.dtXMLLiteral is a little nicer than poking around the implementation >>> class to get >>> theXMLLiteralType. >>> >>> Andy >>> >>>> ? >>>> >>>> Thanks, >>>> >>>> Martynas >>>> graphityhq.com >>>> >>> >