com.sun.org.apache.xerces.internal.xs.XSTypeDefinition Java Examples
The following examples show how to use
com.sun.org.apache.xerces.internal.xs.XSTypeDefinition.
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: XSDHandler.java From hottub with GNU General Public License v2.0 | 6 votes |
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) { short componentType = component.getType(); switch (componentType) { case XSConstants.TYPE_DEFINITION : expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies); break; case XSConstants.ATTRIBUTE_DECLARATION : expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies); break; case XSConstants.ATTRIBUTE_GROUP : expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies); case XSConstants.ELEMENT_DECLARATION : expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies); break; case XSConstants.MODEL_GROUP_DEFINITION : expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies); case XSConstants.ATTRIBUTE_USE : //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies); case XSConstants.NOTATION_DECLARATION : case XSConstants.IDENTITY_CONSTRAINT : default : break; } }
Example #2
Source File: XSSimpleTypeDecl.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * DOM Level 3 * Checks if a type is derived from another by restriction. See: * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom * * @param ancestorNS * The namspace of the ancestor type declaration * @param ancestorName * The name of the ancestor type declaration * @param type * The reference type definition * * @return boolean True if the type is derived by restriciton for the * reference type */ private boolean isDerivedByRestriction (String ancestorNS, String ancestorName, XSTypeDefinition type) { XSTypeDefinition oldType = null; while (type != null && type != oldType) { if ((ancestorName.equals(type.getName())) && ((ancestorNS != null && ancestorNS.equals(type.getNamespace())) || (type.getNamespace() == null && ancestorNS == null))) { return true; } oldType = type; type = type.getBaseType(); } return false; }
Example #3
Source File: XSSimpleTypeDecl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * DOM Level 3 * Checks if a type is derived from another by restriction. See: * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom * * @param ancestorNS * The namspace of the ancestor type declaration * @param ancestorName * The name of the ancestor type declaration * @param type * The reference type definition * * @return boolean True if the type is derived by restriciton for the * reference type */ private boolean isDerivedByRestriction (String ancestorNS, String ancestorName, XSTypeDefinition type) { XSTypeDefinition oldType = null; while (type != null && type != oldType) { if ((ancestorName.equals(type.getName())) && ((ancestorNS != null && ancestorNS.equals(type.getNamespace())) || (type.getNamespace() == null && ancestorNS == null))) { return true; } oldType = type; type = type.getBaseType(); } return false; }
Example #4
Source File: XSSimpleTypeDecl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * Checks if a type is derived from another by list. See: * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom * * @param ancestorNS * The namspace of the ancestor type declaration * @param ancestorName * The name of the ancestor type declaration * @param type * The reference type definition * * @return boolean True if the type is derived by list for the reference type */ private boolean isDerivedByList (String ancestorNS, String ancestorName, XSTypeDefinition type) { // If the variety is union if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_LIST) { // get the {item type} XSTypeDefinition itemType = ((XSSimpleTypeDefinition)type).getItemType(); // T2 is the {item type definition} if (itemType != null) { // T2 is derived from the other type definition by DERIVATION_RESTRICTION if (isDerivedByRestriction(ancestorNS, ancestorName, itemType)) { return true; } } } return false; }
Example #5
Source File: DOMResultAugmentor.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void endElement(QName element, Augmentations augs) throws XNIException { final Node currentElement = fDOMValidatorHelper.getCurrentElement(); // Write type information to this element if (augs != null && fDocumentImpl != null) { ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI); if (elementPSVI != null) { if (fStorePSVI) { ((PSVIElementNSImpl) currentElement).setPSVI(elementPSVI); } XSTypeDefinition type = elementPSVI.getMemberTypeDefinition(); if (type == null) { type = elementPSVI.getTypeDefinition(); } ((ElementNSImpl) currentElement).setType(type); } } }
Example #6
Source File: XSConstraints.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * check whether simple type derived is valid derived from base, * given a subset of {restriction, extension}. */ public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) { // if derived is anySimpleType, then it's valid only if the base // is ur-type if (derived == SchemaGrammar.fAnySimpleType) { return (base == SchemaGrammar.fAnyType || base == SchemaGrammar.fAnySimpleType); } // if base is complex type if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { // if base is anyType, change base to anySimpleType, // otherwise, not valid if (base == SchemaGrammar.fAnyType) base = SchemaGrammar.fAnySimpleType; else return false; } return checkSimpleDerivation((XSSimpleType)derived, (XSSimpleType)base, block); }
Example #7
Source File: SubstitutionGroupHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private boolean getDBMethods(XSTypeDefinition typed, XSTypeDefinition typeb, OneSubGroup methods) { short dMethod = 0, bMethod = 0; while (typed != typeb && typed != SchemaGrammar.fAnyType) { if (typed.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) dMethod |= ((XSComplexTypeDecl)typed).fDerivedBy; else dMethod |= XSConstants.DERIVATION_RESTRICTION; typed = typed.getBaseType(); // type == null means the current type is anySimpleType, // whose base type should be anyType if (typed == null) typed = SchemaGrammar.fAnyType; if (typed.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) bMethod |= ((XSComplexTypeDecl)typed).fBlock; } // No derivation relation, or blocked, return false if (typed != typeb || (dMethod & bMethod) != 0) return false; // Remember the derivation methods and blocks, return true. methods.dMethod = dMethod; methods.bMethod = bMethod; return true; }
Example #8
Source File: XSConstraints.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * check whether simple type derived is valid derived from base, * given a subset of {restriction, extension}. */ public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) { // if derived is anySimpleType, then it's valid only if the base // is ur-type if (derived == SchemaGrammar.fAnySimpleType) { return (base == SchemaGrammar.fAnyType || base == SchemaGrammar.fAnySimpleType); } // if base is complex type if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { // if base is anyType, change base to anySimpleType, // otherwise, not valid if (base == SchemaGrammar.fAnyType) base = SchemaGrammar.fAnySimpleType; else return false; } return checkSimpleDerivation((XSSimpleType)derived, (XSSimpleType)base, block); }
Example #9
Source File: DOMResultAugmentor.java From JDKSourceCode1.8 with MIT License | 6 votes |
public void endElement(QName element, Augmentations augs) throws XNIException { final Node currentElement = fDOMValidatorHelper.getCurrentElement(); // Write type information to this element if (augs != null && fDocumentImpl != null) { ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI); if (elementPSVI != null) { if (fStorePSVI) { ((PSVIElementNSImpl) currentElement).setPSVI(elementPSVI); } XSTypeDefinition type = elementPSVI.getMemberTypeDefinition(); if (type == null) { type = elementPSVI.getTypeDefinition(); } ((ElementNSImpl) currentElement).setType(type); } } }
Example #10
Source File: XSConstraints.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * check whether simple type derived is valid derived from base, * given a subset of {restriction, extension}. */ public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) { // if derived is anySimpleType, then it's valid only if the base // is ur-type if (derived == SchemaGrammar.fAnySimpleType) { return (base == SchemaGrammar.fAnyType || base == SchemaGrammar.fAnySimpleType); } // if base is complex type if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { // if base is anyType, change base to anySimpleType, // otherwise, not valid if (base == SchemaGrammar.fAnyType) base = SchemaGrammar.fAnySimpleType; else return false; } return checkSimpleDerivation((XSSimpleType)derived, (XSSimpleType)base, block); }
Example #11
Source File: XSDHandler.java From JDKSourceCode1.8 with MIT License | 6 votes |
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) { short componentType = component.getType(); switch (componentType) { case XSConstants.TYPE_DEFINITION : expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies); break; case XSConstants.ATTRIBUTE_DECLARATION : expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies); break; case XSConstants.ATTRIBUTE_GROUP : expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies); case XSConstants.ELEMENT_DECLARATION : expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies); break; case XSConstants.MODEL_GROUP_DEFINITION : expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies); case XSConstants.ATTRIBUTE_USE : //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies); case XSConstants.NOTATION_DECLARATION : case XSConstants.IDENTITY_CONSTRAINT : default : break; } }
Example #12
Source File: XSConstraints.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * check whether simple type derived is valid derived from base, * given a subset of {restriction, extension}. */ public static boolean checkSimpleDerivationOk(XSSimpleType derived, XSTypeDefinition base, short block) { // if derived is anySimpleType, then it's valid only if the base // is ur-type if (derived == SchemaGrammar.fAnySimpleType) { return (base == SchemaGrammar.fAnyType || base == SchemaGrammar.fAnySimpleType); } // if base is complex type if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { // if base is anyType, change base to anySimpleType, // otherwise, not valid if (base == SchemaGrammar.fAnyType) base = SchemaGrammar.fAnySimpleType; else return false; } return checkSimpleDerivation(derived, (XSSimpleType)base, block); }
Example #13
Source File: DOMResultBuilder.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void endElement(QName element, Augmentations augs) throws XNIException { // write type information to this element if (augs != null && fDocumentImpl != null) { ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI); if (elementPSVI != null) { if (fStorePSVI) { ((PSVIElementNSImpl)fCurrentNode).setPSVI(elementPSVI); } XSTypeDefinition type = elementPSVI.getMemberTypeDefinition(); if (type == null) { type = elementPSVI.getTypeDefinition(); } ((ElementNSImpl)fCurrentNode).setType(type); } } // adjust current node reference if (fCurrentNode == fFragmentRoot) { fCurrentNode = null; fFragmentRoot = null; return; } fCurrentNode = fCurrentNode.getParentNode(); }
Example #14
Source File: XSSimpleTypeDecl.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Checks if a type is derived from another by union. See: * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom * * @param ancestorNS * The namspace of the ancestor type declaration * @param ancestorName * The name of the ancestor type declaration * @param type * The reference type definition * * @return boolean True if the type is derived by union for the reference type */ private boolean isDerivedByUnion (String ancestorNS, String ancestorName, XSTypeDefinition type) { // If the variety is union if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_UNION) { // get member types XSObjectList memberTypes = ((XSSimpleTypeDefinition)type).getMemberTypes(); for (int i = 0; i < memberTypes.getLength(); i++) { // One of the {member type definitions} is T2. if (memberTypes.item(i) != null) { // T2 is derived from the other type definition by DERIVATION_RESTRICTION if (isDerivedByRestriction(ancestorNS, ancestorName,(XSSimpleTypeDefinition)memberTypes.item(i))) { return true; } } } } return false; }
Example #15
Source File: DOMResultAugmentor.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void endElement(QName element, Augmentations augs) throws XNIException { final Node currentElement = fDOMValidatorHelper.getCurrentElement(); // Write type information to this element if (augs != null && fDocumentImpl != null) { ElementPSVI elementPSVI = (ElementPSVI)augs.getItem(Constants.ELEMENT_PSVI); if (elementPSVI != null) { if (fStorePSVI) { ((PSVIElementNSImpl) currentElement).setPSVI(elementPSVI); } XSTypeDefinition type = elementPSVI.getMemberTypeDefinition(); if (type == null) { type = elementPSVI.getTypeDefinition(); } ((ElementNSImpl) currentElement).setType(type); } } }
Example #16
Source File: XSSimpleTypeDecl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Checks if a type is derived from another by union. See: * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom * * @param ancestorNS * The namspace of the ancestor type declaration * @param ancestorName * The name of the ancestor type declaration * @param type * The reference type definition * * @return boolean True if the type is derived by union for the reference type */ private boolean isDerivedByUnion (String ancestorNS, String ancestorName, XSTypeDefinition type) { // If the variety is union if (type !=null && ((XSSimpleTypeDefinition)type).getVariety() == VARIETY_UNION) { // get member types XSObjectList memberTypes = ((XSSimpleTypeDefinition)type).getMemberTypes(); for (int i = 0; i < memberTypes.getLength(); i++) { // One of the {member type definitions} is T2. if (memberTypes.item(i) != null) { // T2 is derived from the other type definition by DERIVATION_RESTRICTION if (isDerivedByRestriction(ancestorNS, ancestorName,(XSSimpleTypeDefinition)memberTypes.item(i))) { return true; } } } } return false; }
Example #17
Source File: XSDHandler.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private void expandRelatedSimpleTypeComponents(XSSimpleTypeDefinition type, Vector componentList, String namespace, Map<String, Vector> dependencies) { final XSTypeDefinition baseType = type.getBaseType(); if (baseType != null) { addRelatedType(baseType, componentList, namespace, dependencies); } final XSTypeDefinition itemType = type.getItemType(); if (itemType != null) { addRelatedType(itemType, componentList, namespace, dependencies); } final XSTypeDefinition primitiveType = type.getPrimitiveType(); if (primitiveType != null) { addRelatedType(primitiveType, componentList, namespace, dependencies); } final XSObjectList memberTypes = type.getMemberTypes(); if (memberTypes.size() > 0) { for (int i=0; i<memberTypes.size(); i++) { addRelatedType((XSTypeDefinition)memberTypes.item(i), componentList, namespace, dependencies); } } }
Example #18
Source File: Selector.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object actualValue, short valueType, ShortList itemValueType) { super.endElement(element, type, nillable, actualValue, valueType, itemValueType); if (fElementDepth-- == fMatchedDepth) { fMatchedDepth = -1; fFieldActivator.endValueScopeFor(fIdentityConstraint, fInitialDepth); } }
Example #19
Source File: XSDHandler.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void expandRelatedTypeComponents(XSTypeDefinition type, Vector componentList, String namespace, Map<String, Vector> dependencies) { if (type instanceof XSComplexTypeDecl) { expandRelatedComplexTypeComponents((XSComplexTypeDecl) type, componentList, namespace, dependencies); } else if (type instanceof XSSimpleTypeDecl) { expandRelatedSimpleTypeComponents((XSSimpleTypeDefinition) type, componentList, namespace, dependencies); } }
Example #20
Source File: XSModelImpl.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Convenience method. Returns a top-level simple or complex type * definition. * @param name The name of the definition. * @param namespace The namespace of the definition, otherwise null. * @param loc The schema location where the component was defined * @return An <code>XSTypeDefinition</code> or null if such definition * does not exist. */ public XSTypeDefinition getTypeDefinition(String name, String namespace, String loc) { SchemaGrammar sg = (SchemaGrammar)fGrammarMap.get(null2EmptyString(namespace)); if (sg == null) { return null; } return sg.getGlobalTypeDecl(name, loc); }
Example #21
Source File: XSDAbstractTraverser.java From Bytecoder with Apache License 2.0 | 5 votes |
public static String getSchemaTypeName(XSTypeDefinition typeDefn) { String typeNameStr = ""; if (typeDefn instanceof XSSimpleTypeDefinition) { typeNameStr = ((XSSimpleTypeDecl) typeDefn).getTypeName(); } else { typeNameStr = ((XSComplexTypeDecl) typeDefn).getTypeName(); } return typeNameStr; }
Example #22
Source File: XSDAbstractTraverser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Element/Attribute traversers call this method to check whether * the type is NOTATION without enumeration facet */ void checkNotationType(String refName, XSTypeDefinition typeDecl, Element elem) { if (typeDecl.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE && ((XSSimpleType)typeDecl).getVariety() == XSSimpleType.VARIETY_ATOMIC && ((XSSimpleType)typeDecl).getPrimitiveKind() == XSSimpleType.PRIMITIVE_NOTATION) { if ((((XSSimpleType)typeDecl).getDefinedFacets() & XSSimpleType.FACET_ENUMERATION) == 0) { reportSchemaError("enumeration-required-notation", new Object[]{typeDecl.getName(), refName, DOMUtil.getLocalName(elem)}, elem); } } }
Example #23
Source File: XSNamedMap4Types.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Retrieves an <code>XSObject</code> specified by local name and namespace * URI. * @param namespace The namespace URI of the <code>XSObject</code> to * retrieve. * @param localName The local name of the <code>XSObject</code> to retrieve. * @return A <code>XSObject</code> (of any type) with the specified local * name and namespace URI, or <code>null</code> if they do not * identify any <code>XSObject</code> in this map. */ public XSObject itemByName(String namespace, String localName) { for (int i = 0; i < fNSNum; i++) { if (isEqual(namespace, fNamespaces[i])) { XSTypeDefinition type = (XSTypeDefinition)fMaps[i].get(localName); // only return it if it matches the required type if (type != null && type.getTypeCategory() == fType) { return type; } return null; } } return null; }
Example #24
Source File: XMLSchemaValidator.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public boolean characterData(String data, Augmentations augs) { fSawText = fSawText || data.length() > 0; // REVISIT: this methods basically duplicates implementation of // handleCharacters(). We should be able to reuse some code // if whitespace == -1 skip normalization, because it is a complexType // or a union type. if (fNormalizeData && fWhiteSpace != -1 && fWhiteSpace != XSSimpleType.WS_PRESERVE) { // normalize data normalizeWhitespace(data, fWhiteSpace == XSSimpleType.WS_COLLAPSE); fBuffer.append(fNormalizedStr.ch, fNormalizedStr.offset, fNormalizedStr.length); } else { if (fAppendBuffer) fBuffer.append(data); } // When it's a complex type with element-only content, we need to // find out whether the content contains any non-whitespace character. boolean allWhiteSpace = true; if (fCurrentType != null && fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType; if (ctype.fContentType == XSComplexTypeDecl.CONTENTTYPE_ELEMENT) { // data outside of element content for (int i = 0; i < data.length(); i++) { if (!XMLChar.isSpace(data.charAt(i))) { allWhiteSpace = false; fSawCharacters = true; break; } } } } return allWhiteSpace; }
Example #25
Source File: XSConstraints.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * check whether derived is valid derived from base, given a subset * of {restriction, extension}.B */ public static boolean checkTypeDerivationOk(XSTypeDefinition derived, XSTypeDefinition base, short block) { // if derived is anyType, then it's valid only if base is anyType too if (derived == SchemaGrammar.fAnyType) return derived == base; // if derived is anySimpleType, then it's valid only if the base // is ur-type if (derived == SchemaGrammar.fAnySimpleType) { return (base == SchemaGrammar.fAnyType || base == SchemaGrammar.fAnySimpleType); } // if derived is simple type if (derived.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) { // if base is complex type if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) { // if base is anyType, change base to anySimpleType, // otherwise, not valid if (base == SchemaGrammar.fAnyType) base = SchemaGrammar.fAnySimpleType; else return false; } return checkSimpleDerivation((XSSimpleType)derived, (XSSimpleType)base, block); } else { return checkComplexDerivation((XSComplexTypeDecl)derived, base, block); } }
Example #26
Source File: Selector.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void endElement(QName element, XSTypeDefinition type, boolean nillable, Object actualValue, short valueType, ShortList itemValueType) { super.endElement(element, type, nillable, actualValue, valueType, itemValueType); if (fElementDepth-- == fMatchedDepth) { fMatchedDepth = -1; fFieldActivator.endValueScopeFor(fIdentityConstraint, fInitialDepth); } }
Example #27
Source File: SchemaGrammar.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * register one global type */ public void addGlobalTypeDecl(XSTypeDefinition decl) { fGlobalTypeDecls.put(decl.getName(), decl); if (decl instanceof XSComplexTypeDecl) { ((XSComplexTypeDecl) decl).setNamespaceItem(this); } else if (decl instanceof XSSimpleTypeDecl) { ((XSSimpleTypeDecl) decl).setNamespaceItem(this); } }
Example #28
Source File: SchemaGrammar.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * register one global type */ public void addGlobalTypeDecl(XSTypeDefinition decl) { fGlobalTypeDecls.put(decl.getName(), decl); if (decl instanceof XSComplexTypeDecl) { ((XSComplexTypeDecl) decl).setNamespaceItem(this); } else if (decl instanceof XSSimpleTypeDecl) { ((XSSimpleTypeDecl) decl).setNamespaceItem(this); } }
Example #29
Source File: XMLSchemaValidator.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
Object elementLocallyValidType(QName element, Object textContent) { if (fCurrentType == null) return null; Object retValue = null; // Element Locally Valid (Type) // 3 The appropriate case among the following must be true: // 3.1 If the type definition is a simple type definition, then all of the following must be true: if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) { // 3.1.2 The element information item must have no element information item [children]. if (fSubElement) reportSchemaError("cvc-type.3.1.2", new Object[] { element.rawname }); // 3.1.3 If clause 3.2 of Element Locally Valid (Element) (3.3.4) did not apply, then the normalized value must be valid with respect to the type definition as defined by String Valid (3.14.4). if (!fNil) { XSSimpleType dv = (XSSimpleType) fCurrentType; try { if (!fNormalizeData || fUnionType) { fValidationState.setNormalizationRequired(true); } retValue = dv.validate(textContent, fValidationState, fValidatedInfo); } catch (InvalidDatatypeValueException e) { reportSchemaError(e.getKey(), e.getArgs()); reportSchemaError( "cvc-type.3.1.3", new Object[] { element.rawname, textContent }); } } } else { // 3.2 If the type definition is a complex type definition, then the element information item must be valid with respect to the type definition as per Element Locally Valid (Complex Type) (3.4.4); retValue = elementLocallyValidComplexType(element, textContent); } return retValue; }
Example #30
Source File: ShortHandPointer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns the schema-determined-ID. * * * @param attributes * @param index * @return A String containing the schema-determined ID. * @throws XNIException */ public String getSchemaDeterminedID(XMLAttributes attributes, int index) throws XNIException { Augmentations augs = attributes.getAugmentations(index); AttributePSVI attrPSVI = (AttributePSVI) augs .getItem(Constants.ATTRIBUTE_PSVI); if (attrPSVI != null) { // An element or attribute information item is a schema-determined // ID if and only if one of the following is true:] // 1. It has a [member type definition] or [type definition] property // whose value in turn has [name] equal to ID and [target namespace] // equal to http://www.w3.org/2001/XMLSchema; // 2. It has a [base type definition] whose value has that [name] and [target namespace]; // 3. It has a [base type definition] whose value has a [base type definition] // whose value has that [name] and [target namespace], and so on following // the [base type definition] property recursively; XSTypeDefinition typeDef = attrPSVI.getMemberTypeDefinition(); if (typeDef != null) { typeDef = attrPSVI.getTypeDefinition(); } // if (typeDef != null && ((XSSimpleType) typeDef).isIDType()) { return attrPSVI.getSchemaNormalizedValue(); } // 4 & 5 NA } return null; }