src/com/sun/org/apache/xerces/internal/impl/dtd/XMLDTDValidator.java

Print this page




1201                 }
1202             }
1203             // get next att decl in the Grammar for this element
1204             attlistIndex = fDTDGrammar.getNextAttributeDeclIndex(attlistIndex);
1205         }
1206 
1207         // now iterate through the expanded attributes for
1208         // 1. if every attribute seen is declared in the DTD
1209         // 2. check if the VC: default_fixed holds
1210         // 3. validate every attribute.
1211         int attrCount = attributes.getLength();
1212         for (int i = 0; i < attrCount; i++) {
1213             String attrRawName = attributes.getQName(i);
1214             boolean declared = false;
1215             if (fPerformValidation) {
1216                 if (fGrammarBucket.getStandalone()) {
1217                     // check VC: Standalone Document Declaration, entities
1218                     // references appear in the document.
1219                     // REVISIT: this can be combined to a single check in
1220                     // startEntity if we add one more argument in
1221                     // startEnity, inAttrValue
1222                     String nonNormalizedValue = attributes.getNonNormalizedValue(i);
1223                     if (nonNormalizedValue != null) {
1224                         String entityName = getExternalEntityRefInAttrValue(nonNormalizedValue);
1225                         if (entityName != null) {
1226                             fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
1227                                                        "MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE",
1228                                                        new Object[]{entityName},
1229                                                        XMLErrorReporter.SEVERITY_ERROR);
1230                         }
1231                     }
1232                 }
1233             }
1234             int attDefIndex = -1;
1235             int position =
1236             fDTDGrammar.getFirstAttributeDeclIndex(elementIndex);
1237             while (position != -1) {
1238                 fDTDGrammar.getAttributeDecl(position, fTempAttDecl);
1239                 if (fTempAttDecl.name.rawname == attrRawName) {
1240                     // found the match att decl,
1241                     attDefIndex = position;




1201                 }
1202             }
1203             // get next att decl in the Grammar for this element
1204             attlistIndex = fDTDGrammar.getNextAttributeDeclIndex(attlistIndex);
1205         }
1206 
1207         // now iterate through the expanded attributes for
1208         // 1. if every attribute seen is declared in the DTD
1209         // 2. check if the VC: default_fixed holds
1210         // 3. validate every attribute.
1211         int attrCount = attributes.getLength();
1212         for (int i = 0; i < attrCount; i++) {
1213             String attrRawName = attributes.getQName(i);
1214             boolean declared = false;
1215             if (fPerformValidation) {
1216                 if (fGrammarBucket.getStandalone()) {
1217                     // check VC: Standalone Document Declaration, entities
1218                     // references appear in the document.
1219                     // REVISIT: this can be combined to a single check in
1220                     // startEntity if we add one more argument in
1221                     // startEntity, inAttrValue
1222                     String nonNormalizedValue = attributes.getNonNormalizedValue(i);
1223                     if (nonNormalizedValue != null) {
1224                         String entityName = getExternalEntityRefInAttrValue(nonNormalizedValue);
1225                         if (entityName != null) {
1226                             fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
1227                                                        "MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE",
1228                                                        new Object[]{entityName},
1229                                                        XMLErrorReporter.SEVERITY_ERROR);
1230                         }
1231                     }
1232                 }
1233             }
1234             int attDefIndex = -1;
1235             int position =
1236             fDTDGrammar.getFirstAttributeDeclIndex(elementIndex);
1237             while (position != -1) {
1238                 fDTDGrammar.getAttributeDecl(position, fTempAttDecl);
1239                 if (fTempAttDecl.name.rawname == attrRawName) {
1240                     // found the match att decl,
1241                     attDefIndex = position;