private String getCodeListId( final XSElementDeclaration elementDecl ) { String codeListId = null; // handle adv schemas (referenced code list id inside annotation element) XSObjectList annotations = elementDecl.getAnnotations(); if ( annotations.getLength() > 0 ) { XSAnnotation annotation = (XSAnnotation) annotations.item( 0 ); String s = annotation.getAnnotationString(); XMLAdapter adapter = new XMLAdapter( new StringReader( s ) ); NamespaceBindings nsContext = new NamespaceBindings(); nsContext.addNamespace( "xs", CommonNamespaces.XSNS ); nsContext.addNamespace( "adv", "http://www.adv-online.de/nas" ); codeListId = adapter.getNodeAsString( adapter.getRootElement(), new XPath( "xs:appinfo/adv:referenzierteCodeList/text()", nsContext ), null ); if ( codeListId != null ) { codeListId = codeListId.trim(); } } return codeListId; }
/** * Add an XSAnnotation */ public void addXSAnnotation(XSAnnotation xa) { if(xa == null) throw NativeMessages.MESSAGES.illegalNullArgument("xa"); anns.put(xa.getName(),xa); }
public void addXSAnnotation(XSAnnotation xa) { String ns = xa.getNamespace(); if (ns == null && nsimap.keySet().size() == 1) { ns = nsimap.keySet().iterator().next(); } if (ns != null) { createNamespaceItemIfNotExistent(ns); JBossXSNamespaceItem jbnm = nsimap.get(ns); jbnm.addXSAnnotation(xa); } else { Logger.getLogger(JBossXSModel.class).trace("Cannot assign XSAnnotation to null namespace"); } }
static PropertyTypeInfoAnnotation readTypeInfoAnnotation(XSAnnotation item) { try { DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document annotDoc = documentBuilder.newDocument(); item.writeAnnotation(annotDoc, XSAnnotation.W3C_DOM_DOCUMENT); NodeList appInfoList = annotDoc.getDocumentElement().getElementsByTagNameNS(XmlConfigParser.W3C_XML_SCHEMA, "appinfo"); if (appInfoList != null && appInfoList.getLength() == 1) { Element appInfoElem = (Element) appInfoList.item(0); if ("type_info".equals(appInfoElem.getTextContent())) { NodeList docNodeList = annotDoc.getDocumentElement().getElementsByTagNameNS(XmlConfigParser.W3C_XML_SCHEMA, "documentation"); Preconditions.checkNotNull(docNodeList, "No documentation node in the annotation node"); Preconditions.checkState(docNodeList.getLength() == 1, "Only one documentation node allowed in the annotation node"); String typeInfo = docNodeList.item(0).getTextContent(); return new PropertyTypeInfoAnnotation(typeInfo); } } return null; } catch (ParserConfigurationException e) { throw new RuntimeException(e); } }
private XSElementDeclaration determineAnnotationDefinedValueElement( XSElementDeclaration elDecl ) { XMLAdapter annotationXML = null; XSObjectList annotations = elDecl.getAnnotations(); QName targetElement = null; if ( annotations.getLength() > 0 ) { XSAnnotation annotation = (XSAnnotation) annotations.item( 0 ); String s = annotation.getAnnotationString(); annotationXML = new XMLAdapter( new StringReader( s ) ); targetElement = determineTargetElementGml32( annotationXML ); if ( targetElement == null ) { targetElement = determineTargetElementXGml( annotationXML ); } if ( targetElement == null ) { targetElement = determineTargetElementAdv( annotationXML ); } } if ( targetElement != null ) { return getElementDecl( targetElement ); } return null; }
if ( annotations.getLength() > 0 ) { XSAnnotation annotation = (XSAnnotation) annotations.item( 0 ); String s = annotation.getAnnotationString(); annotationXML = new XMLAdapter( new StringReader( s ) );
td.documentation = parseAnnotationString( "Type " + def.getNamespace() + ":" + def.getName() + " documentation", ann == null ? null : ann.getAnnotationString() ); td.type = TypeDesc.TypeEnum.GROUP_INTERFACE;
String documentation = parseAnnotationString( "Element " + el.getNamespace() + ":" + el.getName() + " documentation", ann != null ? ann.getAnnotationString() : null ); final FieldDesc fd1 = new FieldDesc( documentation = parseAnnotationString( "Type " + ct.getNamespace() + ":" + ct.getName() + " documentation", ann != null ? ann.getAnnotationString() : null ); if (documentation != null) {
public void processEnumType( XSTypeDefinition def, Map<String, TypeDesc> jtMap, Map<String, NamespaceDesc> nsdMap ) throws Exception { boolean complexType = def instanceof XSComplexTypeDefinition; if (!nsdMap.containsKey(def.getNamespace())) { Util.log("Namespace desc not found for: " + def); } final String typeName = toJavaTypeName(def, nsdMap); final TypeDesc td = new TypeDesc(def.getName(), def.getNamespace(), typeName, TypeDesc.TypeEnum.ENUM); final XSComplexTypeDefinition ct = complexType ? (XSComplexTypeDefinition) def : null; final XSSimpleTypeDefinition st = (XSSimpleTypeDefinition) (complexType ? ((XSComplexTypeDefinition) def).getSimpleType() : def); for (int i = 0; i < st.getLexicalEnumeration().getLength(); i++) { final String s = st.getLexicalEnumeration().item(i); td.fdMap.put(s, new FieldDesc(Util.computeEnumConstantName(s, td.name), s)); } final XSObjectList anns = complexType ? ct.getAnnotations() : st.getAnnotations(); td.documentation = parseAnnotationString( "Enumeration " + def.getNamespace() + ":" + def.getName() + " documentation", anns != null && anns.getLength() > 0 ? ((XSAnnotation) anns.item(0)).getAnnotationString() : null ); jtMap.put(model.toJavaQualifiedTypeName(def, nsdMap, true), td); }
td.documentation = parseAnnotationString( "Type " + def.getNamespace() + ":" + def.getName() + " documentation", anns != null && anns.getLength() > 0 ? ((XSAnnotation) anns.item(0)).getAnnotationString() : null ); TypeDesc tdBase = null; String documentation = parseAnnotationString( "Attribute " + ad.getNamespace() + ":" + ad.getName() + " documentation", ann != null ? ann.getAnnotationString() : null );
XsdAnnotation an = XsdAnnotation.unmarshal(annotation.getAnnotationString()); XsdAppInfo appinfo = an.getAppInfo(); if(appinfo != null)
private static void customizeTerm(XSAnnotation an, TermBinding term, boolean trace) XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString()); XsdAppInfo appInfo = xsdAn.getAppInfo(); if(appInfo != null)
XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString()); XsdAppInfo appInfo = xsdAn.getAppInfo(); if(appInfo != null)
XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString()); XsdAppInfo appInfo = xsdAn.getAppInfo(); if(appInfo != null)
XsdAnnotation xsdAn = XsdAnnotation.unmarshal(an.getAnnotationString()); XsdAppInfo appInfo = xsdAn.getAppInfo(); if(appInfo != null)