@Override public void characters(char[] ch, int start, int length) throws SAXException { for (int i = 0; i < elmKeyService.length; i++) { if (elmKeyService[i].isMyTag(tagInProcess) != -1) { elmKeyService[i].characters(ch, start, length); return; } } throw new SAXException( NbBundle.getMessage(DefaultAttributes.class, "XML_UnknownElement") + " " + tagInProcess ); // NOI18N }
public void startElement(String elemName, Attributes attrs) throws SAXException { HashMap mapAllowed = new HashMap(); HashMap mapMandatory = new HashMap(); if (checkAttributes(attrs, mapMandatory, mapAllowed) == false) { throw new SAXException( NbBundle.getMessage(DefaultAttributes.class, "XML_InaccurateParam") + ": " + elemName ); // NOI18N } internalStartElement(elemName, mapMandatory, mapAllowed); }
@Override public void endElement(String uri, String lname, String name) throws SAXException { for (int i = 0; i < elmKeyService.length; i++) { if (elmKeyService[i].isMyTag(name.trim()) != -1) { elmKeyService[i].endElement(name.trim()); return; } } throw new SAXException(NbBundle.getMessage(DefaultAttributes.class, "XML_UnknownElement") + " " + name); // NOI18N }
private boolean checkAttributes(AttributeList attrList,HashMap mapMandatory,HashMap mapAllowed) { String temp; mandatAttrCount = 0; if (attrList == null) return false; for (int i = 0; i < attrList.getLength(); i++) { if (isMandatoryAttr(attrList.getName(i)) != -1) { temp = attrList.getName(i).toUpperCase(); mapMandatory.put(temp,attrList.getValue(i)); continue; } if ( isAllowedAttr(attrList.getName(i)) != -1) { temp = attrList.getName(i).toUpperCase(); mapAllowed.put(temp,attrList.getValue(i)); continue; } } return isMandatOK(); } }
private boolean checkAttributes(AttributeList attrList,HashMap mapMandatory,HashMap mapAllowed) { String temp; mandatAttrCount = 0; if (attrList == null) return false; for (int i = 0; i < attrList.getLength(); i++) { if (isMandatoryAttr(attrList.getName(i)) != -1) { temp = attrList.getName(i).toUpperCase(); mapMandatory.put(temp,attrList.getValue(i)); continue; } if ( isAllowedAttr(attrList.getName(i)) != -1) { temp = attrList.getName(i).toUpperCase(); mapAllowed.put(temp,attrList.getValue(i)); continue; } } return isMandatOK(); } }
private boolean isMandatOK() {return (mandatAttrCount == getMandatoryAttrs().length);} private int isMandatoryAttr(String name) {
private int isAllowedAttr(String name) {return isInArray(name,getAllowedAttrs());} private boolean isMandatOK() {return (mandatAttrCount == getMandatoryAttrs().length);}
private boolean isMandatOK() {return (mandatAttrCount == getMandatoryAttrs().length);} private int isMandatoryAttr(String name) {
private int isAllowedAttr(String name) {return isInArray(name,getAllowedAttrs());} private boolean isMandatOK() {return (mandatAttrCount == getMandatoryAttrs().length);}
public void endElement(String name) throws SAXException { for (int i = 0; i < elmKeyService.length;i++) { if ( elmKeyService[i].isMyTag(name.trim()) != -1) { elmKeyService[i].endElement(name.trim()); return; } } throw new SAXException (NbBundle.getMessage(DefaultAttributes.class,"XML_UnknownElement")+" "+name);// NOI18N }
/** @return names of attributes which are checked and are mandatory */ protected String[] getMandatoryAttrs() { return getKeys(); } /** @return names of attributes which are allowed, are expected, but are not mandatory
private int isMandatoryAttr(String name) { int retValue = isInArray(name,getMandatoryAttrs()); if ( retValue != -1 ) mandatAttrCount++; return retValue; }
private int isMandatoryAttr(String name) { int retValue = isInArray(name,getMandatoryAttrs()); if ( retValue != -1 ) mandatAttrCount++; return retValue; }
public void startElement(String elemName, AttributeList attrList) throws SAXException { HashMap mapAllowed =new HashMap(); HashMap mapMandatory =new HashMap(); if ( checkAttributes(attrList,mapMandatory,mapAllowed) == false ) { throw new SAXException (NbBundle.getMessage(DefaultAttributes.class,"XML_InaccurateParam")+": "+elemName);// NOI18N } internalStartElement(elemName, mapMandatory,mapAllowed); }
public void characters(char[] ch, int start, int length) throws SAXException { for (int i = 0; i < elmKeyService.length;i++) { if ( elmKeyService[i].isMyTag(tagInProcess) != -1) { elmKeyService[i].characters(ch,start,length); return; } } throw new SAXException (NbBundle.getMessage(DefaultAttributes.class,"XML_UnknownElement")+" "+tagInProcess);// NOI18N }
public void endElement(String name) throws SAXException { for (int i = 0; i < elmKeyService.length;i++) { if ( elmKeyService[i].isMyTag(name.trim()) != -1) { elmKeyService[i].endElement(name.trim()); return; } } throw new SAXException (NbBundle.getMessage(DefaultAttributes.class,"XML_UnknownElement")+" "+name);// NOI18N }
public void characters(char[] ch, int start, int length) throws SAXException { for (int i = 0; i < elmKeyService.length;i++) { if ( elmKeyService[i].isMyTag(tagInProcess) != -1) { elmKeyService[i].characters(ch,start,length); return; } } throw new SAXException (NbBundle.getMessage(DefaultAttributes.class,"XML_UnknownElement")+" "+tagInProcess);// NOI18N }
/** @return names of attributes which are checked and are mandatory */ protected String[] getMandatoryAttrs() { return getKeys(); } /** @return names of attributes which are allowed, are expected, but are not mandatory