/** * create new XmlSchemaAppinfo and add value goten from element * to this obj * @param content */ XmlSchemaAppInfo handleAppInfo(Element content) { XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo(); NodeList markup = new DocumentFragmentNodeList(content); if (!content.hasAttribute("source") && markup.getLength() == 0) { return null; } appInfo.setSource(getAttribute(content, "source")); appInfo.setMarkup(markup); return appInfo; }
/** * The content of appinfo is a raw W3C nodelist. It is convenient to put * this nodelist inside a DOM fragment called parent markup that we create * or recover here. * * @param appInfo the application info element * @return a parent DOM fragment for the annotation nodes list */ protected DocumentFragment getMarkupParent(final XmlSchemaAppInfo appInfo) { NodeList markup = appInfo.getMarkup(); DocumentFragment markupParent = null; if (markup == null || markup.getLength() == 0) { markupParent = _db.newDocument().createDocumentFragment(); } else { markupParent = (DocumentFragment) markup.item(0).getParentNode(); } return markupParent; }
appInfo = new XmlSchemaAppInfo(); annotation.getItems().add(appInfo); NodeList markup = appInfo.getMarkup(); if (markup == null || markup.getLength() == 0) { appInfo.setMarkup(markup); schemaObject.setAnnotation(annotation);
XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo(); try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); appInfo.setMarkup(el.getChildNodes()); } catch (ParserConfigurationException ex) { throw new RuntimeException("[ObjectReferenceVisitor: error creating endpoint schema]");
/** * Create a typesafeEnumMember markup. This provides a legal java identifier * for an enumeration value. Since these are constant values, we follow the * naming convention for static fields (all uppercase). * * @param jaxbNamespace the JAXB namespace * @param jaxbNamespacePrefix the JAXB namespace prefix * @param enumerationFacet the enumeration facet to annotate * @param value the enumeration value. */ protected void injectJaxbTypeSafeEnumMemberAnnotation( final String jaxbNamespace, final String jaxbNamespacePrefix, final XmlSchemaEnumerationFacet enumerationFacet, final String value) { XmlSchemaAppInfo appInfo = getXmlSchemaAppInfo(enumerationFacet); DocumentFragment markupParent = getMarkupParent(appInfo); Element typesafeEnumMemberEl = getElement(markupParent, jaxbNamespace, jaxbNamespacePrefix, JAXB_TYPESAFEENUMMEMBER); typesafeEnumMemberEl.setAttribute( JAXB_TYPESAFEENUMMEMBER_NAME, DEFAULT_ENUMERATION_MEMBER_PREFIX + NameUtil.toVariableName(value).toUpperCase()); appInfo.setMarkup(markupParent.getChildNodes()); }
appInfo = new XmlSchemaAppInfo(); annotation.getItems().add(appInfo);
/** * Create a typesafeEnumClass markup. This marks the simple Type as eligible * to become a separate Enum class. * * @param jaxbNamespace the JAXB namespace * @param jaxbNamespacePrefix the JAXB namespace prefix * @param xsdSimpleType the simple type to annotate * @param elementName the name of the element whose simple type we are * dealing with. */ protected void injectJaxbTypeSafeEnumClassAnnotation( final String jaxbNamespace, final String jaxbNamespacePrefix, final XmlSchemaSimpleType xsdSimpleType, final String elementName) { XmlSchemaAppInfo appInfo = getXmlSchemaAppInfo(xsdSimpleType); DocumentFragment markupParent = getMarkupParent(appInfo); Element typesafeEnumClassEl = getElement(markupParent, jaxbNamespace, jaxbNamespacePrefix, JAXB_TYPESAFEENUMCLASS); typesafeEnumClassEl.setAttribute(JAXB_TYPESAFEENUMCLASS_NAME, NameUtil.toClassName(elementName)); appInfo.setMarkup(markupParent.getChildNodes()); }
/** * create new XmlSchemaAppinfo and add value goten from element * to this obj * @param content */ XmlSchemaAppInfo handleAppInfo(Element content) { XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo(); NodeList markup = getChildren(content); if (!content.hasAttribute("source") && (markup == null || markup.getLength() <= 0)) { return null; } appInfo.setSource(getAttribute(content, "source")); appInfo.setMarkup(markup); return appInfo; }
jaxbNamespacePrefix); appInfo.setMarkup(markupParent.getChildNodes());
/** * Extracts the cobol annotation from an XML schema element. * * @param xsdElement the XML schema element * @return the COBOL annotation or bull if none found */ protected Element getCobolAnnotation(XmlSchemaElement xsdElement) { XmlSchemaAnnotation annotation = xsdElement.getAnnotation(); if (annotation != null && annotation.getItems().getCount() > 0) { XmlSchemaAppInfo appinfo = (XmlSchemaAppInfo) annotation.getItems() .getItem(0); if (appinfo.getMarkup() != null) { for (int i = 0; i < appinfo.getMarkup().getLength(); i++) { Node node = appinfo.getMarkup().item(i); if (node instanceof Element && node.getLocalName().equals(CobolMarkup.ELEMENT) && node.getNamespaceURI().equals(CobolMarkup.NS)) { return (Element) node; } } } } return null; }
/** * create new XmlSchemaAppinfo and add value goten from element * to this obj * @param content */ XmlSchemaAppInfo handleAppInfo(Element content) { XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo(); NodeList markup = new DocumentFragmentNodeList(content); if (!content.hasAttribute("source") && markup.getLength() == 0) { return null; } appInfo.setSource(getAttribute(content, "source")); appInfo.setMarkup(markup); return appInfo; }
/** {@inheritDoc} */ public void processElement(final XmlSchema schema, final XmlSchemaElement xsdElement, final int level) throws XsdMappingException { XmlSchemaAnnotation annotation = xsdElement.getAnnotation(); if (annotation != null && annotation.getItems().getCount() > 0) { XmlSchemaAppInfo appinfo = (XmlSchemaAppInfo) annotation.getItems() .getItem(0); if (appinfo.getMarkup() != null) { for (int i = 0; i < appinfo.getMarkup().getLength(); i++) { Node node = appinfo.getMarkup().item(i); if (node instanceof Element && node.getLocalName().equals(CobolMarkup.ELEMENT) && node.getNamespaceURI().equals(CobolMarkup.NS)) { writeElement(schema, xsdElement, _writer, (Element) node, level); } } } } }
XmlSchemaAppInfo appInfo = (XmlSchemaAppInfo)item; if (appInfo != null) { NodeList nlist = appInfo.getMarkup(); Node node = nlist.item(0); String info = node.getNodeValue();
NodeList nlist = appInfo.getMarkup(); Node node = nlist.item(0); String info = node.getNodeValue();