当前位置: 首页>>代码示例>>Java>>正文


Java DOMUtil.createElement方法代码示例

本文整理汇总了Java中com.evolveum.midpoint.util.DOMUtil.createElement方法的典型用法代码示例。如果您正苦于以下问题:Java DOMUtil.createElement方法的具体用法?Java DOMUtil.createElement怎么用?Java DOMUtil.createElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.evolveum.midpoint.util.DOMUtil的用法示例。


在下文中一共展示了DOMUtil.createElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testExtensionPolyString

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionPolyString() throws Exception {
    Session session = getFactory().openSession();

    QName valueName = new QName(NS_P, "polyType");
    ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
    AssertJUnit.assertNotNull(def);

    Element poly = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
    Element orig = DOMUtil.createElement(poly.getOwnerDocument(), new QName(NS_T, "orig"));
    orig.setTextContent("Foo_Bar");
    Element norm = DOMUtil.createElement(poly.getOwnerDocument(), new QName(NS_T, "norm"));
    norm.setTextContent("foo bar");

    poly.appendChild(orig);
    poly.appendChild(norm);

    Object realValue = RAnyConverter.getRealRepoValue(def, poly);
    AssertJUnit.assertEquals(new PolyString("Foo_Bar", "foo bar"), realValue);

    session.close();
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:23,代码来源:RAnyConverterStaticTest.java

示例2: testExtensionInteger

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionInteger() throws Exception {
    Session session = getFactory().openSession();

    QName valueName = new QName(NS_P, "intType");
    ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
    AssertJUnit.assertNotNull(def);

    Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
    value.setTextContent("123");

    Object realValue = RAnyConverter.getRealRepoValue(def, value);
    AssertJUnit.assertEquals(123L, realValue);

    session.close();
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:17,代码来源:RAnyConverterStaticTest.java

示例3: testExtensionLong

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionLong() throws Exception {
    Session session = getFactory().openSession();

    QName valueName = new QName(NS_P, "longType");
    ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
    AssertJUnit.assertNotNull(def);

    Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
    value.setTextContent("123");

    Object realValue = RAnyConverter.getRealRepoValue(def, value);
    AssertJUnit.assertEquals(123L, realValue);

    session.close();
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:17,代码来源:RAnyConverterStaticTest.java

示例4: testExtensionShort

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionShort() throws Exception {
    Session session = getFactory().openSession();

    QName valueName = new QName(NS_P, "shortType");
    ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
    AssertJUnit.assertNotNull(def);

    Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
    value.setTextContent("123");

    Object realValue = RAnyConverter.getRealRepoValue(def, value);
    AssertJUnit.assertEquals(123L, realValue);

    session.close();
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:17,代码来源:RAnyConverterStaticTest.java

示例5: testExtensionDouble

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionDouble() throws Exception {
    Session session = getFactory().openSession();

    QName valueName = new QName(NS_P, "doubleType");
    ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
    AssertJUnit.assertNotNull(def);

    Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
    value.setTextContent("123.1");

    Object realValue = RAnyConverter.getRealRepoValue(def, value);
    AssertJUnit.assertEquals("123.1", realValue);

    session.close();
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:17,代码来源:RAnyConverterStaticTest.java

示例6: testExtensionFloat

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionFloat() throws Exception {
    Session session = getFactory().openSession();

    QName valueName = new QName(NS_P, "floatType");
    ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
    AssertJUnit.assertNotNull(def);

    Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
    value.setTextContent("123.1");

    Object realValue = RAnyConverter.getRealRepoValue(def, value);
    AssertJUnit.assertEquals("123.1", realValue);

    session.close();
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:17,代码来源:RAnyConverterStaticTest.java

示例7: testExtensionString

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionString() throws Exception {
    Session session = getFactory().openSession();

    QName valueName = new QName(NS_P, "floatType");
    ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
    AssertJUnit.assertNotNull(def);

    Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
    value.setTextContent("example");

    Object realValue = RAnyConverter.getRealRepoValue(def, value);
    AssertJUnit.assertEquals("example", realValue);

    session.close();
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:17,代码来源:RAnyConverterStaticTest.java

示例8: testExtensionDecimal

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionDecimal() throws Exception {
    Session session = getFactory().openSession();

    QName valueName = new QName(NS_P, "decimalType");
    ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
    AssertJUnit.assertNotNull(def);

    Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
    value.setTextContent("1234");

    Object realValue = RAnyConverter.getRealRepoValue(def, value);
    AssertJUnit.assertEquals("1234", realValue);

    session.close();
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:17,代码来源:RAnyConverterStaticTest.java

示例9: testUserFullnamePolyString

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testUserFullnamePolyString() throws Exception {
    Session session = getFactory().openSession();

    ItemDefinition def = getDefinition(UserType.class, UserType.F_FULL_NAME);
    AssertJUnit.assertNotNull("Definition not found for " + UserType.F_FULL_NAME, def);

    Element value = DOMUtil.createElement(DOMUtil.getDocument(), UserType.F_FULL_NAME);
    Element orig = DOMUtil.createElement(value.getOwnerDocument(), new QName(NS_T, "orig"));
    orig.setTextContent("john example");
    Element norm = DOMUtil.createElement(value.getOwnerDocument(), new QName(NS_T, "norm"));
    norm.setTextContent("john example");
    value.appendChild(orig);
    value.appendChild(norm);

    Object realValue = RAnyConverter.getRealRepoValue(def, value);
    AssertJUnit.assertEquals(new PolyString("john example", "john example"), realValue);

    session.close();
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:21,代码来源:RAnyConverterStaticTest.java

示例10: testExtensionClob

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
@Test
public void testExtensionClob() throws Exception {
    Session session = getFactory().openSession();

    QName valueName = new QName(NS_P, "locations");
    ItemDefinition def = getDefinition(GenericObjectType.class, new ItemPath(ObjectType.F_EXTENSION, valueName));
    AssertJUnit.assertNotNull(def);

    Document document = DOMUtil.getDocument();
    Element value = DOMUtil.createElement(document, valueName);
    Element location = DOMUtil.createElement(document, new QName(NS_P, "location"));
    value.appendChild(location);
    location.setAttribute("key", "heaven");
    location.setTextContent("somewhere above");

    Object realValue = RAnyConverter.getRealRepoValue(def, value);
    //asserting simple dom
    document = DOMUtil.parseDocument((String) realValue);
    Element root = document.getDocumentElement();
    AssertJUnit.assertNotNull(root);
    AssertJUnit.assertEquals("locations", root.getLocalName());
    AssertJUnit.assertEquals(NS_P, root.getNamespaceURI());
    AssertJUnit.assertEquals(1, DOMUtil.listChildElements(root).size());

    location = DOMUtil.listChildElements(root).get(0);
    AssertJUnit.assertNotNull(location);
    AssertJUnit.assertEquals("location", location.getLocalName());
    AssertJUnit.assertEquals(NS_P, location.getNamespaceURI());
    AssertJUnit.assertEquals(0, DOMUtil.listChildElements(location).size());
    AssertJUnit.assertEquals("heaven", location.getAttribute("key"));
    AssertJUnit.assertEquals("somewhere above", location.getTextContent());

    session.close();
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:35,代码来源:RAnyConverterStaticTest.java

示例11: createAttributeValue

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
private Element createAttributeValue(QName valueName, String xsdType, String textContent) {
    Element value = DOMUtil.createElement(DOMUtil.getDocument(), valueName);
    value.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:xsd", XMLConstants.W3C_XML_SCHEMA_NS_URI);
    value.setAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:type", xsdType);
    value.setTextContent(textContent);

    return value;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:9,代码来源:RAnyConverterStaticTest.java

示例12: createExtensionPath

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
private Element createExtensionPath() {
    Document document = DOMUtil.getDocument();
    Element extension = DOMUtil.createElement(document, DeltaConvertor.PATH_ELEMENT_NAME);
    extension.setAttributeNS(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, "xmlns:c", SchemaConstantsGenerated.NS_COMMON);
    extension.setTextContent("c:extension");

    return extension;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:9,代码来源:RAnyConverterStaticTest.java

示例13: createElement

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
/**
 * Create XML element with the correct namespace prefix and namespace definition.
 * @param qname element QName
 * @return created DOM element
 */
@NotNull
private Element createElement(QName qname, Element parentElement) {
	String namespaceURI = qname.getNamespaceURI();
	if (!StringUtils.isBlank(namespaceURI)) {
		qname = setQNamePrefix(qname);
	}
	if (parentElement != null) {
		return DOMUtil.createElement(doc, qname, parentElement, parentElement);
	} else {
		// This is needed otherwise the root element itself could not be created
           // Caller of this method is responsible for setting the topElement
		return DOMUtil.createElement(doc, qname);
	}
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:20,代码来源:DomLexicalWriter.java

示例14: createElement

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
/**
 * Create XML element with the correct namespace prefix and namespace definition.
 * @param qname element QName
 * @return created DOM element
 */
public Element createElement(QName qname) {
	QName qnameWithPrefix = namespacePrefixMapper.setQNamePrefix(qname);
	addToImport(qname.getNamespaceURI());
	if (rootXsdElement!=null) {
		return DOMUtil.createElement(document, qnameWithPrefix, rootXsdElement, rootXsdElement);
	} else {
		// This is needed otherwise the root element itself could not be created
		return DOMUtil.createElement(document, qnameWithPrefix);
	}
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:16,代码来源:SchemaToDomProcessor.java

示例15: createFakeParentElement

import com.evolveum.midpoint.util.DOMUtil; //导入方法依赖的package包/类
public static Element createFakeParentElement() {
    return DOMUtil.createElement(DOMUtil.getDocument(), CUSTOM_OBJECT);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:4,代码来源:RUtil.java


注:本文中的com.evolveum.midpoint.util.DOMUtil.createElement方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。