@Override public boolean isConversionNeeded() { Element component = getProjectRootManager(context); return component != null && isGoSdkType(component.getAttributeValue(ProjectRootManagerImpl.PROJECT_JDK_TYPE_ATTR)); }
public List operate(Object node) { if (node instanceof Element) return((Element) node).getContent(); else if (node instanceof Document) return((Document) node).getContent(); // 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("_content can not be applied on " + node.getClass()); } }
@Override String getNamespacePrefix(Object node) { if (node instanceof Element) { return ((Element) node).getNamespacePrefix(); } if (node instanceof Attribute) { return ((Attribute) node).getNamespacePrefix(); } return null; }
public List operate(Object node) { if (node instanceof Element) { Element element = (Element) node; return Collections.singletonList(element.getNamespace().getURI() + element.getName()); } else if (node instanceof Attribute) { Attribute attribute = (Attribute) node; return Collections.singletonList(attribute.getNamespace().getURI() + attribute.getName()); } // 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("_cname can not be applied on " + node.getClass()); } }
/** * @since 1.2 * @deprecated As of 1.4, use {@link JDomReader#JDomReader(Document, NameCoder)} instead. */ public JDomReader(Document document, XmlFriendlyReplacer replacer) { this(document.getRootElement(), (NameCoder)replacer); }
protected Object createNode(final String name) { final Element element = documentFactory.element(encodeNode(name)); final Element parent = top(); if (parent != null) { parent.addContent(element); } return element; }
public List operate(Object node) { if (node instanceof Element) return Collections.singletonList(((Element) node).getNamespace().getURI()); else if (node instanceof Attribute) return Collections.singletonList(((Attribute) node).getNamespace().getURI()); // 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("_nsuri can not be applied on " + node.getClass()); } }
@Override public void writeExternal(Element element) { super.writeExternal(element); if (myCommand != null) { element.setAttribute(COMMAND_ATTRIBUTE, myCommand); } }
public List operate(Object node) { if (node instanceof Element) return Collections.singletonList(((Element) node).getNamespace().getPrefix()); else if (node instanceof Attribute) return Collections.singletonList(((Attribute) node).getNamespace().getPrefix()); // 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("_nsprefix can not be applied on " + node.getClass()); } }
protected Object getParent() { // JDOM 1.0: return currentElement.getParentElement(); // JDOM b10: // Parent parent = currentElement.getParent(); // return (parent instanceof Element) ? (Element)parent : null; // JDOM b9 and earlier: // return currentElement.getParent(); }
@Override String getNamespaceUri(Object node) { if (node instanceof Element) { return ((Element) node).getNamespaceURI(); } if (node instanceof Attribute) { return ((Attribute) node).getNamespaceURI(); } return null; }
public List operate(Object node) { if (node instanceof Element) return Collections.singletonList(((Element) node).getQualifiedName()); else if (node instanceof Attribute) return Collections.singletonList(((Attribute) node).getQualifiedName()); // 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("_qname can not be applied on " + node.getClass()); } }
/** * @since 1.4 */ public JDomWriter(final Element container, final NameCoder nameCoder) { this(container, new DefaultJDOMFactory(), nameCoder); }
@Override Object getDocumentType(Object node) { return node instanceof Document ? ((Document) node).getDocType() : null; }
/** * @since 1.4 */ public JDomReader(Document document, NameCoder nameCoder) { super(document.getRootElement(), nameCoder); }
@Override public void readExternal(Element element) { super.readExternal(element); String command = element.getAttributeValue(COMMAND_ATTRIBUTE); if (command != null) { myCommand = command; } }
@Override void getContent(Object node, List result) { if (node instanceof Element) result.addAll(((Element) node).getContent()); else if (node instanceof Document) result.addAll(((Document) node).getContent()); }
/** * @since 1.2.1 * @deprecated As of 1.4 use {@link JDomWriter#JDomWriter(Element, NameCoder)} instead. */ public JDomWriter(final Element container, final XmlFriendlyReplacer replacer) { this(container, new DefaultJDOMFactory(), (NameCoder)replacer); }