📄 xsattributechecker.java
字号:
attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // xpath = a subset of XPath expression attrList.put(SchemaSymbols.ATT_XPATH, allAttrs[ATT_XPATH_R]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_SELECTOR, oneEle); // for element "field" - local attrList = Container.getContainer(2); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // xpath = a subset of XPath expression attrList.put(SchemaSymbols.ATT_XPATH, allAttrs[ATT_XPATH1_R]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_FIELD, oneEle); // for element "annotation" - global attrList = Container.getContainer(1); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); oneEle = new OneElement (attrList); fEleAttrsMapG.put(SchemaSymbols.ELT_ANNOTATION, oneEle); // for element "annotation" - local fEleAttrsMapL.put(SchemaSymbols.ELT_ANNOTATION, oneEle); // for element "appinfo" - local attrList = Container.getContainer(1); // source = anyURI attrList.put(SchemaSymbols.ATT_SOURCE, allAttrs[ATT_SOURCE_N]); oneEle = new OneElement (attrList); fEleAttrsMapG.put(SchemaSymbols.ELT_APPINFO, oneEle); fEleAttrsMapL.put(SchemaSymbols.ELT_APPINFO, oneEle); // for element "documentation" - local attrList = Container.getContainer(2); // source = anyURI attrList.put(SchemaSymbols.ATT_SOURCE, allAttrs[ATT_SOURCE_N]); // xml:lang = language attrList.put(SchemaSymbols.ATT_XML_LANG, allAttrs[ATT_XML_LANG]); oneEle = new OneElement (attrList); fEleAttrsMapG.put(SchemaSymbols.ELT_DOCUMENTATION, oneEle); fEleAttrsMapL.put(SchemaSymbols.ELT_DOCUMENTATION, oneEle); // for element "simpleType" - global attrList = Container.getContainer(3); // final = (#all | List of (list | union | restriction)) attrList.put(SchemaSymbols.ATT_FINAL, allAttrs[ATT_FINAL1_N]); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // name = NCName attrList.put(SchemaSymbols.ATT_NAME, allAttrs[ATT_NAME_R]); oneEle = new OneElement (attrList); fEleAttrsMapG.put(SchemaSymbols.ELT_SIMPLETYPE, oneEle); // for element "simpleType" - local attrList = Container.getContainer(2); // final = (#all | List of (list | union | restriction)) attrList.put(SchemaSymbols.ATT_FINAL, allAttrs[ATT_FINAL1_N]); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_SIMPLETYPE, oneEle); // for element "restriction" - local // already registered for complexType // for element "list" - local attrList = Container.getContainer(2); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // itemType = QName attrList.put(SchemaSymbols.ATT_ITEMTYPE, allAttrs[ATT_ITEMTYPE_N]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_LIST, oneEle); // for element "union" - local attrList = Container.getContainer(2); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // memberTypes = List of QName attrList.put(SchemaSymbols.ATT_MEMBERTYPES, allAttrs[ATT_MEMBER_T_N]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_UNION, oneEle); // for element "schema" - global attrList = Container.getContainer(8); // attributeFormDefault = (qualified | unqualified) : unqualified attrList.put(SchemaSymbols.ATT_ATTRIBUTEFORMDEFAULT, allAttrs[ATT_ATTRIBUTE_FD_D]); // blockDefault = (#all | List of (substitution | extension | restriction | list | union)) : '' attrList.put(SchemaSymbols.ATT_BLOCKDEFAULT, allAttrs[ATT_BLOCK_D_D]); // elementFormDefault = (qualified | unqualified) : unqualified attrList.put(SchemaSymbols.ATT_ELEMENTFORMDEFAULT, allAttrs[ATT_ELEMENT_FD_D]); // finalDefault = (#all | List of (extension | restriction | list | union)) : '' attrList.put(SchemaSymbols.ATT_FINALDEFAULT, allAttrs[ATT_FINAL_D_D]); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // targetNamespace = anyURI attrList.put(SchemaSymbols.ATT_TARGETNAMESPACE, allAttrs[ATT_TARGET_N_N]); // version = token attrList.put(SchemaSymbols.ATT_VERSION, allAttrs[ATT_VERSION_N]); // xml:lang = language attrList.put(SchemaSymbols.ATT_XML_LANG, allAttrs[ATT_XML_LANG]); oneEle = new OneElement (attrList); fEleAttrsMapG.put(SchemaSymbols.ELT_SCHEMA, oneEle); // for element "include" - global attrList = Container.getContainer(2); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // schemaLocation = anyURI attrList.put(SchemaSymbols.ATT_SCHEMALOCATION, allAttrs[ATT_SCHEMA_L_R]); oneEle = new OneElement (attrList); fEleAttrsMapG.put(SchemaSymbols.ELT_INCLUDE, oneEle); // for element "redefine" - global fEleAttrsMapG.put(SchemaSymbols.ELT_REDEFINE, oneEle); // for element "import" - global attrList = Container.getContainer(3); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // namespace = anyURI attrList.put(SchemaSymbols.ATT_NAMESPACE, allAttrs[ATT_NAMESPACE_N]); // schemaLocation = anyURI attrList.put(SchemaSymbols.ATT_SCHEMALOCATION, allAttrs[ATT_SCHEMA_L_N]); oneEle = new OneElement (attrList); fEleAttrsMapG.put(SchemaSymbols.ELT_IMPORT, oneEle); // for element "length" - local attrList = Container.getContainer(3); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // value = nonNegativeInteger attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_NNI_N]); // fixed = boolean : false attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_LENGTH, oneEle); // for element "minLength" - local fEleAttrsMapL.put(SchemaSymbols.ELT_MINLENGTH, oneEle); // for element "maxLength" - local fEleAttrsMapL.put(SchemaSymbols.ELT_MAXLENGTH, oneEle); // for element "fractionDigits" - local fEleAttrsMapL.put(SchemaSymbols.ELT_FRACTIONDIGITS, oneEle); // for element "totalDigits" - local attrList = Container.getContainer(3); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // value = positiveInteger attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_PI_N]); // fixed = boolean : false attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_TOTALDIGITS, oneEle); // for element "pattern" - local attrList = Container.getContainer(2); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // value = string attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_STR_N]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_PATTERN, oneEle); // for element "enumeration" - local attrList = Container.getContainer(2); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // value = anySimpleType attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_STR_N]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_ENUMERATION, oneEle); // for element "whiteSpace" - local attrList = Container.getContainer(3); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // value = preserve | replace | collapse attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_WS_N]); // fixed = boolean : false attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_WHITESPACE, oneEle); // for element "maxInclusive" - local attrList = Container.getContainer(3); // id = ID attrList.put(SchemaSymbols.ATT_ID, allAttrs[ATT_ID_N]); // value = anySimpleType attrList.put(SchemaSymbols.ATT_VALUE, allAttrs[ATT_VALUE_STR_N]); // fixed = boolean : false attrList.put(SchemaSymbols.ATT_FIXED, allAttrs[ATT_FIXED_D]); oneEle = new OneElement (attrList); fEleAttrsMapL.put(SchemaSymbols.ELT_MAXINCLUSIVE, oneEle); // for element "maxExclusive" - local fEleAttrsMapL.put(SchemaSymbols.ELT_MAXEXCLUSIVE, oneEle); // for element "minInclusive" - local fEleAttrsMapL.put(SchemaSymbols.ELT_MININCLUSIVE, oneEle); // for element "minExclusive" - local fEleAttrsMapL.put(SchemaSymbols.ELT_MINEXCLUSIVE, oneEle); } // used to resolver namespace prefixes protected XSDHandler fSchemaHandler = null; // used to store symbols. protected SymbolTable fSymbolTable = null; // used to store the mapping from processed element to attributes protected Hashtable fNonSchemaAttrs = new Hashtable(); // temprory vector, used to hold the namespace list protected Vector fNamespaceList = new Vector(); // whether this attribute appeared in the current element protected boolean[] fSeen = new boolean[ATTIDX_COUNT]; private static boolean[] fSeenTemp = new boolean[ATTIDX_COUNT]; // constructor. Sets fErrorReproter and get datatype validators public XSAttributeChecker(XSDHandler schemaHandler) { fSchemaHandler = schemaHandler; } public void reset(SymbolTable symbolTable) { fSymbolTable = symbolTable; fNonSchemaAttrs.clear(); } /** * Check whether the specified element conforms to the attributes restriction * an array of attribute values is returned. the caller must call * <code>returnAttrArray</code> to return that array. * * @param element which element to check * @param isGlobal whether a child of <schema> or <redefine> * @param schemaDoc the document where the element lives in * @return an array containing attribute values */ public Object[] checkAttributes(Element element, boolean isGlobal, XSDocumentInfo schemaDoc) { return checkAttributes(element, isGlobal, schemaDoc, false); } /** * Check whether the specified element conforms to the attributes restriction * an array of attribute values is returned. the caller must call * <code>returnAttrArray</code> to return that array. This method also takes * an extra parameter: if the element is "enumeration", whether to make a * copy of the namespace context, so that the value can be resolved as a * QName later. * * @param element which element to check * @param isGlobal whether a child of <schema> or <redefine>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -