/** First adopts the new child, then appends it. * * I do this so that we can insert elements that were created with a * different owner document or no owner document, such as from * "new Image()" in javascript. * * @param newChild the new child * @see org.apache.xerces.dom.NodeImpl#appendChild(org.w3c.dom.Node) */ @Override public Node appendChild(Node newChild) throws DOMException { //We don't need adoptChild(newChild) because super.appendChild() calls insertBefore(n,r). //adoptNode(newChild); return super.appendChild(newChild); }
protected void processSequences(Platform platform, DatabaseMetaData dbMetaData) throws SQLException { if (!processSequences) { return; } List<String> sequenceNames = getSequenceNames(dbMetaData); for (String sequenceName : sequenceNames) { Element sequence = doc.createElement("sequence"); sequence.setAttribute("name", sequenceName); /* * <view name="" nextval="" /> */ Long nextVal = platform.getSequenceNextVal(dbMetaData.getConnection(), schema, sequenceName); sequence.setAttribute("nextval", nextVal.toString()); databaseNode.appendChild(sequence); } doc.appendChild(databaseNode); }
/** * Return the XML Document object that we will serialize to disk */ protected DocumentImpl getDocument(final TableHelper helper, final String tableName) throws SQLException { // Generate the document type DocumentTypeImpl docType = new DocumentTypeImpl(null, "dataset", null, getSystemId()); // Generate an empty document DocumentImpl doc = new DocumentImpl(docType); // Append a comment doc.appendChild(doc.createComment(" " + getComment() + " ")); // Extract the data from the table Element datasetNode = getDatasetNode(helper, doc, tableName); if (datasetNode == null) { // There was no data (zero rows), we are done return null; } // Add the dataset to the document doc.appendChild(datasetNode); // Return what we found return doc; }
protected DocumentImpl getDocumentImpl() { DocumentTypeImpl docType = new DocumentTypeImpl(null, "database", null, getSystemId()); DocumentImpl doc = new DocumentImpl(docType); doc.appendChild(doc.createComment(" " + getComment() + " ")); return doc; }