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()); } }
public String toString() { return ( "[xmlns:" + jdomNamespace.getPrefix() + "=\"" + jdomNamespace.getURI() + "\", element=" + jdomElement.getName() + "]" ); } }
if ( !nsMap.containsKey(ns.getPrefix()) ) nsMap.put( ns.getPrefix(), new XPathNamespace(elem, ns) ); if ( !nsMap.containsKey(ns.getPrefix()) ) nsMap.put( ns.getPrefix(), new XPathNamespace(elem, ns) ); if ( !nsMap.containsKey(attrNS.getPrefix()) ) nsMap.put( attrNS.getPrefix(), new XPathNamespace(elem, attrNS) );
private void declare(Namespace ns) { prefix2decNs.put(ns.getPrefix(), ns); namespaces.add(ns); }
private void declare(Namespace ns) { prefix2decNs.put(ns.getPrefix(), ns); namespaces.add(ns); }
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()); } }
/** * This will add a new <code>{@link Namespace}</code> * to those currently available. * * @param ns <code>Namespace</code> to add. */ public void push(Namespace ns) { prefixes.push(ns.getPrefix()); uris.push(ns.getURI()); }
/** * This will add a new <code>{@link Namespace}</code> to those currently available. * * @param ns <code>Namespace</code> to add. */ public void push(Namespace ns) { prefixes.push(ns.getPrefix()); uris.push(ns.getURI()); }
private void writeObject(final ObjectOutputStream out) throws IOException { out.defaultWriteObject(); // We use writeObject() and not writeUTF() to minimize space // This allows for writing pointers to already written strings out.writeObject(namespace.getPrefix()); out.writeObject(namespace.getURI()); }
/** * This will add a new <code>{@link Namespace}</code> * to those currently available. * * @param ns <code>Namespace</code> to add. */ public void push( Namespace ns ) { prefixes.push( ns.getPrefix() ); uris.push( ns.getURI() ); }
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 void printQualifiedName(Writer out, Attribute a) throws IOException { String prefix = a.getNamespace().getPrefix(); if ((prefix != null) && (!prefix.equals(""))) { out.write(prefix); out.write(':'); } printName(out, a); }
private void printQualifiedName(Writer out, Attribute a) throws IOException { String prefix=a.getNamespace().getPrefix(); if ((prefix != null) && (!prefix.equals(""))) { out.write(prefix); out.write(':'); out.write(a.getName()); } else { out.write(a.getName()); } }
public List operate(Object node) { if (node instanceof Element) return Collections12.singletonList(((Element)node).getNamespace().getPrefix()); else if (node instanceof Attribute) return Collections12.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()); } }
private boolean shouldDeclare(Namespace ns) { if (ns == Namespace.XML_NAMESPACE) { return false; } if (ns == Namespace.NO_NAMESPACE && getDeclaredURI("") == null) { return false; } String decUri = getDeclaredURI(ns.getPrefix()); return !(decUri != null && decUri.equals(ns.getURI())); }
private boolean shouldDeclare(Namespace ns) { if (ns == Namespace.XML_NAMESPACE) return false; if (ns == Namespace.NO_NAMESPACE && getDeclaredURI("") == null) return false; String decUri = getDeclaredURI(ns.getPrefix()); return !(decUri != null && decUri.equals(ns.getURI())); }
private boolean shouldDeclare(Namespace ns) { if (ns == Namespace.XML_NAMESPACE) { return false; } if (ns == Namespace.NO_NAMESPACE && getDeclaredURI("") == null) { return false; } String decUri = getDeclaredURI(ns.getPrefix()); return !(decUri != null && decUri.equals(ns.getURI())); }