Java Code Examples for org.dom4j.Node#setText()

The following examples show how to use org.dom4j.Node#setText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClobType.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) {
	if (value!=null) {
		Clob clob = (Clob) value;
		try {
			int len = (int) clob.length();
			node.setText( clob.getSubString(0, len) );
		}
		catch (SQLException sqle) {
			throw new HibernateException("could not read XML from Clob", sqle);
		}
	}
}
 
Example 2
Source File: ContentServiceImpl.java    From studio with GNU General Public License v3.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected Document replaceCopyDependency(Document document, String depPath, String copyDepPath) {
    Element root = document.getRootElement();
    List<Node> includes = root.selectNodes(COPY_DEP_XPATH.replace(COPY_DEP, depPath));
    if (includes != null) {
        for(Node includeNode : includes) {
            includeNode.setText(includeNode.getText().replace(depPath, copyDepPath));
        }
    }
    return document;
}
 
Example 3
Source File: ImmutableType.java    From hibernate-types with Apache License 2.0 4 votes vote down vote up
@Override
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) throws HibernateException {
    node.setText(toLoggableString(value, factory));
}
 
Example 4
Source File: ImmutableType.java    From hibernate-types with Apache License 2.0 4 votes vote down vote up
@Override
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) throws HibernateException {
    node.setText(toLoggableString(value, factory));
}
 
Example 5
Source File: NullableType.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setToXMLNode(Node xml, Object value, SessionFactoryImplementor factory)
throws HibernateException {
	xml.setText( toXMLString(value, factory) );
}
 
Example 6
Source File: CustomType.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory)
throws HibernateException {
	node.setText( toXMLString(value, factory) );
}
 
Example 7
Source File: MetaType.java    From cacheonix-core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) throws HibernateException {
	node.setText( toXMLString(value, factory) );
}
 
Example 8
Source File: ContentServiceImpl.java    From studio with GNU General Public License v3.0 4 votes vote down vote up
@SuppressWarnings("unchecked")
protected Document updateContentOnCopy(Document document, String filename, String folder, Map<String,
    String> params, String modifier)
        throws ServiceLayerException {

    //update pageId and groupId with the new one
    Element root = document.getRootElement();
    String originalPageId = null;
    String originalGroupId = null;

    Node filenameNode = root.selectSingleNode("//" + DmXmlConstants.ELM_FILE_NAME);
    if (filenameNode != null) {
        filenameNode.setText(filename);
    }

    Node folderNode = root.selectSingleNode("//" + DmXmlConstants.ELM_FOLDER_NAME);
    if (folderNode != null) {
        folderNode.setText(folder);
    }

    Node pageIdNode = root.selectSingleNode("//" + DmXmlConstants.ELM_PAGE_ID);
    if (pageIdNode != null) {
        originalPageId = pageIdNode.getText();
        pageIdNode.setText(params.get(DmConstants.KEY_PAGE_ID));
    }

    if(modifier != null) {
        Node internalNameNode = root.selectSingleNode("//" + DmXmlConstants.ELM_INTERNAL_NAME);
        if (internalNameNode != null) {
            String internalNameValue = internalNameNode.getText();
            internalNameNode.setText(internalNameValue + " " + modifier);
        }
    }

    Node groupIdNode = root.selectSingleNode("//" + DmXmlConstants.ELM_GROUP_ID);
    if (groupIdNode != null) {
        originalGroupId = groupIdNode.getText();
        groupIdNode.setText(params.get(DmConstants.KEY_PAGE_GROUP_ID));
    }

    List<Node> keys = root.selectNodes("//key");
    if (keys != null) {
        for(Node keyNode : keys) {
            String keyValue = keyNode.getText();
            keyValue = keyValue.replaceAll(originalPageId, params.get(DmConstants.KEY_PAGE_ID));
            keyValue = keyValue.replaceAll(originalGroupId, params.get(DmConstants.KEY_PAGE_GROUP_ID));

            if(keyValue.contains("/page")) {
                keyNode.setText(keyValue);
            }
        }
    }

    List<Node> includes = root.selectNodes("//include");
    if (includes != null) {
        for(Node includeNode : includes) {
            String includeValue = includeNode.getText();
            includeValue = includeValue.replaceAll(originalPageId, params.get(DmConstants.KEY_PAGE_ID));
            includeValue = includeValue.replaceAll(originalGroupId, params.get(DmConstants.KEY_PAGE_GROUP_ID));

            if(includeValue.contains("/page")) {
                includeNode.setText(includeValue);
            }
        }
    }

    return document;
}