@Override public EntityRef clone() { return (EntityRef)super.clone(); } }
@Override public Text detach() { return (Text)super.detach(); }
/** * Returns the XPath 1.0 string value of this element, which is the * complete, ordered content of all text node descendants of this element * (i.e. the text that's left after all references are resolved * and all other markup is stripped out.) * * @return a concatentation of all text node descendants */ @Override public String getValue() { final StringBuilder buffer = new StringBuilder(); for (Content child : getContent()) { if (child instanceof Element || child instanceof Text) { buffer.append(child.getValue()); } } return buffer.toString(); }
throw new DocumentException(patchContent.getDocument(), "Contents of type " + patchContent.getClass().getName() + " in patch document not supported"); parentOut.addContent((Content) origContent.clone()); throw new DocumentException(origContent.getDocument(), "Contents of type " + origContent.getClass().getName() + " in original document not supported");
/** * JDOM will throw an exception if we try and add the content to multiple parents. * As a result, we take the opportunity to add it safely, and add a note indicating * this content appears twice. * * @param cell the element to be added * @param xmlContent the collector of content */ private void addContentSafely(final Element cell, final List<Content> xmlContent) { Element note = null; for (Content c : xmlContent) { if (c.getParent() == null) { cell.addContent(c); } else if (note != null) { note.addContent(c.clone()); } else { //we're in the situation where we have added this already. //add note. In this case, we wrap the content that has already been applied. note = appendVersificationNotice(cell, "duplicate"); note.addContent(c.clone()); } } }
private final boolean isTextLike(final int pos) { switch (get(pos).getCType()) { case Text: case CDATA: case EntityRef: return true; default: // nothing. } return false; }
@Override public Element getParent() { // because DocType can only be attached to a Document. return (Element)super.getParent(); }
while (contents.hasNext()) { Content web_app_content = contents.next(); if (!web_app_content.getCType().equals(CType.Text) && !web_app_content.getCType().equals(CType.Comment)) boolean withGml = (web_app_content.getNamespacesInScope().get(0).getPrefix().contains("gml")); if(withGml) boolean parentNotGml = !(web_app_content.getParentElement().getNamespace().getPrefix().contains("gml")); if(parentNotGml)
@Override public final Object getDocumentNode(Object contextNode) { if (contextNode instanceof Document) { return contextNode; } if (contextNode instanceof NamespaceContainer) { return ((NamespaceContainer)contextNode).getParentElement().getDocument(); } if (contextNode instanceof Attribute) { return ((Attribute)contextNode).getDocument(); } return ((Content)contextNode).getDocument(); }
@Override public List<Namespace> getNamespacesInherited() { // Element class will override return getNamespacesInScope(); }
if (c instanceof Text) { if (!Verifier.isAllXMLWhitespace(c.getValue())) { break; if (c instanceof Text) { if (!Verifier.isAllXMLWhitespace(c.getValue())) { break; switch (c.getCType()) { case Text : mtext.appendText(trim, c.getValue()); break; case CDATA : mtext.appendCDATA(trim, c.getValue()); break; case EntityRef:
parentOut.addContent((Content) content1.clone()); offsetTreated1++; throw new DocumentException(content1.getDocument(), "Contents of type " + content1.getClass().getName() + " not supported"); throw new DocumentException(list2[j].getDocument(), "Contents of type " + list2[j].getClass().getName() + " not supported"); contentToAdd = (Content) list2[offsetTreated2].clone(); parentOut.addContent(contentToAdd); contentToAdd = (Content) list2[offsetTreated2].clone(); parentOut.addContent(contentToAdd);
/** * Create a Walker that preserves all content in its raw state. * @param content the content to walk. */ public WalkerPRESERVE(List<? extends Content> content) { super(); size = content.size(); if (size == 0) { alltext = true; } else { boolean atext = true; int i = size; while (--i > 0 && atext) { switch (content.get(i).getCType()) { case Text : case CDATA : case EntityRef : break; default : atext = false; } } alltext = atext; } this.content = content; }
@Override public Element getParent() { // because DocType can only be attached to a Document. return (Element)super.getParent(); }
@Override public Text clone() { Text text = (Text)super.clone(); text.value = value; return text; }
@Override public DocType detach() { return (DocType)super.detach(); }