Java Code Examples for com.sun.tools.internal.xjc.util.DOMUtils#getChildElements()

The following examples show how to use com.sun.tools.internal.xjc.util.DOMUtils#getChildElements() . 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: Internalizer.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Moves JAXWS customizations under their respective target nodes.
 */
private void insertBinding(@NotNull Element bindings, @NotNull Node target) {
    if ("bindings".equals(bindings.getLocalName())) {
        Element[] children = DOMUtils.getChildElements(bindings);
        for (Element item : children) {
            if ("bindings".equals(item.getLocalName())) {
                //done
            } else {
                moveUnder(item, (Element) target);

            }
        }
    } else {
        moveUnder(bindings, (Element) target);
    }
}
 
Example 2
Source File: Internalizer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Moves JAXWS customizations under their respective target nodes.
 */
private void insertBinding(@NotNull Element bindings, @NotNull Node target) {
    if ("bindings".equals(bindings.getLocalName())) {
        Element[] children = DOMUtils.getChildElements(bindings);
        for (Element item : children) {
            if ("bindings".equals(item.getLocalName())) {
                //done
            } else {
                moveUnder(item, (Element) target);

            }
        }
    } else {
        moveUnder(bindings, (Element) target);
    }
}
 
Example 3
Source File: Internalizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Moves JAXWS customizations under their respective target nodes.
 */
private void insertBinding(@NotNull Element bindings, @NotNull Node target) {
    if ("bindings".equals(bindings.getLocalName())) {
        Element[] children = DOMUtils.getChildElements(bindings);
        for (Element item : children) {
            if ("bindings".equals(item.getLocalName())) {
                //done
            } else {
                moveUnder(item, (Element) target);

            }
        }
    } else {
        moveUnder(bindings, (Element) target);
    }
}
 
Example 4
Source File: Internalizer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Moves JAXWS customizations under their respective target nodes.
 */
private void insertBinding(@NotNull Element bindings, @NotNull Node target) {
    if ("bindings".equals(bindings.getLocalName())) {
        Element[] children = DOMUtils.getChildElements(bindings);
        for (Element item : children) {
            if ("bindings".equals(item.getLocalName())) {
                //done
            } else {
                moveUnder(item, (Element) target);

            }
        }
    } else {
        moveUnder(bindings, (Element) target);
    }
}
 
Example 5
Source File: Internalizer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Moves JAXWS customizations under their respective target nodes.
 */
private void insertBinding(@NotNull Element bindings, @NotNull Node target) {
    if ("bindings".equals(bindings.getLocalName())) {
        Element[] children = DOMUtils.getChildElements(bindings);
        for (Element item : children) {
            if ("bindings".equals(item.getLocalName())) {
                //done
            } else {
                moveUnder(item, (Element) target);

            }
        }
    } else {
        moveUnder(bindings, (Element) target);
    }
}
 
Example 6
Source File: Internalizer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Moves JAXWS customizations under their respective target nodes.
 */
private void insertBinding(@NotNull Element bindings, @NotNull Node target) {
    if ("bindings".equals(bindings.getLocalName())) {
        Element[] children = DOMUtils.getChildElements(bindings);
        for (Element item : children) {
            if ("bindings".equals(item.getLocalName())) {
                //done
            } else {
                moveUnder(item, (Element) target);

            }
        }
    } else {
        moveUnder(bindings, (Element) target);
    }
}
 
Example 7
Source File: Internalizer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Moves JAXWS customizations under their respective target nodes.
 */
private void insertBinding(@NotNull Element bindings, @NotNull Node target) {
    if ("bindings".equals(bindings.getLocalName())) {
        Element[] children = DOMUtils.getChildElements(bindings);
        for (Element item : children) {
            if ("bindings".equals(item.getLocalName())) {
                //done
            } else {
                moveUnder(item, (Element) target);

            }
        }
    } else {
        moveUnder(bindings, (Element) target);
    }
}
 
Example 8
Source File: Internalizer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies location information attached to the "src" node to the "dst" node.
 */
private void copyLocators( Element src, Element dst ) {
    forest.locatorTable.storeStartLocation(
        dst, forest.locatorTable.getStartLocation(src) );
    forest.locatorTable.storeEndLocation(
        dst, forest.locatorTable.getEndLocation(src) );

    // recursively process child elements
    Element[] srcChilds = DOMUtils.getChildElements(src);
    Element[] dstChilds = DOMUtils.getChildElements(dst);

    for( int i=0; i<srcChilds.length; i++ )
        copyLocators( srcChilds[i], dstChilds[i] );
}
 
Example 9
Source File: Internalizer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies location information attached to the "src" node to the "dst" node.
 */
