@Test public void handlesInvalidAttributeNames() { String html = "<html><head></head><body style=\"color: red\" \" name\"></body></html>"; org.jsoup.nodes.Document jsoupDoc; jsoupDoc = Jsoup.parse(html); Element body = jsoupDoc.select("body").first(); assertTrue(body.hasAttr("\"")); assertTrue(body.hasAttr("name\"")); Document w3Doc = new W3CDom().fromJsoup(jsoupDoc); }
public Document fromJsoup(org.jsoup.nodes.Document in) { Validate.notNull(in); DocumentBuilder builder; try { factory.setNamespaceAware(true); builder = factory.newDocumentBuilder(); Document out = builder.newDocument(); convert(in, out); return out; } catch (ParserConfigurationException e) { throw new IllegalStateException(e); } }
W3CDom { public Document fromJsoup(org.jsoup.nodes.Document in) { Validate.notNull(in); DocumentBuilder builder; try { factory.setNamespaceAware(true); builder = factory.newDocumentBuilder(); Document out = builder.newDocument(); convert(in, out); return out; } catch (ParserConfigurationException e) { throw new IllegalStateException(e); } } }
W3CDom { public Document fromJsoup(org.jsoup.nodes.Document in) { Validate.notNull(in); DocumentBuilder builder; try { factory.setNamespaceAware(true); builder = factory.newDocumentBuilder(); Document out = builder.newDocument(); convert(in, out); return out; } catch (ParserConfigurationException e) { throw new IllegalStateException(e); } }  }
W3CDom { public Document fromJsoup(org.jsoup.nodes.Document in) { Validate.notNull(in); DocumentBuilder builder; try { factory.setNamespaceAware(true); builder = factory.newDocumentBuilder(); Document out = builder.newDocument(); convert(in, out); return out; } catch (ParserConfigurationException e) { throw new IllegalStateException(e); } }  Document fromJsoup(org.jsoup.nodes.Document in); void convert(org.jsoup.nodes.Document in, Document out); String asString(Document doc); }
W3CDom { public Document fromJsoup(org.jsoup.nodes.Document in) { Validate.notNull(in); DocumentBuilder builder; try { factory.setNamespaceAware(true); builder = factory.newDocumentBuilder(); Document out = builder.newDocument(); convert(in, out); return out; } catch (ParserConfigurationException e) { throw new IllegalStateException(e); } }  Document fromJsoup(org.jsoup.nodes.Document in); void convert(org.jsoup.nodes.Document in, Document out); String asString(Document doc);  }