com.sun.xml.xsom.XSListSimpleType Java Examples

The following examples show how to use com.sun.xml.xsom.XSListSimpleType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SchemaWriter.java    From jolie with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void listSimpleType( XSListSimpleType type ) {
    XSSimpleType itemType = type.getItemType();

    if(itemType.isLocal()) {
        println("<list>");
        indent++;
        simpleType(itemType);
        indent--;
        println("</list>");
    } else {
        // global type
        println(MessageFormat.format("<list itemType=\"'{'{0}'}'{1}\" />",
            new Object[]{
                itemType.getTargetNamespace(),
                itemType.getName()
            }));
    }
}
 
Example #2
Source File: JumbuneSchemaWriter.java    From jumbune with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void listSimpleType( XSListSimpleType type ) {
    XSSimpleType itemType = type.getItemType();

    if(itemType.isLocal()) {
        println("<list>");
        indent++;
        simpleType(itemType);
        indent--;
        println("</list>");
    } else {
        // global type
        println(MessageFormat.format("<list itemType=\"'{'{0}'}'{1}\" />",
            itemType.getTargetNamespace(), itemType.getName()));
    }
}
 
Example #3
Source File: SchemaWriter.java    From citygml4j with Apache License 2.0 5 votes vote down vote up
public void listSimpleType( XSListSimpleType type ) {
	XSSimpleType itemType = type.getItemType();

	if(itemType.isLocal()) {
		println("<list>");
		indent++;
		simpleType(itemType);
		indent--;
		println("</list>");
	} else {
		// global type
		println(MessageFormat.format("<list itemType=\"'{'{0}'}'{1}\" />",
				itemType.getTargetNamespace(), itemType.getName()));
	}
}
 
Example #4
Source File: SimpleTypeImpl.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public XSListSimpleType getBaseListType() {
    return getSimpleBaseType().getBaseListType();
}
 
Example #5
Source File: Axis.java    From jolie with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Iterator<XSSimpleType> simpleType(XSSimpleType type) {
    XSListSimpleType baseList = type.getBaseListType();
    if(baseList==null)      return empty();
    return singleton(baseList.getItemType());
}
 
Example #6
Source File: CollectEnumerationValuesVisitor.java    From jsonix-schema-compiler with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void listSimpleType(XSListSimpleType type) {
	// TODO Auto-generated method stub

}
 
Example #7
Source File: XmlFormBuilder.java    From dynaform with Artistic License 2.0 4 votes vote down vote up
private FormElement declSimple(XSSimpleType simpleType,
    String name,
    XmlString defaultValue,
    XmlString fixedValue) {
  
  if (log.isDebugEnabled()) {
    log.debug("Simple Type: " + simpleType);
    log.debug("Primitive: " + simpleType.isPrimitive());
  }
  
  Data data = null;
  Control control = null;
  boolean required = false;
  
  if (simpleType.isRestriction()) {
    XSRestrictionSimpleType restriction = simpleType.asRestriction();
    
    if (isEnumeration(restriction)) {
      control = new Controls.SelectOneImpl();
      if (log.isDebugEnabled())
        log.debug("Control: " + control);
    }
    
    required = hasMinLength(restriction);
    
    data = createData(simpleType);
    if (data == null) {
      log.warn("Unsupported Primitive Type: " + simpleType);
      return null;
    }
  }
  
  else if (simpleType.isList()) {
    XSListSimpleType list = simpleType.asList();
    XSSimpleType itemType = list.getItemType();
    
    if (log.isDebugEnabled()) {
      log.debug("List: " + list);
      log.debug("Item type: " + itemType);
    }
    
    data = new StringData();
  }
  
  else if (simpleType.isUnion()) {
    log.warn("Unsupported Simple Type: " + simpleType);
    return null;
  }
  
  else
    throw new AssertionError("Unknown Simple Type: " + simpleType);
  
  if (control == null)
    control = new Controls.InputImpl();
  
  String value = null;
  boolean readOnly = false;
  
  if (defaultValue != null) {
    if (log.isDebugEnabled())
      log.debug("Default Value: " + defaultValue);
    
    value = defaultValue.toString();
  }
  
  if (fixedValue != null) {
    if (log.isDebugEnabled())
      log.debug("Fixed Value: " + fixedValue);
    
    value = fixedValue.toString();
    readOnly = true;
  }
  
  FormElement element = new FormElementImpl(name, control, data);
  
  if (value != null) {
    try {
      element.setXmlValue(value);
    } catch (Exception e) {
      log.warn("Failed to inject XML value: " + value, e);
    }
  }
  
  if (simpleType.isRestriction())
    processRestrictions(simpleType.asRestriction(), element.getRestrictions());
  
  element.setReadOnly(readOnly);
  element.setRequired(required);
  
  return element;
}
 
Example #8
Source File: XSSimpleTypeFunction.java    From jolie with GNU Lesser General Public License v2.1 votes vote down vote up
T listSimpleType( XSListSimpleType type ); 
Example #9
Source File: XSSimpleTypeVisitor.java    From jolie with GNU Lesser General Public License v2.1 votes vote down vote up
void listSimpleType( XSListSimpleType type ); 
Example #10
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 votes vote down vote up
public XSListSimpleType getBaseListType() {return null;} 
Example #11
Source File: SchemaSetImpl.java    From jolie with GNU Lesser General Public License v2.1 votes vote down vote up
public XSListSimpleType asList() { return null; } 
Example #12
Source File: SimpleTypeImpl.java    From jolie with GNU Lesser General Public License v2.1 votes vote down vote up
public XSListSimpleType asList() { return null; } 
Example #13
Source File: ListSimpleTypeImpl.java    From jolie with GNU Lesser General Public License v2.1 votes vote down vote up
public XSListSimpleType getBaseListType() {return this;} 
Example #14
Source File: ListSimpleTypeImpl.java    From jolie with GNU Lesser General Public License v2.1 votes vote down vote up
public XSListSimpleType asList() { return this; }