public void checkRequiredAttribute(String element, String name, Object value) { if (value == null) { addError(IStatus.WARNING, NLS.bind(Messages.XMLParser_Missing_Required_Attribute, element, name), null); } }
public Version extractPIVersion(String target, String data) { return checkVersion(target, PI_VERSION_ATTRIBUTE, extractPIAttribute(data, PI_VERSION_ATTRIBUTE)); }
String key = msg; Object[] args = new Object[] {}; String root = (getRootObject() == null ? "" //$NON-NLS-1$ : " (" + getRootObject() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ if (this.locator != null) { String name = this.locator.getSystemId(); String prefix = getErrorPrefix(); String suffix = getErrorSuffix(); if (prefix != null) { errMsg = prefix + errMsg; this.status = new MultiStatus(bundleId, IStatus.OK, new IStatus[] {currStatus}, getErrorMessage(), null); } else { this.status.add(currStatus);
/** * Parse the attributes of an element, given the list of required and optional ones. * Return values in same order, null for those not present. * Log warnings for extra attributes or missing required attributes. */ protected String[] parseAttributes(Attributes attributes, String[] required, String[] optional) { String[] result = new String[required.length + optional.length]; for (int i = 0; i < attributes.getLength(); i += 1) { String name = attributes.getLocalName(i); String value = attributes.getValue(i).trim().intern(); int j; if ((j = indexOf(required, name)) >= 0) { result[j] = value; } else if ((j = indexOf(optional, name)) >= 0) { result[required.length + j] = value; } else { unexpectedAttribute(elementHandled, name, value); } } for (int i = 0; i < required.length; i += 1) { checkRequiredAttribute(elementHandled, required[i], result[i]); } return result; }
public void duplicateElement(AbstractHandler handler, String element, Attributes attributes) { addError(IStatus.WARNING, NLS.bind(Messages.XMLParser_Duplicate_Element, new Object[] {handler.getName(), element, toString(attributes)}), null); //ignore the duplicate element entirely because we have already logged it new IgnoringHandler(handler); }
protected SAXParser getParser() throws ParserConfigurationException, SAXException { SAXParserFactory factory = acquireXMLParsing(this.context); if (factory == null) { throw new SAXException(Messages.XMLParser_No_SAX_Parser); } factory.setNamespaceAware(true); factory.setValidating(false); try { factory.setFeature("http://xml.org/sax/features/string-interning", true); //$NON-NLS-1$ } catch (SAXException se) { // some parsers may not support string interning } SAXParser theParser = factory.newSAXParser(); if (theParser == null) { throw new SAXException(Messages.XMLParser_No_SAX_Parser); } xmlReader = theParser.getXMLReader(); return theParser; }
String key = msg; Object[] args = new Object[] {}; String root = (getRootObject() == null ? "" //$NON-NLS-1$ : " (" + getRootObject() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ if (this.locator != null) { String name = this.locator.getSystemId(); String prefix = getErrorPrefix(); String suffix = getErrorSuffix(); if (prefix != null) { errMsg = prefix + errMsg; this.status = new MultiStatus(bundleId, IStatus.OK, new IStatus[] {currStatus}, getErrorMessage(), null); } else { this.status.add(currStatus);
/** * Parse the attributes of an element, given the list of required and optional ones. * Return values in same order, null for those not present. * Log warnings for extra attributes or missing required attributes. */ protected String[] parseAttributes(Attributes attributes, String[] required, String[] optional) { String[] result = new String[required.length + optional.length]; for (int i = 0; i < attributes.getLength(); i += 1) { String name = attributes.getLocalName(i); String value = attributes.getValue(i).trim().intern(); int j; if ((j = indexOf(required, name)) >= 0) { result[j] = value; } else if ((j = indexOf(optional, name)) >= 0) { result[required.length + j] = value; } else { unexpectedAttribute(elementHandled, name, value); } } for (int i = 0; i < required.length; i += 1) { checkRequiredAttribute(elementHandled, required[i], result[i]); } return result; }
public void duplicateElement(AbstractHandler handler, String element, Attributes attributes) { addError(IStatus.WARNING, NLS.bind(Messages.XMLParser_Duplicate_Element, new Object[] {handler.getName(), element, toString(attributes)}), null); //ignore the duplicate element entirely because we have already logged it new IgnoringHandler(handler); }
protected SAXParser getParser() throws ParserConfigurationException, SAXException { SAXParserFactory factory = acquireXMLParsing(this.context); if (factory == null) { throw new SAXException(Messages.XMLParser_No_SAX_Parser); } factory.setNamespaceAware(true); factory.setValidating(false); try { factory.setFeature("http://xml.org/sax/features/string-interning", true); //$NON-NLS-1$ } catch (SAXException se) { // some parsers may not support string interning } SAXParser theParser = factory.newSAXParser(); if (theParser == null) { throw new SAXException(Messages.XMLParser_No_SAX_Parser); } xmlReader = theParser.getXMLReader(); return theParser; }
public void checkRequiredAttribute(String element, String name, Object value) { if (value == null) { addError(IStatus.WARNING, NLS.bind(Messages.XMLParser_Missing_Required_Attribute, element, name), null); } }
public Version extractPIVersion(String target, String data) { return checkVersion(target, PI_VERSION_ATTRIBUTE, extractPIAttribute(data, PI_VERSION_ATTRIBUTE)); }
public void fatalError(SAXParseException ex) { addError(IStatus.ERROR, ex.getMessage(), ex); }
public void invalidAttributeValue(String element, String attribute, String value, Throwable exception) { addError(IStatus.WARNING, NLS.bind(Messages.XMLParser_Illegal_Value_For_Attribute, new Object[] {attribute, element, value}), exception); }
public void invalidAttributeValue(String element, String attribute, String value, Throwable exception) { addError(IStatus.WARNING, NLS.bind(Messages.XMLParser_Illegal_Value_For_Attribute, new Object[] {attribute, element, value}), exception); }
public void fatalError(SAXParseException ex) { addError(IStatus.ERROR, ex.getMessage(), ex); }
public void error(SAXParseException ex) { addError(IStatus.WARNING, ex.getMessage(), ex); }
public void error(SAXParseException ex) { addError(IStatus.WARNING, ex.getMessage(), ex); }