public static String computeName(CMNode cmNode, Node parent, String prefix) { return computeName(cmNode, parent, prefix, null); }
protected String getNamespaceURI(Node node) { return DOMNamespaceHelper.getNamespaceURI(node); //return node.getNamespaceURI(); }
public static String computePrefix(CMNode cmNode, Node parentNode) { String result = null; for (Node node = parentNode; node != null; node = node.getParentNode()) { if (node.getNodeType() == Node.ELEMENT_NODE) { result = getPrefix(node.getNodeName()); if (result != null) { break; } } } return result; }
String prefix = DOMNamespaceHelper.getPrefix(attrName); String unprefixedName = DOMNamespaceHelper.getUnprefixedName(attrName); if ((XSI_NAMESPACE_URI.equals(DOMNamespaceHelper.getNamespaceURI(attr))) && ((SCHEMA_LOCATION.equals(unprefixedName)) || (NO_NAMESPACE_SCHEMA_LOCATION.equals(unprefixedName)))) { return true;
protected CMElementDeclaration getDerivedCMElementDeclaration(Element element, CMElementDeclaration ed, NamespaceTable namespaceTable) { CMElementDeclaration result = null; String xsiPrefix = namespaceTable.getPrefixForURI("http://www.w3.org/2001/XMLSchema-instance"); //$NON-NLS-1$ if (xsiPrefix != null) { String xsiTypeValue = element.getAttribute(xsiPrefix + ":type"); //$NON-NLS-1$ if (xsiTypeValue != null) { String typePrefix = DOMNamespaceHelper.getPrefix(xsiTypeValue); String typeName = DOMNamespaceHelper.getUnprefixedName(xsiTypeValue); String typeURI = namespaceTable.getURIForPrefix(typePrefix); String uriQualifiedTypeName = typeName; if (typeURI != null && typeURI.length() > 0) { uriQualifiedTypeName = "[" + typeURI + "]" + typeName; //$NON-NLS-1$ //$NON-NLS-2$ } result = (CMElementDeclaration)ed.getProperty("DerivedElementDeclaration=" + uriQualifiedTypeName); //$NON-NLS-1$ } } return result; }
result = DOMNamespaceHelper.getUnprefixedName(nodeName); String uri = getNamespaceURI(node); if (uri != null)
public static String getNamespaceURI(Node node) { String result = null; if (node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element)node; String prefix = element.getPrefix(); result = getURIForPrefix(element, prefix); } else if (node.getNodeType() == Node.ATTRIBUTE_NODE) { Attr attr = (Attr)node; String prefix = attr.getPrefix(); result = getURIForPrefix(attr.getOwnerElement(), prefix); } return result; }
public List getQualifiedXSITypes(CMAttributeDeclaration ad, NamespaceTable table) { List list = new Vector(); List xsiTypes = (List)ad.getProperty("XSITypes"); //$NON-NLS-1$ if (xsiTypes != null && xsiTypes.size() > 0) { for (Iterator i = xsiTypes.iterator(); i.hasNext(); ) { String uriQualifiedName = (String)i.next(); String[] components = DOMNamespaceHelper.getURIQualifiedNameComponents(uriQualifiedName); String prefix = table.getPrefixForURI(components[0] != null ? components[0] : ""); //$NON-NLS-1$ String typeName = (prefix != null && prefix.length() > 0) ? prefix + ":" + components[1] : //$NON-NLS-1$ components[1]; list.add(typeName); } } return list; } }
String prefix = DOMNamespaceHelper.getPrefix(attrName); String unprefixedName = DOMNamespaceHelper.getUnprefixedName(attrName); if ((XMLNS.equals(prefix)) || (XMLNS.equals(unprefixedName))) { publicId = attrValue; else if ((XSI_NAMESPACE_URI.equals(DOMNamespaceHelper.getNamespaceURI(attrNode))) && (SCHEMA_LOCATION.equals(unprefixedName))) {
String prefix = DOMNamespaceHelper.getPrefix(attr.getName()); String unprefixedName = DOMNamespaceHelper.getUnprefixedName(attr.getName()); if (prefix != null && unprefixedName != null) String prefix = DOMNamespaceHelper.getPrefix(attr.getName()); String unprefixedName = DOMNamespaceHelper.getUnprefixedName(attr.getName()); if (prefix != null && unprefixedName != null)
/** * Retreives CMAttributeDeclaration indicated by attribute name within * elementDecl */ protected CMAttributeDeclaration getCMAttributeDeclaration(CMElementDeclaration elementDecl, String attName) { CMAttributeDeclaration attrDecl = null; if (elementDecl != null) { CMNamedNodeMap attributes = elementDecl.getAttributes(); String noprefixName = DOMNamespaceHelper.getUnprefixedName(attName); if (attributes != null) { attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(noprefixName); if (attrDecl == null) { attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(attName); } } } return attrDecl; }
String unprefixedName = DOMNamespaceHelper.getUnprefixedName(nodeName); String prefix = DOMNamespaceHelper.getPrefix(nodeName);
public String computeName(CMNode cmNode, Node parent) { String prefix = null; return DOMNamespaceHelper.computeName(cmNode, parent, prefix, namespaceTable); }
public CMAttributeDeclaration getCMAttributeDeclaration(Attr attr) { CMAttributeDeclaration result = null; Element element = attr.getOwnerElement(); if (element != null) { CMElementDeclaration ed = getCMElementDeclaration(element); if (ed != null) { result = (CMAttributeDeclaration)ed.getAttributes().getNamedItem(attr.getName()); if (result == null) { // try to get the unprefixed name String name = DOMNamespaceHelper.getUnprefixedName(attr.getName()); result = (CMAttributeDeclaration)ed.getAttributes().getNamedItem(name); } if (result == null) { // todo... perhaps this is a globally defined attribute... } } } return result; }
if (getPrefix(result) == null)
public String getRequiredName(Node ownerNode, CMNode cmnode) { if (ownerNode != null) { return DOMNamespaceHelper.computeName(cmnode, ownerNode, null); } return cmnode.getNodeName(); }
String noprefixName = DOMNamespaceHelper.getUnprefixedName(attributeName); if (attributes != null) { attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(noprefixName);
String attributeName = DOMNamespaceHelper.computeName(ad, element, null); if (ad.getUsage() == CMAttributeDeclaration.REQUIRED)
/** * */ public String getLabel(Node parent, CMNode cmnode) { String result = "?" + cmnode + "?"; //$NON-NLS-1$ //$NON-NLS-2$ if (cmnode != null) { result = cmnode.getNodeName(); if(result == null) { result = (String) cmnode.getProperty("description"); //$NON-NLS-1$ } if (result == null || result.length() == 0) { if (cmnode.getNodeType() == CMNode.GROUP) { CMDescriptionBuilder descriptionBuilder = new CMDescriptionBuilder(); result = descriptionBuilder.buildDescription(cmnode); } else { result = DOMNamespaceHelper.computeName(cmnode, parent, null); } } } return result; }
String attributeName = DOMNamespaceHelper.computeName(cmNode, parent, null); result = parent.getAttributeNode(attributeName) == null; break;