Java Code Examples for com.sun.org.apache.xerces.internal.parsers.DOMParser#parse()
The following examples show how to use
com.sun.org.apache.xerces.internal.parsers.DOMParser#parse() .
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: 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 2
Source File: XSAnnotationImpl.java From TencentKona-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 3
Source File: SAML10Converter.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
/** * To element. * * @param assertion the assertion * @return the element */ public static Element toElement(String assertion) { try { DOMParser parser = new DOMParser(); InputSource source = new InputSource(new StringReader(assertion)); parser.parse(source); return parser.getDocument().getDocumentElement(); } catch (Exception e) { throw new RuntimeException(e); } }
Example 4
Source File: SAML10Converter.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public static Element toElement(String assertion) { try { DOMParser parser = new DOMParser(); InputSource source = new InputSource(new StringReader(assertion)); parser.parse(source); return parser.getDocument().getDocumentElement(); } catch (Exception var3) { throw new RuntimeException(var3); } }
Example 5
Source File: SAML10Converter.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
/** * To element. * * @param assertion the assertion * @return the element */ public static Element toElement(String assertion) { try { DOMParser parser = new DOMParser(); InputSource source = new InputSource(new StringReader(assertion)); parser.parse(source); return parser.getDocument().getDocumentElement(); } catch (Exception e) { throw new RuntimeException(e); } }
Example 6
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 7
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 8
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()); }
Example 9
Source File: FDom.java From pra with MIT License | 5 votes |
public Element LoadHTML(String filename){ FileInputStream inStream; String s = new String(); String urlIS = new String(filename); try { DOMParser parser = new DOMParser(); parser.parse(new InputSource(new FileInputStream(urlIS))); Document doc= parser.getDocument(); return doc.getDocumentElement(); //HTMLInputElement hi = (HTMLInputElement)doc.getElementById("search"); } catch (Exception e) { return null; } /* StringWriter sw = new StringWriter(); Transformer t = null; try { t = TransformerFactory.newInstance().newTransformer(); } catch (Exception e) { return ""; } t.setOutputProperty(OutputKeys.METHOD, "html"); t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATIO N, "yes"); try { t.transform(new DOMSource(doc), new StreamResult(sw)); } catch (Exception e) { return ""; } s = sw.toString(); return s;*/ }
Example 10
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 11
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 12
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 13
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 14
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 15
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 16
Source File: WebContentAssemblingService.java From abixen-platform with GNU Lesser General Public License v2.1 | 5 votes |
private Document getParsedXml(final String dataForContent) { final DOMParser parser = new DOMParser(); try { parser.parse(new InputSource(new java.io.StringReader(dataForContent))); return parser.getDocument(); } catch (SAXException | IOException e) { throw new PlatformRuntimeException("Can't parse structure for advanced web content. Please check configuration."); } }