Java Code Examples for com.sun.org.apache.xerces.internal.xs.XSAnnotation#W3C_DOM_ELEMENT

The following examples show how to use com.sun.org.apache.xerces.internal.xs.XSAnnotation#W3C_DOM_ELEMENT . 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 vote down vote up
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 openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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: XSAnnotationImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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 4
Source File: XSAnnotationImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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 5
Source File: XSAnnotationImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
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 6
Source File: XSAnnotationImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
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 openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
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 vote down vote up
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: XSAnnotationImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
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 10
Source File: XSAnnotationImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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 TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
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-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 *  Write contents of the annotation to the specified DOM object. If the
 * specified <code>target</code> object is a DOM in-scope namespace
 * declarations for <code>annotation</code> element are added as
 * attributes nodes of the serialized <code>annotation</code>, otherwise
 * the corresponding events for all in-scope namespace declaration are
 * sent via specified document handler.
 * @param target  A target pointer to the annotation target object, i.e.
 *   <code>org.w3c.dom.Document</code>,
 *   <code>org.xml.sax.ContentHandler</code>.
 * @param targetType  A target type.
 * @return If the <code>target</code> is recognized type and supported by
 *   this implementation return true, otherwise return false.
 */
public boolean writeAnnotation(Object target,
                               short targetType) {
    if(targetType == XSAnnotation.W3C_DOM_ELEMENT || targetType == XSAnnotation.W3C_DOM_DOCUMENT) {
        writeToDOM((Node)target, targetType);
        return true;
    } else if (targetType == SAX_CONTENTHANDLER) {
        writeToSAX((ContentHandler)target);
        return true;
    }
    return false;
}
 
Example 13
Source File: XSAnnotationImpl.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 *  Write contents of the annotation to the specified DOM object. If the
 * specified <code>target</code> object is a DOM in-scope namespace
 * declarations for <code>annotation</code> element are added as
 * attributes nodes of the serialized <code>annotation</code>, otherwise
 * the corresponding events for all in-scope namespace declaration are
 * sent via specified document handler.
 * @param target  A target pointer to the annotation target object, i.e.
 *   <code>org.w3c.dom.Document</code>,
 *   <code>org.xml.sax.ContentHandler</code>.
 * @param targetType  A target type.
 * @return If the <code>target</code> is recognized type and supported by
 *   this implementation return true, otherwise return false.
 */
public boolean writeAnnotation(Object target,
                               short targetType) {
    if(targetType == XSAnnotation.W3C_DOM_ELEMENT || targetType == XSAnnotation.W3C_DOM_DOCUMENT) {
        writeToDOM((Node)target, targetType);
        return true;
    } else if (targetType == SAX_CONTENTHANDLER) {
        writeToSAX((ContentHandler)target);
        return true;
    }
    return false;
}
 
Example 14
Source File: XSAnnotationImpl.java    From JDKSourceCode1.8 with MIT License 3 votes vote down vote up
/**
 *  Write contents of the annotation to the specified DOM object. If the
 * specified <code>target</code> object is a DOM in-scope namespace
 * declarations for <code>annotation</code> element are added as
 * attributes nodes of the serialized <code>annotation</code>, otherwise
 * the corresponding events for all in-scope namespace declaration are
 * sent via specified document handler.
 * @param target  A target pointer to the annotation target object, i.e.
 *   <code>org.w3c.dom.Document</code>,
 *   <code>org.xml.sax.ContentHandler</code>.
 * @param targetType  A target type.
 * @return If the <code>target</code> is recognized type and supported by
 *   this implementation return true, otherwise return false.
 */
public boolean writeAnnotation(Object target,
                               short targetType) {
    if(targetType == XSAnnotation.W3C_DOM_ELEMENT || targetType == XSAnnotation.W3C_DOM_DOCUMENT) {
        writeToDOM((Node)target, targetType);
        return true;
    } else if (targetType == SAX_CONTENTHANDLER) {
        writeToSAX((ContentHandler)target);
        return true;
    }
    return false;
}
 
Example 15
Source File: XSAnnotationImpl.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 *  Write contents of the annotation to the specified DOM object. If the
 * specified <code>target</code> object is a DOM in-scope namespace
 * declarations for <code>annotation</code> element are added as
 * attributes nodes of the serialized <code>annotation</code>, otherwise
 * the corresponding events for all in-scope namespace declaration are
 * sent via specified document handler.
 * @param target  A target pointer to the annotation target object, i.e.
 *   <code>org.w3c.dom.Document</code>,
 *   <code>org.xml.sax.ContentHandler</code>.
 * @param targetType  A target type.
 * @return If the <code>target</code> is recognized type and supported by
 *   this implementation return true, otherwise return false.
 */
public boolean writeAnnotation(Object target,
                               short targetType) {
    if(targetType == XSAnnotation.W3C_DOM_ELEMENT || targetType == XSAnnotation.W3C_DOM_DOCUMENT) {
        writeToDOM((Node)target, targetType);
        return true;
    } else if (targetType == SAX_CONTENTHANDLER) {
        writeToSAX((ContentHandler)target);
        return true;
    }
    return false;
}
 
Example 16
Source File: XSAnnotationImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 *  Write contents of the annotation to the specified DOM object. If the
 * specified <code>target</code> object is a DOM in-scope namespace
 * declarations for <code>annotation</code> element are added as
 * attributes nodes of the serialized <code>annotation</code>, otherwise
 * the corresponding events for all in-scope namespace declaration are
 * sent via specified document handler.
 * @param target  A target pointer to the annotation target object, i.e.
 *   <code>org.w3c.dom.Document</code>,
 *   <code>org.xml.sax.ContentHandler</code>.
 * @param targetType  A target type.
 * @return If the <code>target</code> is recognized type and supported by
 *   this implementation return true, otherwise return false.
 */
public boolean writeAnnotation(Object target,
                               short targetType) {
    if(targetType == XSAnnotation.W3C_DOM_ELEMENT || targetType == XSAnnotation.W3C_DOM_DOCUMENT) {
        writeToDOM((Node)target, targetType);
        return true;
    } else if (targetType == SAX_CONTENTHANDLER) {
        writeToSAX((ContentHandler)target);
        return true;
    }
    return false;
}
 
Example 17
Source File: XSAnnotationImpl.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 *  Write contents of the annotation to the specified DOM object. If the
 * specified <code>target</code> object is a DOM in-scope namespace
 * declarations for <code>annotation</code> element are added as
 * attributes nodes of the serialized <code>annotation</code>, otherwise
 * the corresponding events for all in-scope namespace declaration are
 * sent via specified document handler.
 * @param target  A target pointer to the annotation target object, i.e.
 *   <code>org.w3c.dom.Document</code>,
 *   <code>org.xml.sax.ContentHandler</code>.
 * @param targetType  A target type.
 * @return If the <code>target</code> is recognized type and supported by
 *   this implementation return true, otherwise return false.
 */
public boolean writeAnnotation(Object target,
                               short targetType) {
    if(targetType == XSAnnotation.W3C_DOM_ELEMENT || targetType == XSAnnotation.W3C_DOM_DOCUMENT) {
        writeToDOM((Node)target, targetType);
        return true;
    } else if (targetType == SAX_CONTENTHANDLER) {
        writeToSAX((ContentHandler)target);
        return true;
    }
    return false;
}
 
Example 18
Source File: XSAnnotationImpl.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 *  Write contents of the annotation to the specified DOM object. If the
 * specified <code>target</code> object is a DOM in-scope namespace
 * declarations for <code>annotation</code> element are added as
 * attributes nodes of the serialized <code>annotation</code>, otherwise
 * the corresponding events for all in-scope namespace declaration are
 * sent via specified document handler.
 * @param target  A target pointer to the annotation target object, i.e.
 *   <code>org.w3c.dom.Document</code>,
 *   <code>org.xml.sax.ContentHandler</code>.
 * @param targetType  A target type.
 * @return If the <code>target</code> is recognized type and supported by
 *   this implementation return true, otherwise return false.
 */
public boolean writeAnnotation(Object target,
                               short targetType) {
    if(targetType == XSAnnotation.W3C_DOM_ELEMENT || targetType == XSAnnotation.W3C_DOM_DOCUMENT) {
        writeToDOM((Node)target, targetType);
        return true;
    } else if (targetType == SAX_CONTENTHANDLER) {
        writeToSAX((ContentHandler)target);
        return true;
    }
    return false;
}
 
Example 19
Source File: XSAnnotationImpl.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 *  Write contents of the annotation to the specified DOM object. If the
 * specified <code>target</code> object is a DOM in-scope namespace
 * declarations for <code>annotation</code> element are added as
 * attributes nodes of the serialized <code>annotation</code>, otherwise
 * the corresponding events for all in-scope namespace declaration are
 * sent via specified document handler.
 * @param target  A target pointer to the annotation target object, i.e.
 *   <code>org.w3c.dom.Document</code>,
 *   <code>org.xml.sax.ContentHandler</code>.
 * @param targetType  A target type.
 * @return If the <code>target</code> is recognized type and supported by
 *   this implementation return true, otherwise return false.
 */
public boolean writeAnnotation(Object target,
                               short targetType) {
    if(targetType == XSAnnotation.W3C_DOM_ELEMENT || targetType == XSAnnotation.W3C_DOM_DOCUMENT) {
        writeToDOM((Node)target, targetType);
        return true;
    } else if (targetType == SAX_CONTENTHANDLER) {
        writeToSAX((ContentHandler)target);
        return true;
    }
    return false;
}
 
Example 20
Source File: XSAnnotationImpl.java    From jdk1.8-source-analysis with Apache License 2.0 3 votes vote down vote up
/**
 *  Write contents of the annotation to the specified DOM object. If the
 * specified <code>target</code> object is a DOM in-scope namespace
 * declarations for <code>annotation</code> element are added as
 * attributes nodes of the serialized <code>annotation</code>, otherwise
 * the corresponding events for all in-scope namespace declaration are
 * sent via specified document handler.
 * @param target  A target pointer to the annotation target object, i.e.
 *   <code>org.w3c.dom.Document</code>,
 *   <code>org.xml.sax.ContentHandler</code>.
 * @param targetType  A target type.
 * @return If the <code>target</code> is recognized type and supported by
 *   this implementation return true, otherwise return false.
 */
public boolean writeAnnotation(Object target,
                               short targetType) {
    if(targetType == XSAnnotation.W3C_DOM_ELEMENT || targetType == XSAnnotation.W3C_DOM_DOCUMENT) {
        writeToDOM((Node)target, targetType);
        return true;
    } else if (targetType == SAX_CONTENTHANDLER) {
        writeToSAX((ContentHandler)target);
        return true;
    }
    return false;
}