public Object getDocumentNode(Object contextNode) { if ( contextNode instanceof Document ) { return contextNode; } Element elem = (Element) contextNode; return elem.getDocument(); }
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); } }
@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; }
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); } }
parent = ((Element)contextNode).getDocument();
/** * 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; }
public Document getDocument() { return element.getDocument(); }
/** * 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(); }
/** * 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; }
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; } }
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()); } }
@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; }
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); } }
@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; }
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; }
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); } }
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); } }
if(source.getDocument() == null) { new Document(source);
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; }
schema.getSchemaElement().getDocument().getRootElement()); if (externalType != null) { schemaElement.addContent((Content) externalType.clone());