/** * @see org.overlord.sramp.common.visitors.HierarchicalArtifactVisitorAdapter#visit(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.ElementDeclaration) */ @Override public void visit(ElementDeclaration artifact) { super.visit(artifact); artifact.setNamespace(getProperty(jcrNode, "sramp:namespace")); //$NON-NLS-1$ }
/** * @see org.artificer.common.visitors.HierarchicalArtifactVisitor#visit(org.oasis_open.docs.s_ramp.ns.s_ramp_v1.ElementDeclaration) */ @Override public void visit(ElementDeclaration artifact) { super.visit(artifact); artifact.setNamespace(getProperty("namespace")); }
private void processElementDeclarations(Element schema, String targetNS) throws XPathExpressionException { // xpath expression to find all global element decls NodeList nodes = (NodeList) query(schema, "./xsd:element", XPathConstants.NODESET); for (int idx = 0; idx < nodes.getLength(); idx++) { Element node = (Element) nodes.item(idx); if (node.hasAttribute("name")) { String nsName = node.getAttribute("name"); ElementDeclaration elementDecl = new ElementDeclaration(); elementDecl.setArtifactType(BaseArtifactEnum.ELEMENT_DECLARATION); elementDecl.setName(nsName); elementDecl.setNamespace(targetNS); elementDecl.setNCName(nsName); derivedArtifacts.add(elementDecl); } } }
/** * Processes the global element declarations found in the schema. * @param derivedArtifacts * @param sourceArtifact * @param schema * @param xpath * @throws XPathExpressionException */ private void processElementDeclarations(Collection<BaseArtifactType> derivedArtifacts, BaseArtifactType sourceArtifact, Element schema, XPath xpath) throws XPathExpressionException { String targetNS = schema.getAttribute("targetNamespace"); //$NON-NLS-1$ // xpath expression to find all global element decls NodeList nodes = (NodeList) this.query(xpath, schema, "./xsd:element", XPathConstants.NODESET); //$NON-NLS-1$ for (int idx = 0; idx < nodes.getLength(); idx++) { Element node = (Element) nodes.item(idx); if (node.hasAttribute("name")) { //$NON-NLS-1$ String nsName = node.getAttribute("name"); //$NON-NLS-1$ ElementDeclaration elementDecl = new ElementDeclaration(); elementDecl.setArtifactType(BaseArtifactEnum.ELEMENT_DECLARATION); elementDecl.setName(nsName); elementDecl.setNamespace(targetNS); elementDecl.setNCName(nsName); derivedArtifacts.add(elementDecl); } } }