/** * @param result * @param severity */ private void reportMaxOccurenceViolation(ElementOccurrenceResult result, int severity) { Element childElement = result.getElement(); String allowedOccurrences = Integer.valueOf(result.getAllowedOccurrences()).toString(); String message = NLS.bind(PDECoreMessages.ExtensionsErrorReporter_maxOccurrence, new String[] {allowedOccurrences, childElement.getNodeName()}); report(message, getLine(childElement), severity, PDEMarkerFactory.P_ILLEGAL_XML_NODE, childElement, null, PDEMarkerFactory.CAT_FATAL); }
/** * @param parentElement * @param result * @param severity */ private void reportMinOccurenceViolation(Element parentElement, ElementOccurrenceResult result, int severity) { ISchemaElement childElement = result.getSchemaElement(); String allowedOccurrences = Integer.valueOf(result.getAllowedOccurrences()).toString(); String message = NLS.bind(PDECoreMessages.ExtensionsErrorReporter_minOccurrence, new String[] {allowedOccurrences, childElement.getName()}); report(message, getLine(parentElement), severity, PDEMarkerFactory.CAT_FATAL); }
private static void processElementMin(ISchemaElement schemaElement, HashSet<ElementOccurrenceResult> elementSet, HashMap<String, Integer> siblings, int multiplicityTracker) { int occurrences = 0; String name = schemaElement.getName(); // Determine the number of occurrences found of this element if (siblings.containsKey(name)) { occurrences = siblings.get(schemaElement.getName()).intValue(); } // Determine if the elements min occurrences is respected if (multiplicityTracker < Integer.MAX_VALUE) { multiplicityTracker = schemaElement.getMinOccurs() * multiplicityTracker; } // If a given element occurs les than the tracked min occurs, add // it to the list // Note: This is a simple calculation that does not address all complex // XML Schema multiplity rules. For instance, multiple layers of // choices and sequences compositors coupled with varying siblings // elements require a regex processor // For the PDE space this is not required as extension point schemas // are always very simple if (occurrences < multiplicityTracker) { elementSet.add(new ElementOccurrenceResult(null, schemaElement, occurrences, multiplicityTracker)); } }
private static void processElementMax(ISchemaElement schemaElement, HashSet<ElementOccurrenceResult> elementSet, HashMap<String, Integer> siblings, int multiplicityTracker, Element element) { int occurrences = 0; String name = schemaElement.getName(); // Determine the number of occurrences found of this element if (siblings.containsKey(name)) { occurrences = siblings.get(schemaElement.getName()).intValue(); } // Determine if the elements max occurrences is respected if (multiplicityTracker < Integer.MAX_VALUE) { multiplicityTracker = schemaElement.getMaxOccurs() * multiplicityTracker; } // If a given element occurs more than the tracked max occurs, add // it to the list // Note: This is a simple calculation that does not address all complex // XML Schema multiplity rules. For instance, multiple layers of // choices and sequences compositors coupled with varying siblings // elements require a regex processor // For the PDE space this is not required as extension point schemas // are always very simple if (occurrences > multiplicityTracker) { elementSet.add(new ElementOccurrenceResult(element, schemaElement, occurrences, multiplicityTracker)); } }
/** * @param parentElement * @param childElement * @param severity */ private void reportMaxOccurenceViolation(ElementOccurrenceResult result, int severity) { Element childElement = result.getElement(); String allowedOccurrences = new Integer(result.getAllowedOccurrences()).toString(); String message = NLS.bind( PDECoreMessages.ExtensionsErrorReporter_maxOccurrence, new String[] { allowedOccurrences, childElement.getNodeName() }); report(message, getLine(childElement), severity, PDEMarkerFactory.P_ILLEGAL_XML_NODE, childElement, null, PDEMarkerFactory.CAT_FATAL); }
/** * @param parentElement * @param childElement * @param severity */ private void reportMinOccurenceViolation(Element parentElement, ElementOccurrenceResult result, int severity) { ISchemaElement childElement = result.getSchemaElement(); String allowedOccurrences = new Integer(result.getAllowedOccurrences()).toString(); String message = NLS.bind( PDECoreMessages.ExtensionsErrorReporter_minOccurrence, new String[] { allowedOccurrences, childElement.getName()}); report(message, getLine(parentElement), severity, PDEMarkerFactory.CAT_FATAL); }
elementSet.add(new ElementOccurrenceResult(element, schemaElement, occurrences, multiplicityTracker));
elementSet.add(new ElementOccurrenceResult(null, schemaElement, occurrences, multiplicityTracker));