public XmlString getDefaultValue() { if( defaultValue!=null ) return defaultValue; else return getDecl().getDefaultValue(); }
public XmlString getDefaultValue() { if( defaultValue!=null ) return defaultValue; else return getDecl().getDefaultValue(); }
public XmlString getDefaultValue() { if( defaultValue!=null ) return defaultValue; else return getDecl().getDefaultValue(); }
public XmlString getDefaultValue() { if( defaultValue!=null ) return defaultValue; else return getDecl().getDefaultValue(); }
public XmlString getDefaultValue() { if( defaultValue!=null ) return defaultValue; else return getDecl().getDefaultValue(); }
// To get ComplexType attributes private static void getComplexAttributes(XSComplexType xsComplexType) { Collection<? extends XSAttributeUse> c = xsComplexType.getAttributeUses(); Iterator<? extends XSAttributeUse> i = c.iterator(); while(i.hasNext()) { // i.next is attributeUse XSAttributeUse attUse = i.next(); System.out.println("Attributes for CoplexType:"+ xsComplexType.getName()); parseAttribute(attUse); } } // To Get attribute info private static void parseAttribute(XSAttributeUse attUse) { XSAttributeDecl attributeDecl = attUse.getDecl(); System.out.println("Attribute Name:"+attributeDecl.getName()); XSSimpleType xsAttributeType = attributeDecl.getType(); System.out.println("Attribute Type: " + xsAttributeType.getName()); if (attUse.isRequired()) System.out.println("Use: Required"); else System.out.println("Use: Optional"); System.out.println("Fixed: " + attributeDecl.getFixedValue()); System.out.println("Default: " + attributeDecl.getDefaultValue()); }
protected static Field createField(ComplexType type, XSAttributeDecl element, Type fieldType, boolean isNillable) { String elementName = element.getName(); XmlString dv = element.getDefaultValue(); String defValue = null; if (dv != null) { defValue = dv.value; } int flags = 0; if (defValue == null) { dv = element.getFixedValue(); if (dv != null) { defValue = dv.value; flags |= Field.CONSTANT; } } Set<Constraint> constraints = new HashSet<>(); if (!isNillable) { constraints.add(NotNullConstraint.get()); } if (fieldType.isSimpleType()) { constraints.addAll(fieldType.getConstraints()); } return type.addField(elementName, fieldType, defValue, flags, constraints); }
private void dump( XSAttributeDecl decl, String additionalAtts ) { XSSimpleType type=decl.getType(); println(MessageFormat.format("<attribute name=\"{0}\"{1}{2}{3}{4}{5}>", decl.getName(), additionalAtts, type.isLocal()?"": MessageFormat.format(" type=\"'{'{0}'}'{1}\"", type.getTargetNamespace(), type.getName()), decl.getFixedValue()==null ? "":" fixed=\""+decl.getFixedValue()+'\"', decl.getDefaultValue()==null ? "":" default=\""+decl.getDefaultValue()+'\"', type.isLocal()?"":" /")); if(type.isLocal()) { indent++; simpleType(type); indent--; println("</attribute>"); } }
private void dump( XSAttributeDecl decl, String additionalAtts ) { XSSimpleType type=decl.getType(); println(MessageFormat.format("<attribute name=\"{0}\"{1}{2}{3}{4}{5}>", decl.getName(), additionalAtts, type.isLocal()?"": MessageFormat.format(" type=\"'{'{0}'}'{1}\"", type.getTargetNamespace(), type.getName()), decl.getFixedValue()==null ? "":" fixed=\""+decl.getFixedValue()+'\"', decl.getDefaultValue()==null ? "":" default=\""+decl.getDefaultValue()+'\"', type.isLocal()?"":" /")); if(type.isLocal()) { indent++; simpleType(type); indent--; println("</attribute>"); } }
private void dump( XSAttributeDecl decl, String additionalAtts ) { XSSimpleType type=decl.getType(); println(MessageFormat.format("<attribute name=\"{0}\"{1}{2}{3}{4}{5}>", decl.getName(), additionalAtts, type.isLocal()?"": MessageFormat.format(" type=\"'{'{0}'}'{1}\"", type.getTargetNamespace(), type.getName()), decl.getFixedValue()==null ? "":" fixed=\""+decl.getFixedValue()+'\"', decl.getDefaultValue()==null ? "":" default=\""+decl.getDefaultValue()+'\"', type.isLocal()?"":" /")); if(type.isLocal()) { indent++; simpleType(type); indent--; println("</attribute>"); } }
private void dump( XSAttributeDecl decl, String additionalAtts ) { XSSimpleType type=decl.getType(); println(MessageFormat.format("<attribute name=\"{0}\"{1}{2}{3}{4}{5}>", decl.getName(), additionalAtts, type.isLocal()?"": MessageFormat.format(" type=\"'{'{0}'}'{1}\"", type.getTargetNamespace(), type.getName()), decl.getFixedValue()==null ? "":" fixed=\""+decl.getFixedValue()+'\"', decl.getDefaultValue()==null ? "":" default=\""+decl.getDefaultValue()+'\"', type.isLocal()?"":" /")); if(type.isLocal()) { indent++; simpleType(type); indent--; println("</attribute>"); } }
private void dump( XSAttributeDecl decl, String additionalAtts ) { XSSimpleType type=decl.getType(); println(MessageFormat.format("<attribute name=\"{0}\"{1}{2}{3}{4}{5}>", decl.getName(), additionalAtts, type.isLocal()?"": MessageFormat.format(" type=\"'{'{0}'}'{1}\"", type.getTargetNamespace(), type.getName()), decl.getFixedValue()==null ? "":" fixed=\""+decl.getFixedValue()+'\"', decl.getDefaultValue()==null ? "":" default=\""+decl.getDefaultValue()+'\"', type.isLocal()?"":" /")); if(type.isLocal()) { indent++; simpleType(type); indent--; println("</attribute>"); } }
/** * Creates node for attribute declaration with additional attributes. * * @param decl Attribute declaration. * @param additionalAtts Additional attributes. */ private void dump(XSAttributeDecl decl, String additionalAtts) { XSSimpleType type = decl.getType(); String str = MessageFormat.format("Attribute \"{0}\"{1}{2}{3}{4}", new Object[]{ decl.getName(), additionalAtts, type.isLocal() ? "" : MessageFormat.format( " type=\"'{'{0}'}'{1}\"", new Object[]{ type.getTargetNamespace(), type.getName()}), decl.getFixedValue() == null ? "" : " fixed=\"" + decl.getFixedValue() + "\"", decl.getDefaultValue() == null ? "" : " default=\"" + decl.getDefaultValue() + "\""}); SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator()); this.currNode.add(newNode); this.currNode = newNode; if (type.isLocal()) { simpleType(type); } this.currNode = (SchemaTreeNode) this.currNode.getParent(); }
/** * Creates node for attribute declaration with additional attributes. * * @param decl Attribute declaration. * @param additionalAtts Additional attributes. */ private void dump(XSAttributeDecl decl, String additionalAtts) { XSSimpleType type = decl.getType(); String str = MessageFormat.format("Attribute \"{0}\"{1}{2}{3}{4}", new Object[]{ decl.getName(), additionalAtts, type.isLocal() ? "" : MessageFormat.format( " type=\"'{'{0}'}'{1}\"", new Object[]{ type.getTargetNamespace(), type.getName()}), decl.getFixedValue() == null ? "" : " fixed=\"" + decl.getFixedValue() + "\"", decl.getDefaultValue() == null ? "" : " default=\"" + decl.getDefaultValue() + "\""}); SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator()); this.currNode.add(newNode); this.currNode = newNode; if (type.isLocal()) { simpleType(type); } this.currNode = (SchemaTreeNode) this.currNode.getParent(); }
public void attributeUse( XSAttributeUse use ) { XSAttributeDecl decl = use.getDecl(); String additionalAtts=""; if(use.isRequired()) additionalAtts += " use=\"required\""; if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null) additionalAtts += " fixed=\""+use.getFixedValue()+'\"'; if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null) additionalAtts += " default=\""+use.getDefaultValue()+'\"'; if(decl.isLocal()) { // this is anonymous attribute use dump(decl,additionalAtts); } else { // reference to a global one println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>", decl.getTargetNamespace(), decl.getName(), additionalAtts)); } }
public void attributeUse( XSAttributeUse use ) { XSAttributeDecl decl = use.getDecl(); String additionalAtts=""; if(use.isRequired()) additionalAtts += " use=\"required\""; if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null) additionalAtts += " fixed=\""+use.getFixedValue()+'\"'; if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null) additionalAtts += " default=\""+use.getDefaultValue()+'\"'; if(decl.isLocal()) { // this is anonymous attribute use dump(decl,additionalAtts); } else { // reference to a global one println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>", decl.getTargetNamespace(), decl.getName(), additionalAtts)); } }
public void attributeUse( XSAttributeUse use ) { XSAttributeDecl decl = use.getDecl(); String additionalAtts=""; if(use.isRequired()) additionalAtts += " use=\"required\""; if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null) additionalAtts += " fixed=\""+use.getFixedValue()+'\"'; if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null) additionalAtts += " default=\""+use.getDefaultValue()+'\"'; if(decl.isLocal()) { // this is anonymous attribute use dump(decl,additionalAtts); } else { // reference to a global one println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>", decl.getTargetNamespace(), decl.getName(), additionalAtts)); } }
public void attributeUse( XSAttributeUse use ) { XSAttributeDecl decl = use.getDecl(); String additionalAtts=""; if(use.isRequired()) additionalAtts += " use=\"required\""; if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null) additionalAtts += " fixed=\""+use.getFixedValue()+'\"'; if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null) additionalAtts += " default=\""+use.getDefaultValue()+'\"'; if(decl.isLocal()) { // this is anonymous attribute use dump(decl,additionalAtts); } else { // reference to a global one println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>", decl.getTargetNamespace(), decl.getName(), additionalAtts)); } }
public void attributeUse( XSAttributeUse use ) { XSAttributeDecl decl = use.getDecl(); String additionalAtts=""; if(use.isRequired()) additionalAtts += " use=\"required\""; if(use.getFixedValue()!=null && use.getDecl().getFixedValue()==null) additionalAtts += " fixed=\""+use.getFixedValue()+'\"'; if(use.getDefaultValue()!=null && use.getDecl().getDefaultValue()==null) additionalAtts += " default=\""+use.getDefaultValue()+'\"'; if(decl.isLocal()) { // this is anonymous attribute use dump(decl,additionalAtts); } else { // reference to a global one println(MessageFormat.format("<attribute ref=\"'{'{0}'}'{1}{2}\"/>", decl.getTargetNamespace(), decl.getName(), additionalAtts)); } }
public void attributeUse(XSAttributeUse use) { XSAttributeDecl decl = use.getDecl(); String additionalAtts = ""; if (use.isRequired()) { additionalAtts += " use=\"required\""; } if (use.getFixedValue() != null && use.getDecl().getFixedValue() == null) { additionalAtts += " fixed=\"" + use.getFixedValue() + "\""; } if (use.getDefaultValue() != null && use.getDecl().getDefaultValue() == null) { additionalAtts += " default=\"" + use.getDefaultValue() + "\""; } if (decl.isLocal()) { // this is anonymous attribute use dump(decl, additionalAtts); } else { // reference to a global one String str = MessageFormat.format( "Attribute ref \"'{'{0}'}'{1}{2}\"", new Object[]{ decl.getTargetNamespace(), decl.getName(), additionalAtts}); SchemaTreeNode newNode = new SchemaTreeNode(str, decl.getLocator()); this.currNode.add(newNode); } }