Java Code Examples for org.mybatis.generator.config.MergeConstants#OLD_XML_ELEMENT_PREFIXES
The following examples show how to use
org.mybatis.generator.config.MergeConstants#OLD_XML_ELEMENT_PREFIXES .
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: XmlFileMergerJaxp.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
private static boolean isGeneratedNode(Node node) { boolean rc = false; if (node != null && node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) node; String id = element.getAttribute("id"); //$NON-NLS-1$ if (id != null) { for (String prefix : MergeConstants.OLD_XML_ELEMENT_PREFIXES) { if (id.startsWith(prefix)) { rc = true; break; } } } if (rc == false) { // check for new node format - if the first non-whitespace node // is an XML comment, and the comment includes // one of the old element tags, // then it is a generated node NodeList children = node.getChildNodes(); int length = children.getLength(); for (int i = 0; i < length; i++) { Node childNode = children.item(i); if (isWhiteSpace(childNode)) { continue; } else if (childNode.getNodeType() == Node.COMMENT_NODE) { Comment comment = (Comment) childNode; String commentData = comment.getData(); for (String tag : MergeConstants.OLD_ELEMENT_TAGS) { if (commentData.contains(tag)) { rc = true; break; } } } else { break; } } } } return rc; }
Example 2
Source File: XmlFileMergerJaxp.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
private static boolean isGeneratedNode(Node node) { boolean rc = false; if (node != null && node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) node; String id = element.getAttribute("id"); //$NON-NLS-1$ if (id != null) { for (String prefix : MergeConstants.OLD_XML_ELEMENT_PREFIXES) { if (id.startsWith(prefix)) { rc = true; break; } } } if (rc == false) { // check for new node format - if the first non-whitespace node // is an XML comment, and the comment includes // one of the old element tags, // then it is a generated node NodeList children = node.getChildNodes(); int length = children.getLength(); for (int i = 0; i < length; i++) { Node childNode = children.item(i); if (isWhiteSpace(childNode)) { continue; } else if (childNode.getNodeType() == Node.COMMENT_NODE) { Comment comment = (Comment) childNode; String commentData = comment.getData(); for (String tag : MergeConstants.OLD_ELEMENT_TAGS) { if (commentData.contains(tag)) { rc = true; break; } } } else { break; } } } } return rc; }