Code example for Node

Methods: insertBefore

0
        mdRecord.setAttribute("schema", "bla");
        Element mdRecordContent = updatedDocument.createElement("md");
        mdRecord.appendChild(mdRecordContent);
        mdRecordContent.setTextContent("more then bla");
        Node resources = selectSingleNode(updatedDocument, "/content-relation/resources");
        selectSingleNode(updatedDocument, "/content-relation").insertBefore(mdRecordsNew, resources);
        String relationWithNewMdRecord = toString(updatedDocument, false);
 
        // update with new md-record 
        updatedXml = update(this.relationId, relationWithNewMdRecord);
 
        // check md-record element 
        assertXmlValidContentRelation(updatedXml);
        Document updatedRelationDocument = getDocument(updatedXml);
        Node escidocMdRecord = selectSingleNode(updatedRelationDocument, mdRecordPath);
        assertNotNull(escidocMdRecord);
 
    } 
 
    /**