Oops, w3.org, not w3c. Evan Kirkconnell wrote: > For some reason our server is having errors connecting to w3c.org, and > this is causing my dom4j apps to break. I'd like to turn off validation > and not parse an external DTD, but I also need to have the entity > in my xhtml. My coworker was saying that he had to use numeric > entities, like   for to be able to use DOM without a > DTD.(he's not using dom4j though) I was trying to use xerces and have > the following code: > public static SAXReader getSAXReader() throws Exception{ > SAXParserFactory factory = SAXParserFactory.newInstance(); > factory.setNamespaceAware(false); > XMLReader xmlReader = factory.newSAXParser().getXMLReader(); > > SAXReader saxReader = new SAXReader(); > saxReader.setXMLReader(xmlReader); > //saxReader.setFeature("http://xml.org/sax/features/namespaces", > false); > > //saxReader.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", > > false); > > saxReader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", > > false); > > //saxReader.setFeature("http://apache.org/xml/features/dom/include-ignorable-whitespace", > > false); > saxReader.setValidation(false); > saxReader.setEntityResolver(null); > saxReader.setDocumentFactory( df() ); > saxReader.setStripWhitespaceText(true); > > return saxReader; > } > > I don't know if it's xerces or dom4j, but somehow it ends up with a ? > instead of a non-breaking space when I serialize the document with this > code: > > OutputFormat of = OutputFormat.createPrettyPrint(); > of.setIndent("\t"); > of.setLineSeparator("\n"); > //of.setTrimText(trim); > of.setExpandEmptyElements(false); > //of.setNewlines(true); > //of.setNewLineAfterNTags(1); > //of.setXHTML(true); > > //StringBufferWriter sbw = new StringBufferWriter(); > > XMLWriter writer = new EscapedXMLWriter(pw, of); > writer.setEscapeText(false); > writer.setResolveEntityRefs(false); > writer.write(node); > pw.flush(); > > Any suggestions are much appreciated. > --Evan > > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > dom4j-user mailing list > dom4j-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/dom4j-user >
------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace _______________________________________________ dom4j-user mailing list dom4j-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dom4j-user