private void copyLocators( Element src, Element dst ) {
    forest.locatorTable.storeStartLocation(
        dst, forest.locatorTable.getStartLocation(src) );
    forest.locatorTable.storeEndLocation(
        dst, forest.locatorTable.getEndLocation(src) );

    // recursively process child elements
    Element[] srcChilds = DOMUtils.getChildElements(src);
    Element[] dstChilds = DOMUtils.getChildElements(dst);

    for( int i=0; i<srcChilds.length; i++ )
        copyLocators( srcChilds[i], dstChilds[i] );
}
 
Example 10
Source File: Internalizer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies location information attached to the "src" node to the "dst" node.
 */
private void copyLocators( Element src, Element dst ) {
    forest.locatorTable.storeStartLocation(
        dst, forest.locatorTable.getStartLocation(src) );
    forest.locatorTable.storeEndLocation(
        dst, forest.locatorTable.getEndLocation(src) );

    // recursively process child elements
    Element[] srcChilds = DOMUtils.getChildElements(src);
    Element[] dstChilds = DOMUtils.getChildElements(dst);

    for( int i=0; i<srcChilds.length; i++ )
        copyLocators( srcChilds[i], dstChilds[i] );
}
 
Example 11
Source File: Internalizer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies location information attached to the "src" node to the "dst" node.
 */
private void copyLocators( Element src, Element dst ) {
    forest.locatorTable.storeStartLocation(
        dst, forest.locatorTable.getStartLocation(src) );
    forest.locatorTable.storeEndLocation(
        dst, forest.locatorTable.getEndLocation(src) );

    // recursively process child elements
    Element[] srcChilds = DOMUtils.getChildElements(src);
    Element[] dstChilds = DOMUtils.getChildElements(dst);

    for( int i=0; i<srcChilds.length; i++ )
        copyLocators( srcChilds[i], dstChilds[i] );
}
 
Example 12
Source File: Internalizer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies location information attached to the "src" node to the "dst" node.
 */
private void copyLocators( Element src, Element dst ) {
    forest.locatorTable.storeStartLocation(
        dst, forest.locatorTable.getStartLocation(src) );
    forest.locatorTable.storeEndLocation(
        dst, forest.locatorTable.getEndLocation(src) );

    // recursively process child elements
    Element[] srcChilds = DOMUtils.getChildElements(src);
    Element[] dstChilds = DOMUtils.getChildElements(dst);

    for( int i=0; i<srcChilds.length; i++ )
        copyLocators( srcChilds[i], dstChilds[i] );
}
 
Example 13
Source File: Internalizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies location information attached to the "src" node to the "dst" node.
 */
private void copyLocators( Element src, Element dst ) {
    forest.locatorTable.storeStartLocation(
        dst, forest.locatorTable.getStartLocation(src) );
    forest.locatorTable.storeEndLocation(
        dst, forest.locatorTable.getEndLocation(src) );

    // recursively process child elements
    Element[] srcChilds = DOMUtils.getChildElements(src);
    Element[] dstChilds = DOMUtils.getChildElements(dst);

    for( int i=0; i<srcChilds.length; i++ )
        copyLocators( srcChilds[i], dstChilds[i] );
}
 
Example 14
Source File: Internalizer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Copies location information attached to the "src" node to the "dst" node.
 */
private void copyLocators( Element src, Element dst ) {
    forest.locatorTable.storeStartLocation(
        dst, forest.locatorTable.getStartLocation(src) );
    forest.locatorTable.storeEndLocation(
        dst, forest.locatorTable.getEndLocation(src) );

    // recursively process child elements
    Element[] srcChilds = DOMUtils.getChildElements(src);
    Element[] dstChilds = DOMUtils.getChildElements(dst);

    for( int i=0; i<srcChilds.length; i++ )
        copyLocators( srcChilds[i], dstChilds[i] );
}
 
Example 15
Source File: Internalizer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Moves JAXB customizations under their respective target nodes.
 */
