本文整理了Java中org.jdom.Element.getDocument()
方法的一些代码示例,展示了Element.getDocument()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getDocument()
方法的具体详情如下:
包路径:org.jdom.Element
类名称:Element
方法名:getDocument
暂无
代码示例来源:origin: jaxen/jaxen
public Object getDocumentNode(Object contextNode)
{
if ( contextNode instanceof Document )
{
return contextNode;
}
Element elem = (Element) contextNode;
return elem.getDocument();
}
代码示例来源:origin: go-lang-plugin-org/go-lang-idea-plugin
private static void saveFile(@NotNull File file, @NotNull Element rootElement, String errorMessage) throws CannotConvertException {
try {
JDOMUtil.writeDocument(rootElement.getDocument(), file, SystemProperties.getLineSeparator());
}
catch (IOException e) {
throw new CannotConvertException(errorMessage, e);
}
}
代码示例来源:origin: org.freemarker/freemarker
@Override
Object getDocument(Object node) {
if (node instanceof Element) {
return ((Element) node).getDocument();
} else if (node instanceof Attribute) {
Element parent = ((Attribute) node).getParent();
return parent == null ? null : parent.getDocument();
} else if (node instanceof Text) {
Element parent = ((Text) node).getParent();
return parent == null ? null : parent.getDocument();
} else if (node instanceof Document)
return node;
else if (node instanceof ProcessingInstruction) {
return ((ProcessingInstruction) node).getDocument();
} else if (node instanceof EntityRef) {
return ((EntityRef) node).getDocument();
} else if (node instanceof Comment) {
return ((Comment) node).getDocument();
}
return null;
}
代码示例来源:origin: org.freemarker/freemarker
public List operate(Object node) {
Document doc = null;
if (node instanceof Element)
doc = ((Element) node).getDocument();
else if (node instanceof Attribute) {
Element parent = ((Attribute) node).getParent();
doc = parent == null ? null : parent.getDocument();
} else if (node instanceof Text) {
Element parent = ((Text) node).getParent();
doc = parent == null ? null : parent.getDocument();
} else if (node instanceof Document)
doc = (Document) node;
else if (node instanceof ProcessingInstruction)
doc = ((ProcessingInstruction) node).getDocument();
else if (node instanceof EntityRef)
doc = ((EntityRef) node).getDocument();
else if (node instanceof Comment)
doc = ((Comment) node).getDocument();
else
// With 2.1 semantics it makes more sense to just return a null and let the core
// throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
return null;
// throw new TemplateModelException("_document can not be applied on " + node.getClass());
return doc == null ? Collections.EMPTY_LIST : Collections.singletonList(doc);
}
}
代码示例来源:origin: jaxen/jaxen
parent = ((Element)contextNode).getDocument();
代码示例来源:origin: org.jibx/jibx-extras
/**
* Creates a new instance with the given Element as target for marshalling.
*
* @param namespaces Namespaces list
* @param currentElement must not be null
*/
public JDOMWriter(String[] namespaces, Element currentElement) {
this(namespaces, currentElement.getDocument());
this.currentElement = currentElement;
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public Document getDocument()
{
return element.getDocument();
}
代码示例来源:origin: org.jasig.cas/cas-server-support-saml
/**
* Convert the received jdom element to an Element.
*
* @param element the element
* @return the org.w3c.dom. element
*/
private org.w3c.dom.Element toDom(final org.jdom.Element element) {
return toDom(element.getDocument()).getDocumentElement();
}
代码示例来源:origin: org.jdom/jdom-legacy
/**
* This retrieves the owning <code>{@link Document}</code> for
* this Attribute, or null if not a currently a member of a
* <code>{@link Document}</code>.
*
* @return <code>Document</code> owning this Attribute, or null.
*/
public Document getDocument() {
final Element parentElement = getParent();
if (parentElement != null) {
return parentElement.getDocument();
}
return null;
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-impl
protected void setupNamespaces(Element schemaElement) {
Element rootElement = null;
if (schemaElement.getDocument() == null) {
rootElement = schemaElement;
}
else {
rootElement = schemaElement.getDocument().getRootElement();
}
xsdNamespace = rootElement.getNamespace();
if (rootElement.getAttribute("targetNamespace") != null) {
targetNamespace = Namespace.getNamespace(rootElement.getAttributeValue("targetNamespace"));
}
else {
targetNamespace = Namespace.NO_NAMESPACE;
}
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-impl
public void nullSafeSet(PreparedStatement st, Object value, int index)
throws HibernateException, SQLException {
if (value == null) {
st.setNull(index, Types.VARBINARY);
}
else {
SchemaNode schemaNode = (SchemaNode) value;
Document doc = schemaNode.getSchemaElement().getDocument();
ByteArrayOutputStream out = new ByteArrayOutputStream();
XMLOutputter xmlOutputter = new XMLOutputter();
try {
xmlOutputter.output(doc, out);
}
catch (IOException e) {
throw new HibernateException(e);
}
st.setBytes(index, out.toByteArray());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
@Override
Object getDocument(Object node) {
if (node instanceof Element) {
return ((Element) node).getDocument();
} else if (node instanceof Attribute) {
Element parent = ((Attribute) node).getParent();
return parent == null ? null : parent.getDocument();
} else if (node instanceof Text) {
Element parent = ((Text) node).getParent();
return parent == null ? null : parent.getDocument();
} else if (node instanceof Document)
return node;
else if (node instanceof ProcessingInstruction) {
return ((ProcessingInstruction) node).getDocument();
} else if (node instanceof EntityRef) {
return ((EntityRef) node).getDocument();
} else if (node instanceof Comment) {
return ((Comment) node).getDocument();
}
return null;
}
代码示例来源:origin: org.freemarker/freemarker-gae
public List operate(Object node) {
Document doc = null;
if (node instanceof Element)
doc = ((Element) node).getDocument();
else if (node instanceof Attribute) {
Element parent = ((Attribute) node).getParent();
doc = parent == null ? null : parent.getDocument();
} else if (node instanceof Text) {
Element parent = ((Text) node).getParent();
doc = parent == null ? null : parent.getDocument();
} else if (node instanceof Document)
doc = (Document) node;
else if (node instanceof ProcessingInstruction)
doc = ((ProcessingInstruction) node).getDocument();
else if (node instanceof EntityRef)
doc = ((EntityRef) node).getDocument();
else if (node instanceof Comment)
doc = ((Comment) node).getDocument();
else
// With 2.1 semantics it makes more sense to just return a null and let the core
// throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
return null;
// throw new TemplateModelException("_document can not be applied on " + node.getClass());
return doc == null ? Collections.EMPTY_LIST : Collections.singletonList(doc);
}
}
代码示例来源:origin: org.freemarker/freemarker-gae
@Override
Object getDocument(Object node) {
if (node instanceof Element) {
return ((Element) node).getDocument();
} else if (node instanceof Attribute) {
Element parent = ((Attribute) node).getParent();
return parent == null ? null : parent.getDocument();
} else if (node instanceof Text) {
Element parent = ((Text) node).getParent();
return parent == null ? null : parent.getDocument();
} else if (node instanceof Document)
return node;
else if (node instanceof ProcessingInstruction) {
return ((ProcessingInstruction) node).getDocument();
} else if (node instanceof EntityRef) {
return ((EntityRef) node).getDocument();
} else if (node instanceof Comment) {
return ((Comment) node).getDocument();
}
return null;
}
代码示例来源:origin: org.freemarker/com.springsource.freemarker
Object getDocument(Object node) {
if (node instanceof Element) {
return ((Element)node).getDocument();
}
else if (node instanceof Attribute) {
Element parent = ((Attribute)node).getParent();
return parent == null ? null : parent.getDocument();
}
else if (node instanceof Text) {
Element parent = ((Text)node).getParent();
return parent == null ? null : parent.getDocument();
}
else if (node instanceof Document)
return node;
else if (node instanceof ProcessingInstruction) {
return ((ProcessingInstruction)node).getDocument();
}
else if (node instanceof EntityRef) {
return ((EntityRef)node).getDocument();
}
else if (node instanceof Comment) {
return ((Comment)node).getDocument();
}
return null;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker
public List operate(Object node) {
Document doc = null;
if (node instanceof Element)
doc = ((Element) node).getDocument();
else if (node instanceof Attribute) {
Element parent = ((Attribute) node).getParent();
doc = parent == null ? null : parent.getDocument();
} else if (node instanceof Text) {
Element parent = ((Text) node).getParent();
doc = parent == null ? null : parent.getDocument();
} else if (node instanceof Document)
doc = (Document) node;
else if (node instanceof ProcessingInstruction)
doc = ((ProcessingInstruction) node).getDocument();
else if (node instanceof EntityRef)
doc = ((EntityRef) node).getDocument();
else if (node instanceof Comment)
doc = ((Comment) node).getDocument();
else
// With 2.1 semantics it makes more sense to just return a null and let the core
// throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
return null;
// throw new TemplateModelException("_document can not be applied on " + node.getClass());
return doc == null ? Collections.EMPTY_LIST : Collections.singletonList(doc);
}
}
代码示例来源:origin: org.freemarker/com.springsource.freemarker
public List operate(Object node)
{
Document doc = null;
if (node instanceof Element)
doc = ((Element)node).getDocument();
else if (node instanceof Attribute) {
Element parent = ((Attribute)node).getParent();
doc = parent == null ? null : parent.getDocument();
} else if (node instanceof Text) {
Element parent = ((Text)node).getParent();
doc = parent == null ? null : parent.getDocument();
} else if (node instanceof Document)
doc = (Document)node;
else if (node instanceof ProcessingInstruction)
doc = ((ProcessingInstruction)node).getDocument();
else if (node instanceof EntityRef)
doc = ((EntityRef)node).getDocument();
else if (node instanceof Comment)
doc = ((Comment)node).getDocument();
else
// With 2.1 semantics it makes more sense to just return a null and let the core
// throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
return null;
// throw new TemplateModelException("_document can not be applied on " + node.getClass());
return doc == null ? Collections.EMPTY_LIST : Collections12.singletonList(doc);
}
}
代码示例来源:origin: com.ebmwebsourcing.easybpel/easybpel.xpath.exp.impl
if(source.getDocument() == null) {
new Document(source);
代码示例来源:origin: com.ebmwebsourcing.easybpel/easybpel.xpath.exp.impl
public Element process() throws XPathExpressionException {
Element res = null;
if ((this.xslStyleSheet == null)||(this.nodeset == null)) {
throw new XPathExpressionException(
"Wrong number of argument for the bpws:doXslTransform function.");
}
try {
// transform jdom to dom
final DOMOutputter converter = new DOMOutputter();
final org.w3c.dom.Document domDocument = converter.output(this.nodeset.getDocument());
final Document doc = DoXslTransformFunctionImpl.process(this.xslStyleSheet, domDocument, this.xslParams);
// transform dom to jdom
final DOMBuilder builder = new DOMBuilder();
final org.jdom.Document jdomDocument = builder.build(doc);
res = jdomDocument.getRootElement();
} catch (final JDOMException e) {
throw new XPathExpressionException(e);
}
return res;
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-impl
schema.getSchemaElement().getDocument().getRootElement());
if (externalType != null) {
schemaElement.addContent((Content) externalType.clone());
内容来源于网络,如有侵权,请联系作者删除!