com.sun.xml.xsom.XmlString Java Examples
The following examples show how to use
com.sun.xml.xsom.XmlString.
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: SimpleTypeAnalyzer.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 6 votes |
public Long getValue(XSFacet facet) { final XmlString value = facet.getValue(); if (value == null) { return null; } else { final String v = value.value; if (v == null) { return null; } else { final BigInteger integerValue = DatatypeConverter.parseInteger(v); if (integerValue.compareTo(BigInteger .valueOf(Long.MAX_VALUE)) > 0) { return Long.MAX_VALUE; } else { return integerValue.longValue(); } } } }
Example #2
Source File: AttributeDeclImpl.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
public AttributeDeclImpl( SchemaDocumentImpl owner, String _targetNamespace, String _name, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa, boolean _anonymous, XmlString _defValue, XmlString _fixedValue, Ref.SimpleType _type ) { super(owner,_annon,_loc,_fa,_targetNamespace,_name,_anonymous); if(_name==null) // assertion failed. throw new IllegalArgumentException(); this.defaultValue = _defValue; this.fixedValue = _fixedValue; this.type = _type; }
Example #3
Source File: CollectEnumerationValuesVisitor.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void restrictionSimpleType(XSRestrictionSimpleType type) { final List<XSFacet> facets = type.getFacets(XSFacet.FACET_ENUMERATION); if (facets != null) { for (XSFacet facet : facets) { final XmlString value = facet.getValue(); if (value != null) { this.values.add(value); } } } }
Example #4
Source File: CreateTypeInfoSchema.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 5 votes |
@Override public JsonSchemaBuilder visitBuiltinLeafInfo(MBuiltinLeafInfo<T, C> typeInfo) { final TypeInfoProducer<T, C> typeInfoCompiler = mappingCompiler.getTypeInfoProducer(info, typeInfo); final JsonSchemaBuilder typeInfoSchemaRef = typeInfoCompiler.createTypeInfoSchemaRef(mappingCompiler); if (info instanceof MOriginated) { MOriginated<?> originated = (MOriginated<?>) info; Object origin = originated.getOrigin(); if (origin instanceof SchemaComponentAware) { final XSComponent component = ((SchemaComponentAware) origin).getSchemaComponent(); if (component != null) { final CollectEnumerationValuesVisitor collectEnumerationValuesVisitor = new CollectEnumerationValuesVisitor(); component.visit(collectEnumerationValuesVisitor); final List<XmlString> enumerationValues = collectEnumerationValuesVisitor.getValues(); if (enumerationValues != null && !enumerationValues.isEmpty()) { final JsonSchemaBuilder values = new JsonSchemaBuilder(); boolean valueSupported = true; for (XmlString enumerationValue : enumerationValues) { final JsonValue value = typeInfoCompiler.createValue(this.mappingCompiler, enumerationValue); if (value == null) { valueSupported = false; break; } else { values.addEnum(value); } } if (valueSupported) { final JsonSchemaBuilder typeInfoSchemaRefWithEnums = new JsonSchemaBuilder(); typeInfoSchemaRefWithEnums.addAllOf(typeInfoSchemaRef); typeInfoSchemaRefWithEnums.addAllOf(values); return typeInfoSchemaRefWithEnums; } } } } } return typeInfoSchemaRef; }
Example #5
Source File: EnumLeafInfoProducer.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 5 votes |
@Override public JsonValue createValue(JsonSchemaMappingCompiler<T, C> mappingCompiler, XmlString item) { final MTypeInfo<T, C> baseTypeInfo = enumLeafInfo.getBaseTypeInfo(); final TypeInfoProducer<T, C> baseTypeInfoProducer = mappingCompiler.getTypeInfoProducer(enumLeafInfo, baseTypeInfo); return baseTypeInfoProducer.createValue(mappingCompiler, item); }
Example #6
Source File: CreateTypeInfoDelaration.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 5 votes |
private void appendEnumerationValues(final TypeInfoCompiler<T, C> typeInfoCompiler) { if (info instanceof MOriginated) { MOriginated<?> originated = (MOriginated<?>) info; Object origin = originated.getOrigin(); if (origin instanceof SchemaComponentAware) { final XSComponent component = ((SchemaComponentAware) origin).getSchemaComponent(); if (component != null) { final CollectEnumerationValuesVisitor collectEnumerationValuesVisitor = new CollectEnumerationValuesVisitor(); component.visit(collectEnumerationValuesVisitor); final List<XmlString> enumerationValues = collectEnumerationValuesVisitor.getValues(); if (enumerationValues != null && !enumerationValues.isEmpty()) { final JSArrayLiteral values = mappingCompiler.getCodeModel().array(); boolean valueSupported = true; for (XmlString enumerationValue : enumerationValues) { final JSAssignmentExpression value = typeInfoCompiler.createValue(this.mappingCompiler, enumerationValue); if (value == null) { valueSupported = false; break; } else { values.append(value); } } if (valueSupported) { options.append(mappingCompiler.getNaming().values(), values); } } } } } }
Example #7
Source File: EnumLeafInfoCompiler.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 5 votes |
@Override public JSAssignmentExpression createValue(MappingCompiler<T, C> mappingCompiler, XmlString item) { final MTypeInfo<T, C> baseTypeInfo = enumLeafInfo.getBaseTypeInfo(); final TypeInfoCompiler<T, C> baseTypeInfoCompiler = mappingCompiler.getTypeInfoCompiler(enumLeafInfo, baseTypeInfo); return baseTypeInfoCompiler.createValue(mappingCompiler, item); }
Example #8
Source File: DefaultTypeUse.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 5 votes |
public JExpression createConstant(Outline outline, XmlString lexical) { if (isCollection()) return null; if (adapter == null) return coreType.createConstant(outline, lexical); // [RESULT] new Adapter().unmarshal(CONSTANT); JExpression cons = coreType.createConstant(outline, lexical); @SuppressWarnings("unchecked") Class<? extends XmlAdapter<?, ?>> atype = (Class<? extends XmlAdapter<?, ?>>) adapter .getAdapterIfKnown(); // try to run the adapter now rather than later. if (cons instanceof JStringLiteral && atype != null) { JStringLiteral scons = (JStringLiteral) cons; @SuppressWarnings("unchecked") XmlAdapter<Object, String> a = (XmlAdapter<Object, String>) ClassFactory .create(atype); try { Object value = a.unmarshal(scons.str); if (value instanceof String) { return JExpr.lit((String) value); } } catch (Exception e) { // assume that we can't eagerly bind this } } return JExpr._new(adapter.getAdapterClass(outline)).invoke("unmarshal") .arg(cons); }
Example #9
Source File: XJCCMInfoFactory.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 5 votes |
protected NamespaceContext getDefaultValueNamespaceContext( CAttributePropertyInfo propertyInfo) { final XSAttributeUse attributeUse = getAttributeUse(propertyInfo); if (attributeUse != null) { final XmlString defaultValue = attributeUse.getDefaultValue(); if (defaultValue != null) { return new NamespaceContextAdapter(defaultValue); } } return null; }
Example #10
Source File: XJCCMInfoFactory.java From jaxb2-basics with BSD 2-Clause "Simplified" License | 5 votes |
protected String getDefaultValue(CAttributePropertyInfo propertyInfo) { final XSAttributeUse attributeUse = getAttributeUse(propertyInfo); if (attributeUse != null) { final XmlString defaultValue = attributeUse.getDefaultValue(); if (defaultValue != null) { return defaultValue.value; } } return null; }
Example #11
Source File: ElementDecl.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
public ElementDecl( PatcherManager reader, SchemaDocumentImpl owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl fa, String _tns, String _name, boolean _anonymous, XmlString _defv, XmlString _fixedv, boolean _nillable, boolean _abstract, Ref.Type _type, Ref.Element _substHead, int _substDisallowed, int _substExcluded, List<IdentityConstraintImpl> idConstraints ) { super(owner,_annon,_loc,fa,_tns,_name,_anonymous); this.defaultValue = _defv; this.fixedValue = _fixedv; this.nillable = _nillable; this._abstract = _abstract; this.type = _type; this.substHead = _substHead; this.substDisallowed = _substDisallowed; this.substExcluded = _substExcluded; this.idConstraints = Collections.unmodifiableList((List<? extends XSIdentityConstraint>)idConstraints); for (IdentityConstraintImpl idc : idConstraints) idc.setParent(this); if(type==null) throw new IllegalArgumentException(); }
Example #12
Source File: FacetImpl.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
public FacetImpl( SchemaDocumentImpl owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa, String _name, XmlString _value, boolean _fixed ) { super(owner,_annon,_loc,_fa); this.name = _name; this.value = _value; this.fixed = _fixed; }
Example #13
Source File: AttributeUseImpl.java From jolie with GNU Lesser General Public License v2.1 | 5 votes |
public AttributeUseImpl( SchemaDocumentImpl owner, AnnotationImpl ann, Locator loc, ForeignAttributesImpl fa, Ref.Attribute _decl, XmlString def, XmlString fixed, boolean req ) { super(owner,ann,loc,fa); this.att = _decl; this.defaultValue = def; this.fixedValue = fixed; this.required = req; }
Example #14
Source File: PackagedTypeInfoCompiler.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 4 votes |
@Override public JSAssignmentExpression createValue(MappingCompiler<T, C> mappingCompiler, XmlString item) { return createValue(mappingCompiler, item.value); }
Example #15
Source File: XmlFormBuilder.java From dynaform with Artistic License 2.0 | 4 votes |
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 #16
Source File: NGCCRuntimeEx.java From jolie with GNU Lesser General Public License v2.1 | 4 votes |
public XmlString createXmlString(String value) { if(value==null) return null; else return new XmlString(value,createValidationContext()); }
Example #17
Source File: CollectEnumerationValuesVisitor.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 4 votes |
public List<XmlString> getValues() { return values; }
Example #18
Source File: PackagedTypeInfoProducer.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 4 votes |
@Override public JsonValue createValue(JsonSchemaMappingCompiler<T, C> mappingCompiler, XmlString item) { return createValue(mappingCompiler, item.value); }
Example #19
Source File: BuiltinLeafInfoProducer.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 4 votes |
@Override public JsonValue createValue(JsonSchemaMappingCompiler<T, C> mappingCompiler, XmlString item) { return createValue(mappingCompiler, item.value); }
Example #20
Source File: XPathImpl.java From jolie with GNU Lesser General Public License v2.1 | 4 votes |
public XPathImpl(SchemaDocumentImpl _owner, AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl fa, XmlString xpath) { super(_owner, _annon, _loc, fa); this.xpath = xpath; }
Example #21
Source File: XPathImpl.java From jolie with GNU Lesser General Public License v2.1 | 4 votes |
public XmlString getXPath() { return xpath; }
Example #22
Source File: BuiltinLeafInfoCompiler.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | 4 votes |
@Override public JSAssignmentExpression createValue(MappingCompiler<T, C> mappingCompiler, XmlString item) { return createValue(mappingCompiler, item.value); }
Example #23
Source File: CExternalLeafInfo.java From hyperjaxb3 with BSD 2-Clause "Simplified" License | 4 votes |
public JExpression createConstant(Outline arg0, XmlString arg1) { return null; }
Example #24
Source File: AttributeUseImpl.java From jolie with GNU Lesser General Public License v2.1 | 4 votes |
public XmlString getDefaultValue() { if( defaultValue!=null ) return defaultValue; else return getDecl().getDefaultValue(); }
Example #25
Source File: AttributeUseImpl.java From jolie with GNU Lesser General Public License v2.1 | 4 votes |
public XmlString getFixedValue() { if( fixedValue!=null ) return fixedValue; else return getDecl().getFixedValue(); }
Example #26
Source File: FacetImpl.java From jolie with GNU Lesser General Public License v2.1 | votes |
public XmlString getValue() { return value; }
Example #27
Source File: TypeInfoCompiler.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | votes |
public JSAssignmentExpression createValue(MappingCompiler<T, C> mappingCompiler, XmlString item);
Example #28
Source File: AttributeDeclImpl.java From jolie with GNU Lesser General Public License v2.1 | votes |
public XmlString getFixedValue() { return fixedValue; }
Example #29
Source File: TypeInfoProducer.java From jsonix-schema-compiler with BSD 2-Clause "Simplified" License | votes |
public JsonValue createValue(JsonSchemaMappingCompiler<T, C> mappingCompiler, XmlString item);
Example #30
Source File: AttributeDeclImpl.java From jolie with GNU Lesser General Public License v2.1 | votes |
public XmlString getDefaultValue() { return defaultValue; }