@Override public ProcessingInstruction createClone () { return new ProcessingInstruction (target, text); }
@Override public XMLDeclaration copy () { return (XMLDeclaration)super.copy (); } }
public static boolean isXMLDeclaration (ProcessingInstruction pi) { return "xml".equalsIgnoreCase (pi.getTarget ()); }
if (xmlDeclaration != null) xmlDeclaration.parseXMLDeclaration (pi.getValue ()); if (pi.getToken () == null) ex.setNode (this, pi); else ex.setSource (pi.getToken ().getSource (), pi.getStartOffset () + e.getOffset ()); throw ex;
public ProcessingInstruction setText (String text) { this.text = text; updateValue (); return this; }
protected void updateValue () { int pos; for (pos = 0; pos < text.length (); pos ++) { char c = text.charAt (pos); if (!Character.isWhitespace (c)) break; } if (pos == 0 && text.length () != 0) whitespace = " "; else whitespace = ""; setValue ("<?" + target + whitespace + text + "?>"); }
public static XMLDeclaration parseXMLDeclaration (ProcessingInstruction pi) { XMLDeclaration decl = new XMLDeclaration ("1.0"); decl.parseXMLDeclaration (pi.getValue ()); return decl; }
public void setTarget (String target) { this.target = target; updateValue (); }
public ProcessingInstruction (String target, String text) { super (Type.PROCESSING_INSTRUCTION, null); if (target == null) throw new IllegalArgumentException ("target is null"); if (target.trim ().length () == 0) throw new IllegalArgumentException ("target is blank or empty"); if (text == null) text = ""; if (text.contains ("?>")) throw new IllegalArgumentException ("text must not contain '?>'"); this.target = target.trim (); this.whitespace = ""; this.text = text; updateValue (); }
protected Node createProcessingInstruction (Token token) { return new ProcessingInstruction (token); }
@Override public XMLDeclaration copy (Node orig) { super.copy (orig); XMLDeclaration other = (XMLDeclaration)orig; this.encoding = other.encoding; this.encodingEquals = other.encodingEquals; this.encodingQuote = other.encodingQuote; this.encodingSpace = other.encodingSpace; this.postSpace = other.postSpace; this.showStandaloneNo = other.showStandaloneNo; this.standalone = other.standalone; this.standaloneEquals = other.standaloneEquals; this.standaloneQuote = other.standaloneQuote; this.standaloneSpace = other.standaloneSpace; this.version = other.version; this.versionEquals = other.versionEquals; this.versionQuote = other.versionQuote; this.versionSpace = other.versionSpace; return this; }