| 1 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 2 | // Copyright (c) 2018 Saxonica Limited. |
| 3 | // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. |
| 4 | // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. |
| 6 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 7 | |
| 8 | package net.sf.saxon.dom; |
| 9 | |
| 10 | import org.w3c.dom.DOMException; |
| 11 | import org.w3c.dom.ProcessingInstruction; |
| 12 | |
| 13 | /** |
| 14 | * This class is an implementation of the DOM ProcessingInstruction interface that wraps a Saxon NodeInfo |
| 15 | * representation of a text or comment node. |
| 16 | */ |
| 17 | |
| 18 | public class PIOverNodeInfo extends NodeOverNodeInfo implements ProcessingInstruction { |
| 19 | |
| 20 | /** |
| 21 | * The target of this processing instruction. XML defines this as being |
| 22 | * the first token following the markup that begins the processing |
| 23 | * instruction. |
| 24 | */ |
| 25 | public String getTarget() { |
| 26 | return node.getLocalPart(); |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * The content of this processing instruction. This is from the first non |
| 31 | * white space character after the target to the character immediately |
| 32 | * preceding the <code>?></code>. |
| 33 | */ |
| 34 | public String getData() { |
| 35 | return node.getStringValue(); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * The content of this processing instruction. This is from the first non |
| 40 | * white space character after the target to the character immediately |
| 41 | * preceding the <code>?></code>. |
| 42 | * |
| 43 | * @throws org.w3c.dom.DOMException NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly. |
| 44 | */ |
| 45 | public void setData(String data) throws DOMException { |
| 46 | disallowUpdate(); |
| 47 | } |
| 48 | } |
| 49 |