public void setStrictErrorChecking(boolean strictErrorChecking) { this.doc.setStrictErrorChecking(strictErrorChecking); }
@Override public void setStrictErrorChecking(boolean strictErrorChecking) { document.setStrictErrorChecking(strictErrorChecking); }
public void setStrictErrorChecking(boolean arg0) { target.setStrictErrorChecking(arg0); }
/** * @inheritDoc */ public void setStrictErrorChecking(boolean strictErrorChecking) { dom.setStrictErrorChecking(strictErrorChecking); }
public void setStrictErrorChecking(boolean arg0) { target.setStrictErrorChecking(arg0); }
@Override public void setStrictErrorChecking(boolean strictErrorChecking) { original_.setStrictErrorChecking(strictErrorChecking); }
@Override public void setStrictErrorChecking(boolean strictErrorChecking) { original_.setStrictErrorChecking(strictErrorChecking); }
public void setStrictErrorChecking(boolean strictErrorChecking) { _delegate.setStrictErrorChecking(strictErrorChecking); }
public void setStrictErrorChecking(boolean strictErrorChecking) { document.setStrictErrorChecking(strictErrorChecking); }
public void setStrictErrorChecking(boolean strictErrorChecking) { document.setStrictErrorChecking(strictErrorChecking); }
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document document = db.newDocument(); document.setStrictErrorChecking(false); // <--- This one. This accomplished it.
/** * @param arg0 * @see org.w3c.dom.Document#setStrictErrorChecking(boolean) */ public void setStrictErrorChecking(boolean arg0) { getParent().setStrictErrorChecking(arg0); }
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; Attr newAttr; doc = (Document) load("hc_staff", true); doc.setStrictErrorChecking(false); doc.setStrictErrorChecking(true); { boolean success = false; try { newAttr = doc.createAttributeNS("http://www.w3.org/DOM/Test", "@"); } catch (DOMException ex) { success = (ex.code == DOMException.INVALID_CHARACTER_ERR); } assertTrue("INVALID_CHARACTER_ERR_documentsetstricterrorchecking01", success); } } /**
/** * Get a list of documents * * @param pPath the XPath to nodes to be returned * @param root root node to evaluate XPAth * @return List with Documents or null if no nodes are found */ protected List<Document> getNodesAsDocuments(String pPath, Node root) { Object o = evaluateXPath(pPath, XPathConstants.NODESET, root); if (o == null) return null; List<Document> lResult; NodeList lNodeList = (NodeList) o; lResult = new ArrayList<>(); for (int i = 0; i < lNodeList.getLength(); i++) { Node node = lNodeList.item(i); Document lRecord = DOMUtil.createDocument(); lRecord.setStrictErrorChecking(false); Node importedNode = lRecord.importNode(node, true); lRecord.appendChild(importedNode); lResult.add(lRecord); } return lResult; }
/** * Add namespaces to a {@link InputSource XML document}. * * @param inputSource the input source for the XML document. * @param namespaces the map of namespaces prefixes and URIs. * @return the modified document. */ public static Document addNamespacesToRootNode(final InputSource inputSource, final Map<String, String> namespaces) { final Document ret; try { ret = XmlDocumentBuilder.of(inputSource).build(); Element element = ret.getDocumentElement(); ret.setStrictErrorChecking(false); for (Map.Entry<String, String> elm : namespaces.entrySet()) { if (StringUtils.isNotBlank(elm.getValue())) { element.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:" + elm.getKey(), elm.getValue()); } } } catch (final Exception exc) { throw new SystemException(XmlErrorType.ERROR_PARSING_XML, exc); } return ret; } }
private static Document deserializeDocument(byte[] data) throws FastInfosetException, IOException { if (data.length == 0) { return null; } else { Document document = DOMUtils.getNewDocument(); //FastInfoset does not tolerate stray xmlns declarations document.setStrictErrorChecking(false); DOMDocumentParser parser = new DOMDocumentParser(); ByteArrayInputStream in = new ByteArrayInputStream(data); parser.parse(document, in); return document; } }
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; Attr newAttr; String nullValue = null; doc = (Document) load("hc_staff", true); doc.setStrictErrorChecking(true); { boolean success = false; try { newAttr = doc.createAttributeNS(nullValue, "dom:test"); } catch (DOMException ex) { success = (ex.code == DOMException.NAMESPACE_ERR); } assertTrue("NAMESPACE_ERR_documentsetstricterrorchecking02", success); } } /**
/** * Runs the test case. * @throws Throwable Any uncaught exception causes test to fail */ public void runTest() throws Throwable { Document doc; boolean strictErrorCheckingValue; doc = (Document) load("hc_staff", true); doc.setStrictErrorChecking(false); strictErrorCheckingValue = doc.getStrictErrorChecking(); assertFalse("documentsetstricterrorchecking03", strictErrorCheckingValue); } /**
final DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); // May throw ParserConfigurationException. final Document document = documentBuilder.newDocument(); document.setStrictErrorChecking(false); final Element xmlElement = document.createElement("xml"); // May throw DOMException.
document.setStrictErrorChecking(true);