/** NON-DOM Get the number associated with this doctype. */ protected int getNodeNumber() { // If the doctype has a document owner, get the node number // relative to the owner doc if (getOwnerDocument()!=null) return super.getNodeNumber(); // The doctype is disconnected and not associated with any document. // Assign the doctype a number relative to the implementation. if (doctypeNumber==0) { CoreDOMImplementationImpl cd = (CoreDOMImplementationImpl)CoreDOMImplementationImpl.getDOMImplementation(); doctypeNumber = cd.assignDocTypeNumber(); } return doctypeNumber; }
/** NON-DOM: Get the number associated with this document. Used to * order documents in the implementation. */ protected int getNodeNumber() { if (documentNumber==0) { CoreDOMImplementationImpl cd = (CoreDOMImplementationImpl)CoreDOMImplementationImpl.getDOMImplementation(); documentNumber = cd.assignDocumentNumber(); } return documentNumber; }
/** * Introduced in DOM Level 2. <p> * * Creates an empty DocumentType node. * * @param qualifiedName The qualified name of the document type to be created. * @param publicID The document type public identifier. * @param systemID The document type system identifier. * @since WD-DOM-Level-2-19990923 */ public DocumentType createDocumentType( String qualifiedName, String publicID, String systemID) { // REVISIT: this might allow creation of invalid name for DOCTYPE // xmlns prefix. // also there is no way for a user to turn off error checking. checkQName(qualifiedName); return new DocumentTypeImpl(null, qualifiedName, publicID, systemID); }
fValidationHandler = CoreDOMImplementationImpl.singleton.getValidator(schemaType, xmlVersion); fConfiguration.setFeature(DOMConfigurationImpl.SCHEMA, true); fConfiguration.setFeature(DOMConfigurationImpl.SCHEMA_FULL_CHECKING, true); fValidationHandler = CoreDOMImplementationImpl.singleton.getValidator(schemaType, xmlVersion); fPSVI = false; fValidationHandler.endDocument(null); fValidationHandler.setDocumentHandler(null); CoreDOMImplementationImpl.singleton.releaseValidator(schemaType, xmlVersion, fValidationHandler); fValidationHandler = null; CoreDOMImplementationImpl.singleton.releaseValidator(schemaType, xmlVersion, fValidationHandler); fValidationHandler = null;
/** * Retrieve information describing the abilities of this particular * DOM implementation. Intended to support applications that may be * using DOMs retrieved from several different sources, potentially * with different underlying representations. */ public DOMImplementation getImplementation() { // Currently implemented as a singleton, since it's hardcoded // information anyway. return CoreDOMImplementationImpl.getDOMImplementation(); }
try { fValidationHandler.doctypeDecl(rootName, publicId, systemId, null); loader = CoreDOMImplementationImpl.singleton.getDTDLoader(xmlVersion); loader.setFeature(DOMConfigurationImpl.XERCES_VALIDATION, true); loader.setEntityResolver(fConfiguration.getEntityResolver()); CoreDOMImplementationImpl.singleton.releaseDTDLoader(xmlVersion, loader);
boolean result = super.hasFeature(feature, version); if (!result) { boolean anyVersion = version == null || version.length() == 0;
this.doc = this.domImpl.createDocument(HTTP_WWW_W3_ORG_2001_XML_SCHEMA, XSD_SCHEMA, null);
/** * Prints the dom node. * * @param node * the node */ private void printDomNode(final Node node) { final Writer out = new StringWriter(); final LSSerializer writer = this.domImpl.createLSSerializer(); final LSOutput output = this.domImpl.createLSOutput(); output.setCharacterStream(out); output.setEncoding(UTF_8); writer.getDomConfig().setParameter(FORMAT_PRETTY_PRINT, Boolean.TRUE); writer.write(node, output); final String str = output.getCharacterStream().toString(); log.debug(str); }
/** * A method to request a list of DOM implementations that support the * specified features and versions, as specified in . * @param features A string that specifies which features and versions * are required. This is a space separated list in which each feature * is specified by its name optionally followed by a space and a * version number. This is something like: "XML 3.0 Traversal +Events * 2.0" * @return A list of DOM implementations that support the desired * features. */ public DOMImplementationList getDOMImplementationList(String features) { // first check whether the CoreDOMImplementation would do DOMImplementation impl = CoreDOMImplementationImpl.getDOMImplementation(); final ArrayList implementations = new ArrayList(); if (testImpl(impl, features)) { implementations.add(impl); } impl = DOMImplementationImpl.getDOMImplementation(); if (testImpl(impl, features)) { implementations.add(impl); } return new DOMImplementationListImpl(implementations); }
/** * DOM Level 3 WD - Experimental. */ public Object getFeature(String feature, String version) { if (singleton.hasFeature(feature, version)) { if ((feature.equalsIgnoreCase("+XPath"))) { try { Class xpathClass = ObjectFactory.findProviderClass( "org.apache.xpath.domapi.XPathEvaluatorImpl", ObjectFactory.findClassLoader(), true); // Check if the DOM XPath implementation implements // the interface org.w3c.dom.XPathEvaluator Class interfaces[] = xpathClass.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { if (interfaces[i].getName().equals( "org.w3c.dom.xpath.XPathEvaluator")) { return xpathClass.newInstance(); } } } catch (Exception e) { return null; } } else { return singleton; } } return null; }
throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg); CoreDocumentImpl doc = createDocument(doctype);
/** * Write xsd. * * @param out * the out */ public void writeXsd(final OutputStream out) { final LSSerializer writer = this.domImpl.createLSSerializer(); final LSOutput output = this.domImpl.createLSOutput(); output.setByteStream(out); output.setEncoding(UTF_8); writer.getDomConfig().setParameter(FORMAT_PRETTY_PRINT, Boolean.TRUE); writer.write(this.root, output); }
/** * A method to request a DOM implementation. * @param features A string that specifies which features are required. * This is a space separated list in which each feature is specified * by its name optionally followed by a space and a version number. * This is something like: "XML 1.0 Traversal Events 2.0" * @return An implementation that has the desired features, or * <code>null</code> if this source has none. */ public DOMImplementation getDOMImplementation(String features) { // first check whether the CoreDOMImplementation would do DOMImplementation impl = CoreDOMImplementationImpl.getDOMImplementation(); if (testImpl(impl, features)) { return impl; } // if not try the DOMImplementation impl = DOMImplementationImpl.getDOMImplementation(); if (testImpl(impl, features)) { return impl; } return null; }
/** * Write xsd. * * @param out * the out */ public void writeXsd(final Writer out) { final LSSerializer writer = this.domImpl.createLSSerializer(); final LSOutput output = this.domImpl.createLSOutput(); output.setCharacterStream(out); output.setEncoding(UTF_8); writer.getDomConfig().setParameter(FORMAT_PRETTY_PRINT, Boolean.TRUE); writer.write(this.root, output); } }