/** * Returns first data type which is a standard xsd data type. If no such data type found, then the first one will be * returned. * * @param items * @return */ private String getDataType(String[] items) { for (String item : items) { if (XsdDatatypeEnum.ENTITIES.isDataType(item)) { return item; } } return items[0]; } }
public FilterChain() { filterList.add(new GroupFilter()); filterList.add(new ElementFilter()); filterList.add(new EnumFilter()); filterList.add(new AttributeFilter()); filterList.add(new AttributeGroupFilter()); filterList.add(new RestrictionFilter()); filterList.add(new ComplexTypeFilter()); // filterList.add(new SimpleContentFilter()); // simpleContent used for text only types are not supported // currently filterList.add(new ExtensionFilter()); filterList.add(new UnionFilter()); filterList.add(new ListFilter()); }
public boolean isElementNameEqual(final String elementName) { if (elementName != null) { if (elementName.equals(name())) return true; } return false; } }
public boolean isDataType(final String tagName) { if (tagName != null) { final String[] items = tagName.split(":", -1); if (items.length == 2) { for (XsdDatatypeEnum value : XsdDatatypeEnum.values()) { if (items[1].equals(value.getDescription())) { return true; } } } } return false; } }
private boolean hasNestedElement(final Node parent, final XsdElementEnum elementType) { if (parent.hasChildNodes()) { for (int i = 0; i < parent.getChildNodes().getLength(); i++) { final Node childNode = parent.getChildNodes().item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { final Element childElement = (Element) childNode; if (elementType.isTagNameEqual(childElement.getTagName())) { return true; } } } } return false; } }
public boolean isTagNameEqual(final String tagName) { if (tagName != null) { final String[] items = tagName.split(":", -1); if (items.length == 2 && items[1].equals(getDescription())) { return true; } } return false; }
public FilterChain() { filterList.add(new GroupFilter()); filterList.add(new ElementFilter()); filterList.add(new EnumFilter()); filterList.add(new AttributeFilter()); filterList.add(new AttributeGroupFilter()); filterList.add(new RestrictionFilter()); filterList.add(new ComplexTypeFilter()); // filterList.add(new SimpleContentFilter()); // simpleContent used for text only types are not supported // currently filterList.add(new ExtensionFilter()); filterList.add(new UnionFilter()); filterList.add(new ListFilter()); }
public boolean isDataType(final String tagName) { if (tagName != null) { final String[] items = tagName.split(":", -1); if (items.length == 2) { for (XsdDatatypeEnum value : XsdDatatypeEnum.values()) { if (items[1].equals(value.getDescription())) { return true; } } } } return false; } }
/** * Checks for the first parent node occurrence of the a w3c parentEnum element. * * @param parentElement * the element from which the search starts. * @param parentEnum * the <code>XsdElementEnum</code> specifying the parent element. * @return true, if found, otherwise false. */ public static boolean hasParentOf(final Element parentElement, XsdElementEnum parentEnum) { Node parent = parentElement.getParentNode(); while (parent != null) { if (parent.getNodeType() == Node.ELEMENT_NODE) { final Element parentElm = (Element) parent; if (parentEnum.isTagNameEqual(parentElm.getTagName())) { return true; } } parent = parent.getParentNode(); } return false; }
/** * Returns first data type which is a standard xsd data type. If no such data type found, then the first one will be * returned. * * @param items * @return */ private String getDataType(String[] items) { for (String item : items) { if (XsdDatatypeEnum.ENTITIES.isDataType(item)) { return item; } } return items[0]; } }
public boolean isTagNameEqual(final String tagName) { if (tagName != null) { final String[] items = tagName.split(":", -1); if (items.length == 2 && items[1].equals(getDescription())) { return true; } } return false; }
public boolean isElementNameEqual(final String elementName) { if (elementName != null) { if (elementName.equals(name())) return true; } return false; } }
public boolean isJavaKeyword(final String ElementName) { // System.out.println("isJavaKeyword: " + ElementName); if (ElementName != null) { for (XsdDatatypeEnum value : XsdDatatypeEnum.values()) { if (ElementName.equals(value.getDescription())) { System.out.println("isJavaKeyword: " + ElementName + " found"); return true; } } } return false; }
private boolean hasNestedElement(final Node parent, final XsdElementEnum elementType) { if (parent.hasChildNodes()) { for (int i = 0; i < parent.getChildNodes().getLength(); i++) { final Node childNode = parent.getChildNodes().item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { final Element childElement = (Element) childNode; if (elementType.isTagNameEqual(childElement.getTagName())) { return true; } } } } return false; } }
public boolean isJavaKeyword(final String ElementName) { // System.out.println("isJavaKeyword: " + ElementName); if (ElementName != null) { for (XsdDatatypeEnum value : XsdDatatypeEnum.values()) { if (ElementName.equals(value.getDescription())) { System.out.println("isJavaKeyword: " + ElementName + " found"); return true; } } } return false; }
/** * Checks for the first parent node occurrence of the a w3c parentEnum element. * * @param parentElement * the element from which the search starts. * @param parentEnum * the <code>XsdElementEnum</code> specifying the parent element. * @return true, if found, otherwise false. */ public static boolean hasParentOf(final Element parentElement, XsdElementEnum parentEnum) { Node parent = parentElement.getParentNode(); while (parent != null) { if (parent.getNodeType() == Node.ELEMENT_NODE) { final Element parentElm = (Element) parent; if (parentEnum.isTagNameEqual(parentElm.getTagName())) { return true; } } parent = parent.getParentNode(); } return false; }
/** * Checks the existence of a w3c child element. * * @param parentElement * the element from which the search starts. * @param child * the <code>XsdElementEnum</code> specifying the child element. * @return true, if found, otherwise false. */ public static boolean hasChildOf(final Element parentElement, XsdElementEnum child) { NodeList nodeList = parentElement.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { final Node childNode = nodeList.item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { final Element childElement = (Element) childNode; if (child.isTagNameEqual(childElement.getTagName())) { return true; } } } return false; }
/** * Checks the existence of a w3c child element. * * @param parentElement * the element from which the search starts. * @param child * the <code>XsdElementEnum</code> specifying the child element. * @return true, if found, otherwise false. */ public static boolean hasChildOf(final Element parentElement, XsdElementEnum child) { NodeList nodeList = parentElement.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { final Node childNode = nodeList.item(i); if (childNode.getNodeType() == Node.ELEMENT_NODE) { final Element childElement = (Element) childNode; if (child.isTagNameEqual(childElement.getTagName())) { return true; } } } return false; }