public static boolean isElementWithSomeEmbeddedType(XmlTagImpl xml) { final String localName = xml.getLocalName(); if (!(XmlUtil.XML_SCHEMA_URI.equals(xml.getNamespace()) && "element".equals(localName))) { return false; } final XmlTag[] tags = xml.getSubTags(); for (XmlTag tag : tags) { if (isTypeElement((XmlTagImpl) tag)) { return true; } } return false; }
public static boolean isElementWithEmbeddedType( XmlTagImpl xml, final String typeName, final String typeNsPrefix) { final String localName = xml.getLocalName(); if (!(XmlUtil.XML_SCHEMA_URI.equals(xml.getNamespace()) && "element".equals(localName))) { return false; } final XmlAttribute nameAttr = getNameAttr(xml); if (nameAttr == null || nameAttr.getValue() == null) return false; final String localTypeName = XmlUtil.findLocalNameByQualifiedName(nameAttr.getValue()); final String prefix = XmlUtil.findPrefixByQualifiedName(nameAttr.getValue()); if (!typeName.equals(localTypeName) || !typeNsPrefix.equals(prefix)) { return false; } final XmlTag[] tags = xml.getSubTags(); for (XmlTag tag : tags) { if (isTypeElement((XmlTagImpl) tag)) { return true; } } return false; }