java - Can JAXP be used to create HTML5 documents? -


are there elements in html5 specification can not created xml library such jaxp? 1 example named html entities not defined in xml. there other areas incompatible?

jaxp apparently works on formed xml. you'd need convert html xhtml before subjecting jaxp's standard parser.

    // create transformer     transformerfactory tf = transformerfactory.newinstance();     streamsource xslt = new streamsource(             "src/blog/jaxbsource/xslt/stylesheet.xsl");     transformer transformer = tf.newtransformer(xslt);      // source     jaxbcontext jc = jaxbcontext.newinstance(library.class);     jaxbsource source = new jaxbsource(jc, catalog);      // result     streamresult result = new streamresult(system.out);      // transform     transformer.transform(source, result); 

url:[https://dzone.com/articles/using-jaxb-xslt-produce-html][1]


Comments