List of usage examples for org.dom4j DocumentFactory createAttribute
public Attribute createAttribute(Element owner, String name, String value)
From source file:com.liferay.portal.xml.SAXReaderImpl.java
License:Open Source License
public Attribute createAttribute(Element element, QName qName, String value) { ElementImpl elementImpl = (ElementImpl) element; QNameImpl qNameImpl = (QNameImpl) qName; DocumentFactory documentFactory = DocumentFactory.getInstance(); return new AttributeImpl(documentFactory.createAttribute(elementImpl.getWrappedElement(), qNameImpl.getWrappedQName(), value)); }
From source file:com.liferay.portal.xml.SAXReaderImpl.java
License:Open Source License
public Attribute createAttribute(Element element, String name, String value) { ElementImpl elementImpl = (ElementImpl) element; DocumentFactory documentFactory = DocumentFactory.getInstance(); return new AttributeImpl(documentFactory.createAttribute(elementImpl.getWrappedElement(), name, value)); }
From source file:org.orbeon.oxf.xml.dom4j.Dom4jUtils.java
License:Open Source License
public static Attribute createAttribute(final QName qName, final String value) { final DocumentFactory factory = NonLazyUserDataDocumentFactory.getInstance(); return factory.createAttribute(null, qName, value); }
From source file:org.talend.updates.runtime.nexus.component.ComponentIndexManager.java
License:Open Source License
Element createXmlElement(ComponentIndexBean indexBean) {
if (indexBean == null) {
return null;
}// w ww. ja va 2 s .c o m
if (!indexBean.validRequired()) {
return null; // no valid
}
final DocumentFactory docFactory = DocumentFactory.getInstance();
final Element component = docFactory.createElement(ComponentIndexManager.ELEM_COMPONENT);
for (ComponentIndexNames in : ComponentIndexNames.values()) {
final String value = indexBean.getValue(in);
if (StringUtils.isBlank(value)) {
continue; // not value
}
switch (in) {
case name:
case bundle_id:
case version:
case mvn_uri:
case license_uri:
case product:
case image_mvn_uri:
case types:
case categories:
case degradable:
case compatibleStudioVersion:
default:
// attribute
component.add(docFactory.createAttribute(component, in.getName(), value));
break;
case description:
case license:
// child element
final Element child = docFactory.createElement(in.getName());
child.setText(value);
component.add(child);
break;
}
}
return component;
}