private void move(Element bindings, Map<Element, List<Node>> targetNodes) {
    List<Node> nodelist = targetNodes.get(bindings);

    if(nodelist == null) {
            return; // abort
    }

    for (Node target : nodelist) {
        if (target == null) // this must be the result of an error on the external binding.
        // recover from the error by ignoring this node
        {
            return;
        }

        for (Element item : DOMUtils.getChildElements(bindings)) {
            String localName = item.getLocalName();

            if ("bindings".equals(localName)) {
                // process child <jaxb:bindings> recursively
                move(item, targetNodes);
            } else if ("globalBindings".equals(localName)) {
                    // <jaxb:globalBindings> always go to the root of document.
                Element root = forest.getOneDocument().getDocumentElement();
                if (root.getNamespaceURI().equals(WSDL_NS)) {
                    NodeList elements = root.getElementsByTagNameNS(XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
                    if ((elements == null) || (elements.getLength() < 1)) {
                        reportError(item, Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                        return;
                    } else {
                        moveUnder(item, (Element)elements.item(0));
                    }
                } else {
                    moveUnder(item, root);
                }
            } else {
                if (!(target instanceof Element)) {
                    reportError(item,
                            Messages.format(Messages.CONTEXT_NODE_IS_NOT_ELEMENT));
                    return; // abort
                }

                if (!forest.logic.checkIfValidTargetNode(forest, item, (Element) target)) {
                    reportError(item,
                            Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                    return; // abort
                }

                // move this node under the target
                moveUnder(item, (Element) target);
            }
        }
    }
}
 
Example 16
Source File: Internalizer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Moves JAXB customizations under their respective target nodes.
 */
private void move(Element bindings, Map<Element, List<Node>> targetNodes) {
    List<Node> nodelist = targetNodes.get(bindings);

    if(nodelist == null) {
            return; // abort
    }

    for (Node target : nodelist) {
        if (target == null) // this must be the result of an error on the external binding.
        // recover from the error by ignoring this node
        {
            return;
        }

        for (Element item : DOMUtils.getChildElements(bindings)) {
            String localName = item.getLocalName();

            if ("bindings".equals(localName)) {
                // process child <jaxb:bindings> recursively
                move(item, targetNodes);
            } else if ("globalBindings".equals(localName)) {
                    // <jaxb:globalBindings> always go to the root of document.
                Element root = forest.getOneDocument().getDocumentElement();
                if (root.getNamespaceURI().equals(WSDL_NS)) {
                    NodeList elements = root.getElementsByTagNameNS(XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
                    if ((elements == null) || (elements.getLength() < 1)) {
                        reportError(item, Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                        return;
                    } else {
                        moveUnder(item, (Element)elements.item(0));
                    }
                } else {
                    moveUnder(item, root);
                }
            } else {
                if (!(target instanceof Element)) {
                    reportError(item,
                            Messages.format(Messages.CONTEXT_NODE_IS_NOT_ELEMENT));
                    return; // abort
                }

                if (!forest.logic.checkIfValidTargetNode(forest, item, (Element) target)) {
                    reportError(item,
                            Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                    return; // abort
                }

                // move this node under the target
                moveUnder(item, (Element) target);
            }
        }
    }
}
 
Example 17
Source File: Internalizer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Moves JAXB customizations under their respective target nodes.
 */
private void move(Element bindings, Map<Element, List<Node>> targetNodes) {
    List<Node> nodelist = targetNodes.get(bindings);

    if(nodelist == null) {
            return; // abort
    }

    for (Node target : nodelist) {
        if (target == null) // this must be the result of an error on the external binding.
        // recover from the error by ignoring this node
        {
            return;
        }

        for (Element item : DOMUtils.getChildElements(bindings)) {
            String localName = item.getLocalName();

            if ("bindings".equals(localName)) {
                // process child <jaxb:bindings> recursively
                move(item, targetNodes);
            } else if ("globalBindings".equals(localName)) {
                    // <jaxb:globalBindings> always go to the root of document.
                Element root = forest.getOneDocument().getDocumentElement();
                if (root.getNamespaceURI().equals(WSDL_NS)) {
                    NodeList elements = root.getElementsByTagNameNS(XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
                    if ((elements == null) || (elements.getLength() < 1)) {
                        reportError(item, Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                        return;
                    } else {
                        moveUnder(item, (Element)elements.item(0));
                    }
                } else {
                    moveUnder(item, root);
                }
            } else {
                if (!(target instanceof Element)) {
                    reportError(item,
                            Messages.format(Messages.CONTEXT_NODE_IS_NOT_ELEMENT));
                    return; // abort
                }

                if (!forest.logic.checkIfValidTargetNode(forest, item, (Element) target)) {
                    reportError(item,
                            Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                    return; // abort
                }

                // move this node under the target
                moveUnder(item, (Element) target);
            }
        }
    }
}
 
Example 18
Source File: Internalizer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Moves JAXB customizations under their respective target nodes.
 */
private void move(Element bindings, Map<Element, List<Node>> targetNodes) {
    List<Node> nodelist = targetNodes.get(bindings);

    if(nodelist == null) {
            return; // abort
    }

    for (Node target : nodelist) {
        if (target == null) // this must be the result of an error on the external binding.
        // recover from the error by ignoring this node
        {
            return;
        }

        for (Element item : DOMUtils.getChildElements(bindings)) {
            String localName = item.getLocalName();

            if ("bindings".equals(localName)) {
                // process child <jaxb:bindings> recursively
                move(item, targetNodes);
            } else if ("globalBindings".equals(localName)) {
                    // <jaxb:globalBindings> always go to the root of document.
                Element root = forest.getOneDocument().getDocumentElement();
                if (root.getNamespaceURI().equals(WSDL_NS)) {
                    NodeList elements = root.getElementsByTagNameNS(XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
                    if ((elements == null) || (elements.getLength() < 1)) {
                        reportError(item, Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                        return;
                    } else {
                        moveUnder(item, (Element)elements.item(0));
                    }
                } else {
                    moveUnder(item, root);
                }
            } else {
                if (!(target instanceof Element)) {
                    reportError(item,
                            Messages.format(Messages.CONTEXT_NODE_IS_NOT_ELEMENT));
                    return; // abort
                }

                if (!forest.logic.checkIfValidTargetNode(forest, item, (Element) target)) {
                    reportError(item,
                            Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                    return; // abort
                }

                // move this node under the target
                moveUnder(item, (Element) target);
            }
        }
    }
}
 
Example 19
Source File: Internalizer.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Moves JAXB customizations under their respective target nodes.
 */
private void move(Element bindings, Map<Element, List<Node>> targetNodes) {
    List<Node> nodelist = targetNodes.get(bindings);

    if(nodelist == null) {
            return; // abort
    }

    for (Node target : nodelist) {
        if (target == null) // this must be the result of an error on the external binding.
        // recover from the error by ignoring this node
        {
            return;
        }

        for (Element item : DOMUtils.getChildElements(bindings)) {
            String localName = item.getLocalName();

            if ("bindings".equals(localName)) {
                // process child <jaxb:bindings> recursively
                move(item, targetNodes);
            } else if ("globalBindings".equals(localName)) {
                    // <jaxb:globalBindings> always go to the root of document.
                Element root = forest.getOneDocument().getDocumentElement();
                if (root.getNamespaceURI().equals(WSDL_NS)) {
                    NodeList elements = root.getElementsByTagNameNS(XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
                    if ((elements == null) || (elements.getLength() < 1)) {
                        reportError(item, Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                        return;
                    } else {
                        moveUnder(item, (Element)elements.item(0));
                    }
                } else {
                    moveUnder(item, root);
                }
            } else {
                if (!(target instanceof Element)) {
                    reportError(item,
                            Messages.format(Messages.CONTEXT_NODE_IS_NOT_ELEMENT));
                    return; // abort
                }

                if (!forest.logic.checkIfValidTargetNode(forest, item, (Element) target)) {
                    reportError(item,
                            Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                    return; // abort
                }

                // move this node under the target
                moveUnder(item, (Element) target);
            }
        }
    }
}
 
Example 20
Source File: Internalizer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Moves JAXB customizations under their respective target nodes.
 */
private void move(Element bindings, Map<Element, List<Node>> targetNodes) {
    List<Node> nodelist = targetNodes.get(bindings);

    if(nodelist == null) {
            return; // abort
    }

    for (Node target : nodelist) {
        if (target == null) // this must be the result of an error on the external binding.
        // recover from the error by ignoring this node
        {
            return;
        }

        for (Element item : DOMUtils.getChildElements(bindings)) {
            String localName = item.getLocalName();

            if ("bindings".equals(localName)) {
                // process child <jaxb:bindings> recursively
                move(item, targetNodes);
            } else if ("globalBindings".equals(localName)) {
                    // <jaxb:globalBindings> always go to the root of document.
                Element root = forest.getOneDocument().getDocumentElement();
                if (root.getNamespaceURI().equals(WSDL_NS)) {
                    NodeList elements = root.getElementsByTagNameNS(XMLConstants.W3C_XML_SCHEMA_NS_URI, "schema");
                    if ((elements == null) || (elements.getLength() < 1)) {
                        reportError(item, Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                        return;
                    } else {
                        moveUnder(item, (Element)elements.item(0));
                    }
                } else {
                    moveUnder(item, root);
                }
            } else {
                if (!(target instanceof Element)) {
                    reportError(item,
                            Messages.format(Messages.CONTEXT_NODE_IS_NOT_ELEMENT));
                    return; // abort
                }

                if (!forest.logic.checkIfValidTargetNode(forest, item, (Element) target)) {
                    reportError(item,
                            Messages.format(Messages.ORPHANED_CUSTOMIZATION, item.getNodeName()));
                    return; // abort
                }

                // move this node under the target
                moveUnder(item, (Element) target);
            }
        }
    }
}