com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl Java Examples
The following examples show how to use
com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DOMResultBuilder.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #2
Source File: DOMResultBuilder.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #3
Source File: DOMResultBuilder.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #4
Source File: DOMResultBuilder.java From hottub with GNU General Public License v2.0 | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #5
Source File: DOMResultBuilder.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #6
Source File: DOMResultBuilder.java From Bytecoder with Apache License 2.0 | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #7
Source File: DOMResultBuilder.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #8
Source File: DOMResultBuilder.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #9
Source File: DOMResultBuilder.java From JDKSourceCode1.8 with MIT License | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #10
Source File: DOMResultBuilder.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #11
Source File: DOMResultBuilder.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void setDOMResult(DOMResult result) { fCurrentNode = null; fFragmentRoot = null; fIgnoreChars = false; fTargetChildren.clear(); if (result != null) { fTarget = result.getNode(); fNextSibling = result.getNextSibling(); fDocument = (fTarget.getNodeType() == Node.DOCUMENT_NODE) ? (Document) fTarget : fTarget.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fTarget = null; fNextSibling = null; fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #12
Source File: XSAnnotationImpl.java From Bytecoder with Apache License 2.0 | 5 votes |
private synchronized void writeToDOM(Node target, short type) { Document futureOwner = (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document)target; DOMParser parser = fGrammar.getDOMParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } Document aDocument = parser.getDocument(); parser.dropDocumentReferences(); Element annotation = aDocument.getDocumentElement(); Node newElem = null; if (futureOwner instanceof CoreDocumentImpl) { newElem = futureOwner.adoptNode(annotation); // adoptNode will return null when the DOM implementations are not compatible. if (newElem == null) { newElem = futureOwner.importNode(annotation, true); } } else { newElem = futureOwner.importNode(annotation, true); } target.insertBefore(newElem, target.getFirstChild()); }
Example #13
Source File: XSAnnotationImpl.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private synchronized void writeToDOM(Node target, short type) { Document futureOwner = (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document)target; DOMParser parser = fGrammar.getDOMParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } Document aDocument = parser.getDocument(); parser.dropDocumentReferences(); Element annotation = aDocument.getDocumentElement(); Node newElem = null; if (futureOwner instanceof CoreDocumentImpl) { newElem = futureOwner.adoptNode(annotation); // adoptNode will return null when the DOM implementations are not compatible. if (newElem == null) { newElem = futureOwner.importNode(annotation, true); } } else { newElem = futureOwner.importNode(annotation, true); } target.insertBefore(newElem, target.getFirstChild()); }
Example #14
Source File: DOMResultAugmentor.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public void setDOMResult(DOMResult result) { fIgnoreChars = false; if (result != null) { final Node target = result.getNode(); fDocument = (target.getNodeType() == Node.DOCUMENT_NODE) ? (Document) target : target.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #15
Source File: DOMResultAugmentor.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void setDOMResult(DOMResult result) { fIgnoreChars = false; if (result != null) { final Node target = result.getNode(); fDocument = (target.getNodeType() == Node.DOCUMENT_NODE) ? (Document) target : target.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #16
Source File: XSAnnotationImpl.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private synchronized void writeToDOM(Node target, short type) { Document futureOwner = (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document)target; DOMParser parser = fGrammar.getDOMParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } Document aDocument = parser.getDocument(); parser.dropDocumentReferences(); Element annotation = aDocument.getDocumentElement(); Node newElem = null; if (futureOwner instanceof CoreDocumentImpl) { newElem = futureOwner.adoptNode(annotation); // adoptNode will return null when the DOM implementations are not compatible. if (newElem == null) { newElem = futureOwner.importNode(annotation, true); } } else { newElem = futureOwner.importNode(annotation, true); } target.insertBefore(newElem, target.getFirstChild()); }
Example #17
Source File: XSAnnotationImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
private synchronized void writeToDOM(Node target, short type) { Document futureOwner = (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document)target; DOMParser parser = fGrammar.getDOMParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } Document aDocument = parser.getDocument(); parser.dropDocumentReferences(); Element annotation = aDocument.getDocumentElement(); Node newElem = null; if (futureOwner instanceof CoreDocumentImpl) { newElem = futureOwner.adoptNode(annotation); // adoptNode will return null when the DOM implementations are not compatible. if (newElem == null) { newElem = futureOwner.importNode(annotation, true); } } else { newElem = futureOwner.importNode(annotation, true); } target.insertBefore(newElem, target.getFirstChild()); }
Example #18
Source File: DOMResultAugmentor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void setDOMResult(DOMResult result) { fIgnoreChars = false; if (result != null) { final Node target = result.getNode(); fDocument = (target.getNodeType() == Node.DOCUMENT_NODE) ? (Document) target : target.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #19
Source File: XSAnnotationImpl.java From hottub with GNU General Public License v2.0 | 5 votes |
private synchronized void writeToDOM(Node target, short type) { Document futureOwner = (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document)target; DOMParser parser = fGrammar.getDOMParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } Document aDocument = parser.getDocument(); parser.dropDocumentReferences(); Element annotation = aDocument.getDocumentElement(); Node newElem = null; if (futureOwner instanceof CoreDocumentImpl) { newElem = futureOwner.adoptNode(annotation); // adoptNode will return null when the DOM implementations are not compatible. if (newElem == null) { newElem = futureOwner.importNode(annotation, true); } } else { newElem = futureOwner.importNode(annotation, true); } target.insertBefore(newElem, target.getFirstChild()); }
Example #20
Source File: DOMResultAugmentor.java From hottub with GNU General Public License v2.0 | 5 votes |
public void setDOMResult(DOMResult result) { fIgnoreChars = false; if (result != null) { final Node target = result.getNode(); fDocument = (target.getNodeType() == Node.DOCUMENT_NODE) ? (Document) target : target.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #21
Source File: XSAnnotationImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private synchronized void writeToDOM(Node target, short type) { Document futureOwner = (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document)target; DOMParser parser = fGrammar.getDOMParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } Document aDocument = parser.getDocument(); parser.dropDocumentReferences(); Element annotation = aDocument.getDocumentElement(); Node newElem = null; if (futureOwner instanceof CoreDocumentImpl) { newElem = futureOwner.adoptNode(annotation); // adoptNode will return null when the DOM implementations are not compatible. if (newElem == null) { newElem = futureOwner.importNode(annotation, true); } } else { newElem = futureOwner.importNode(annotation, true); } target.insertBefore(newElem, target.getFirstChild()); }
Example #22
Source File: DOMResultAugmentor.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void setDOMResult(DOMResult result) { fIgnoreChars = false; if (result != null) { final Node target = result.getNode(); fDocument = (target.getNodeType() == Node.DOCUMENT_NODE) ? (Document) target : target.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #23
Source File: DOMResultAugmentor.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void setDOMResult(DOMResult result) { fIgnoreChars = false; if (result != null) { final Node target = result.getNode(); fDocument = (target.getNodeType() == Node.DOCUMENT_NODE) ? (Document) target : target.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #24
Source File: XSAnnotationImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private synchronized void writeToDOM(Node target, short type) { Document futureOwner = (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document)target; DOMParser parser = fGrammar.getDOMParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } Document aDocument = parser.getDocument(); parser.dropDocumentReferences(); Element annotation = aDocument.getDocumentElement(); Node newElem = null; if (futureOwner instanceof CoreDocumentImpl) { newElem = futureOwner.adoptNode(annotation); // adoptNode will return null when the DOM implementations are not compatible. if (newElem == null) { newElem = futureOwner.importNode(annotation, true); } } else { newElem = futureOwner.importNode(annotation, true); } target.insertBefore(newElem, target.getFirstChild()); }
Example #25
Source File: XSAnnotationImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private synchronized void writeToDOM(Node target, short type) { Document futureOwner = (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document)target; DOMParser parser = fGrammar.getDOMParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } Document aDocument = parser.getDocument(); parser.dropDocumentReferences(); Element annotation = aDocument.getDocumentElement(); Node newElem = null; if (futureOwner instanceof CoreDocumentImpl) { newElem = futureOwner.adoptNode(annotation); // adoptNode will return null when the DOM implementations are not compatible. if (newElem == null) { newElem = futureOwner.importNode(annotation, true); } } else { newElem = futureOwner.importNode(annotation, true); } target.insertBefore(newElem, target.getFirstChild()); }
Example #26
Source File: DOMResultAugmentor.java From JDKSourceCode1.8 with MIT License | 5 votes |
public void setDOMResult(DOMResult result) { fIgnoreChars = false; if (result != null) { final Node target = result.getNode(); fDocument = (target.getNodeType() == Node.DOCUMENT_NODE) ? (Document) target : target.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #27
Source File: DOMResultAugmentor.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void setDOMResult(DOMResult result) { fIgnoreChars = false; if (result != null) { final Node target = result.getNode(); fDocument = (target.getNodeType() == Node.DOCUMENT_NODE) ? (Document) target : target.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #28
Source File: XSAnnotationImpl.java From JDKSourceCode1.8 with MIT License | 5 votes |
private synchronized void writeToDOM(Node target, short type) { Document futureOwner = (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document)target; DOMParser parser = fGrammar.getDOMParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } Document aDocument = parser.getDocument(); parser.dropDocumentReferences(); Element annotation = aDocument.getDocumentElement(); Node newElem = null; if (futureOwner instanceof CoreDocumentImpl) { newElem = futureOwner.adoptNode(annotation); // adoptNode will return null when the DOM implementations are not compatible. if (newElem == null) { newElem = futureOwner.importNode(annotation, true); } } else { newElem = futureOwner.importNode(annotation, true); } target.insertBefore(newElem, target.getFirstChild()); }
Example #29
Source File: DOMResultAugmentor.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void setDOMResult(DOMResult result) { fIgnoreChars = false; if (result != null) { final Node target = result.getNode(); fDocument = (target.getNodeType() == Node.DOCUMENT_NODE) ? (Document) target : target.getOwnerDocument(); fDocumentImpl = (fDocument instanceof CoreDocumentImpl) ? (CoreDocumentImpl) fDocument : null; fStorePSVI = (fDocument instanceof PSVIDocumentImpl); return; } fDocument = null; fDocumentImpl = null; fStorePSVI = false; }
Example #30
Source File: XSAnnotationImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private synchronized void writeToDOM(Node target, short type) { Document futureOwner = (type == XSAnnotation.W3C_DOM_ELEMENT) ? target.getOwnerDocument() : (Document)target; DOMParser parser = fGrammar.getDOMParser(); StringReader aReader = new StringReader(fData); InputSource aSource = new InputSource(aReader); try { parser.parse(aSource); } catch (SAXException e) { // this should never happen! // REVISIT: what to do with this?; should really not // eat it... } catch (IOException i) { // ditto with above } Document aDocument = parser.getDocument(); parser.dropDocumentReferences(); Element annotation = aDocument.getDocumentElement(); Node newElem = null; if (futureOwner instanceof CoreDocumentImpl) { newElem = futureOwner.adoptNode(annotation); // adoptNode will return null when the DOM implementations are not compatible. if (newElem == null) { newElem = futureOwner.importNode(annotation, true); } } else { newElem = futureOwner.importNode(annotation, true); } target.insertBefore(newElem, target.getFirstChild()); }