List of usage examples for org.xml.sax Attributes getValue
public abstract String getValue(String qName);
From source file:com.sonicle.webtop.mail.SaxHTMLMailParser.java
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (lastComment != null) { pwriter.print("<!--" + lastComment + "-->"); lastComment = null;/*from w ww . j a v a 2 s . c om*/ } if (qName.equalsIgnoreCase("html")) { inhtml = true; return; } if (!inhtml) { return; } //store body attributes if (qName.equalsIgnoreCase("body")) { body.setData(attributes); } //filter out any script element if (qName.equalsIgnoreCase("script")) { isscript = true; return; } if (!isbody) { /*if(!isscript&&qName.equalsIgnoreCase("script")) { isscript=true; }*/ if (baseUrl == null && qName.equalsIgnoreCase("base")) { baseUrl = attributes.getValue("href"); if (baseUrl != null) { if (baseUrl.toLowerCase().startsWith("file:")) { baseUrl = null; return; } else if (baseUrl.charAt(baseUrl.length() - 1) != '/') { int bx = baseUrl.lastIndexOf('/'); int dx = baseUrl.lastIndexOf('.'); if (dx > bx) { baseUrl = baseUrl.substring(0, bx + 1); //take off any wrong file spec at the end } else { baseUrl += "/"; //or append a slash } } } } } if (justBody) { if (!isbody) { if (qName.equalsIgnoreCase("body")) { isbody = true; return; } else if (qName.equalsIgnoreCase("style")) { isstyle = true; } else { return; } } } else if (qName.equalsIgnoreCase("style")) { isstyle = true; } boolean islink = false; boolean ismailto = false; boolean changedTarget = false; String mailtoParams = null; if (qName.equalsIgnoreCase("a")) { islink = true; } pwriter.print("<" + qName); int len = attributes.getLength(); for (int i = 0; i < len; ++i) { String aqname = attributes.getQName(i); String avalue = attributes.getValue(i); String laqname = aqname.toLowerCase(); boolean isdataimg = laqname.equals("src") && (avalue.startsWith("data:") || avalue.startsWith("DATA:")); if (!isdataimg) { String lavalue = avalue.toLowerCase(); if (laqname.endsWith("src") || laqname.equals("background")) { //clear any source calling / if (avalue.startsWith("#")) { avalue = ""; } else if (avalue.toLowerCase().startsWith("cid:")) { avalue = evaluateCid(avalue); } else { avalue = evaluateUrl(avalue); } } else if (laqname.equals("target")) { avalue = "_new"; changedTarget = true; } else if (laqname.equals("href") && lavalue.startsWith("mailto:")) { mailtoParams = lavalue.substring(7); avalue = "#"; ismailto = true; } } pwriter.print(" " + aqname + "=\"" + StringUtils.replace(avalue, "\"", """) + "\""); } if (ismailto) { String email = mailtoParams; String sparams = "\"" + email + "\""; int ix = mailtoParams.indexOf("?"); if (ix > 0) { email = mailtoParams.substring(0, ix); mailtoParams = mailtoParams.substring(ix + 1); Map<String, String> params = getQueryMap(mailtoParams); String subject = params.get("subject"); String body = params.get("body"); if (subject == null) subject = ""; if (body == null) body = ""; sparams = "\"" + email + "\",\"" + subject + "\",\"" + body + "\""; } pwriter.print(" onclick='parent.WT.handleMailAddress(" + sparams + "); return false;'"); } else if (islink && !changedTarget) { pwriter.print(" target=_new"); } pwriter.print(">"); pwriter.flush(); }
From source file:com.jkoolcloud.jesl.simulator.TNT4JSimulatorParserHandler.java
private void defineOption(Attributes attributes) throws SAXException { String name = null;// www . j av a 2 s .co m String value = null; try { for (int i = 0; i < attributes.getLength(); i++) { String attName = attributes.getQName(i); String attValue = expandEnvVars(attributes.getValue(i)); if (attName.equals(SIM_XML_ATTR_NAME)) name = attValue; else if (attName.equals(SIM_XML_ATTR_VALUE)) { value = attValue; String[] args = value.split(","); TNT4JSimulator.processArgs(this, args); } else { throw new SAXParseException("Unknown <" + SIM_XML_PROP + "> attribute '" + attName + "'", saxLocator); } } if (StringUtils.isEmpty(name)) throw new SAXParseException("<" + SIM_XML_VAR + ">: must specify '" + SIM_XML_ATTR_NAME + "'", saxLocator); TNT4JSimulator.trace(simCurrTime, "Defining option: '" + name + "=" + value + "'"); } catch (Exception e) { if (e instanceof SAXException) throw (SAXException) e; throw new SAXException("Failed processing definition for option '" + name + "': " + e, e); } }
From source file:com.jkoolcloud.jesl.simulator.TNT4JSimulatorParserHandler.java
private void defineVar(Attributes attributes) throws SAXException { String name = null;/*from w w w.j a va 2 s. co m*/ String value = null; try { for (int i = 0; i < attributes.getLength(); i++) { String attName = attributes.getQName(i); String attValue = expandEnvVars(attributes.getValue(i)); if (attName.equals(SIM_XML_ATTR_NAME)) name = attValue; else if (attName.equals(SIM_XML_ATTR_VALUE)) { value = processVarValue(attValue); } else { throw new SAXParseException("Unknown <" + SIM_XML_PROP + "> attribute '" + attName + "'", saxLocator); } } if (StringUtils.isEmpty(name)) throw new SAXParseException("<" + SIM_XML_VAR + ">: must specify '" + SIM_XML_ATTR_NAME + "'", saxLocator); if (value.equalsIgnoreCase("=?")) { // requires input if not defined String oVal = vars.get(name); if (oVal == null) { value = processVarValue(TNT4JSimulator.readFromConsole("\nDefine variable [" + name + "]:")); } else { TNT4JSimulator.trace(simCurrTime, "Skipping duplicate variable: '" + name + "=" + value + "', existing.value='" + oVal + "'"); } } String eVal = vars.putIfAbsent(name, value); if (eVal != null) { TNT4JSimulator.trace(simCurrTime, "Skipping duplicate variable: '" + name + "=" + value + "', existing.value='" + eVal + "'"); } TNT4JSimulator.trace(simCurrTime, "Defining variable: '" + name + "=" + value + "'"); } catch (Exception e) { if (e instanceof SAXException) throw (SAXException) e; throw new SAXException("Failed processing definition for variable '" + name + "': " + e, e); } }
From source file:com.jkoolcloud.jesl.simulator.TNT4JSimulatorParserHandler.java
private void runEvent(Attributes attributes) throws SAXException { TNT4JSimulator.trace(simCurrTime, "Started event ..."); String name = expandEnvVars(attributes.getValue(SIM_XML_ATTR_NAME)); if (StringUtils.isEmpty(name)) throw new SAXParseException("<" + SIM_XML_EVENT + ">: '" + SIM_XML_ATTR_NAME + "' must be specified", saxLocator);/*from w ww . java2 s .co m*/ if (simCurrTime == null) simCurrTime = new UsecTimestamp(); OpType type = OpType.EVENT; OpLevel severity = OpLevel.INFO; String valStr; valStr = expandEnvVars(attributes.getValue(SIM_XML_ATTR_TYPE)); if (!StringUtils.isEmpty(valStr)) type = OpType.valueOf(valStr); valStr = expandEnvVars(attributes.getValue(SIM_XML_ATTR_SEVERITY)); if (!StringUtils.isEmpty(valStr)) severity = getLevel(valStr); int srcId = 0; OpCompCode cc = null; int rc = 0; long pid = 0L; long tid = 0L; String exc = null; String loc = null; String res = null; String user = null; String msgtext = null; String[] corrs = null; String[] labels = null; long elapsed = 0L; long msgAge = 0L; Integer msgId = 0; try { for (int i = 0; i < attributes.getLength(); i++) { String attName = attributes.getQName(i); String attValue = expandEnvVars(attributes.getValue(i)); if (attName.equals(SIM_XML_ATTR_NAME)) { // handled above } else if (attName.equals(SIM_XML_ATTR_TYPE)) { // handled above } else if (attName.equals(SIM_XML_ATTR_SEVERITY)) { // handled above } else if (attName.equals(SIM_XML_ATTR_SOURCE)) { srcId = Integer.parseInt(attValue); if (srcId <= 0) throw new SAXParseException( "Invalid <" + SIM_XML_EVENT + "> attribute '" + attName + "', must be > 0", saxLocator); } else if (attName.equals(SIM_XML_ATTR_CC)) { cc = OpCompCode.valueOf(attValue); } else if (attName.equals(SIM_XML_ATTR_RC)) { rc = Integer.parseInt(attValue); } else if (attName.equals(SIM_XML_ATTR_PID)) { pid = Long.parseLong(attValue); if (pid <= 0L) throw new SAXParseException( "Invalid <" + SIM_XML_EVENT + "> attribute '" + attName + "', must be > 0", saxLocator); } else if (attName.equals(SIM_XML_ATTR_TID)) { tid = Long.parseLong(attValue); if (tid <= 0L) throw new SAXParseException( "Invalid <" + SIM_XML_EVENT + "> attribute '" + attName + "', must be > 0", saxLocator); } else if (attName.equals(SIM_XML_ATTR_EXC)) { exc = attValue; } else if (attName.equals(SIM_XML_ATTR_LOC)) { loc = attValue; } else if (attName.equals(SIM_XML_ATTR_RES)) { res = attValue; } else if (attName.equals(SIM_XML_ATTR_USER)) { user = attValue; } else if (attName.equals(SIM_XML_ATTR_ELAPSED)) { elapsed = Long.parseLong(attValue); if (elapsed < 0L) throw new SAXParseException( "<" + SIM_XML_EVENT + ">: '" + SIM_XML_ATTR_ELAPSED + "' must be >= 0", saxLocator); } else if (attName.equals(SIM_XML_ATTR_MSGAGE)) { msgAge = Long.parseLong(attValue); if (msgAge < 0L) throw new SAXParseException( "Invalid <" + SIM_XML_EVENT + "> attribute '" + attName + "', must be >= 0", saxLocator); } else if (attName.equals(SIM_XML_ATTR_TAGS)) { labels = attValue.split(","); for (int l = 0; l < labels.length; l++) { if (TNT4JSimulator.isGenerateValues()) labels[l] = generateValues(labels[l]); if (!Utils.isEmpty(tagSuffix)) { labels[l] += tagSuffix; } } } else if (attName.equals(SIM_XML_ATTR_CORRS)) { corrs = attValue.split(","); for (int c = 0; c < corrs.length; c++) { if (TNT4JSimulator.isGenerateValues()) corrs[c] = generateValues(corrs[c]); if (!Utils.isEmpty(corSuffix)) { corrs[c] += corSuffix; } } } else if (attName.equals(SIM_XML_ATTR_MSG)) { msgId = Integer.parseInt(attValue); } else if (attName.equals(SIM_XML_ATTR_MSG_TEXT)) { msgtext = attValue; } else { throw new SAXParseException("Unknown <" + SIM_XML_EVENT + "> attribute '" + attName + "'", saxLocator); } } if (srcId <= 0 && curActivity == null) { throw new SAXParseException("<" + SIM_XML_EVENT + "> attribute '" + SIM_XML_ATTR_SOURCE + "' is missing for event without parent activity", saxLocator); } if ((msgId != null) && (msgtext != null)) { throw new SAXParseException("<" + SIM_XML_EVENT + "> has both attributes '" + SIM_XML_ATTR_MSG + "' and '" + SIM_XML_ATTR_MSG_TEXT + "'", saxLocator); } curEvent = curTracker.newEvent(severity, type, name, (String) null, (String) null, (String) null, (Object[]) null); Source source = (curEvent != null ? curEvent.getSource() : null); if (source == null) source = (curActivity != null ? curActivity.getSource() : null); if (srcId > 0) { source = sourceIds.get(srcId); if (source == null) throw new SAXParseException( "<" + SIM_XML_EVENT + ">: " + SIM_XML_ATTR_SOURCE + " '" + srcId + "' is not defined", saxLocator); curTracker = trackers.get(source.getFQName()); if (curTracker == null) throw new SAXParseException("<" + SIM_XML_ACTIVITY + ">: " + SIM_XML_ATTR_SOURCE + " '" + srcId + "' is not defined", saxLocator); } if (source == null || curTracker == null) { throw new SAXParseException("<" + SIM_XML_EVENT + "> attribute '" + SIM_XML_ATTR_SOURCE + "' is missing for event without parent activity", saxLocator); } if (curActivity != null) { curEvent.setLocation(curActivity.getLocation()); curEvent.getOperation().setPID(curActivity.getPID()); curEvent.getOperation().setTID(curActivity.getTID()); curEvent.getOperation().setResource(curActivity.getResource()); curEvent.getOperation().setUser(curActivity.getUser()); } curEvent.setTTL(TNT4JSimulator.getTTL()); curEvent.getOperation().setSeverity(severity == null ? OpLevel.INFO : severity); curEvent.getOperation().setCompCode(cc == null ? OpCompCode.SUCCESS : cc); if (srcId > 0) curEvent.setSource(source); if (!StringUtils.isEmpty(user)) curEvent.getOperation().setUser(user); else if (curActivity == null) curEvent.getOperation().setUser(source.getUser()); if (pid > 0L) curEvent.getOperation().setPID(pid); if (tid > 0L) curEvent.getOperation().setTID(tid); if (!StringUtils.isEmpty(name)) curEvent.getOperation().setName(name); if (!StringUtils.isEmpty(loc)) curEvent.setLocation(loc); if (!StringUtils.isEmpty(res)) curEvent.getOperation().setResource(res); if (rc != 0) curEvent.getOperation().setReasonCode(rc); if (!StringUtils.isEmpty(exc)) curEvent.getOperation().setException(exc); if (!ArrayUtils.isEmpty(corrs)) curEvent.setCorrelator(corrs); if (!ArrayUtils.isEmpty(labels)) curEvent.setTag(labels); if (msgAge > 0L) curEvent.setMessageAge((long) TNT4JSimulator.varyValue(msgAge)); elapsed = TNT4JSimulator.varyValue(elapsed); if (msgId != null && msgId > 0) { Message eventMsg = messageIds.get(msgId.intValue()); if (eventMsg == null) { throw new SAXParseException( "Undefined " + SIM_XML_ATTR_MSG + " '" + msgId + "' for <" + SIM_XML_EVENT + ">", saxLocator); } curEvent.setTrackingId(eventMsg.getTrackingId()); curEvent.setMessage(expandEnvVars(eventMsg.getMessage())); } else if (msgtext != null) { curEvent.setMessage(expandEnvVars(msgtext)); } curEvent.start(simCurrTime); simCurrTime.add(0, elapsed); curEvent.stop(simCurrTime, elapsed); TNT4JSimulator.debug(simCurrTime, "Ran event: " + name + ", elapsed.usec=" + elapsed); } catch (Exception e) { if (e instanceof SAXException) throw (SAXException) e; throw new SAXException("Failed processing event '" + name + "': " + e, e); } }
From source file:com.netspective.commons.xml.AbstractContentHandler.java
protected boolean defaultHandleTemplateStartElement(String url, String localName, String qName, Attributes attributes) throws SAXException { String elementName = qName.toLowerCase(); if (!templateDefnStack.isEmpty()) { // we're inside a template already so just grab the contents TemplateElement activeTemplate = (TemplateElement) templateDefnStack.peek(); if (nodeIdentifiers.getTemplateParamDecl().equals(elementName)) { if (activeTemplate instanceof Template) { ((Template) activeTemplate).declareParameter(this, url, localName, qName, attributes); templateDefnStack.push(activeTemplate); } else throw new SAXParseException( "<" + nodeIdentifiers.getTemplateParamDecl() + "> not allowed here.", parseContext.getLocator()); } else {// www.java 2s. c om TemplateElement childNode = new TemplateElement(this, url, localName, qName, attributes); activeTemplate.addChild(childNode); templateDefnStack.push(childNode); } return true; } else if (elementName.equals(nodeIdentifiers.getTemplateElementName())) { String templateName = attributes.getValue(NodeIdentifiers.ATTRNAME_GENERIC_TEMPLATE_NAME); if (templateName == null || templateName.length() == 0) throw new SAXParseException("Template must have a '" + NodeIdentifiers.ATTRNAME_GENERIC_TEMPLATE_NAME + "' attribute in <" + elementName + "> ", parseContext.getLocator()); final Locator locator = getParseContext().getLocator(); InputSourceLocator inputSourceLocator = new InputSourceLocator(getParseContext().getInputSrcTracker(), locator.getLineNumber(), locator.getColumnNumber()); Template template = new Template(templateName, this, inputSourceLocator, parseContext.getTemplateCatalog(), nodeIdentifiers.getGenericTemplateProducer(), url, localName, qName, attributes); parseContext.getTemplateCatalog().registerTemplate(nodeIdentifiers.getGenericTemplateProducer(), templateName, template); templateDefnStack.push(template); return true; } else return false; }
From source file:ca.sqlpower.wabit.dao.WorkspaceSAXHandler.java
/** * This loads a font based on the given attributes. *///ww w. ja v a2 s.co m private Font loadFont(Attributes attributes) throws SAXException { String fontName = attributes.getValue("name"); String fontSize = attributes.getValue("size"); String fontStyle = attributes.getValue("style"); checkMandatory("name", fontName); checkMandatory("style", fontStyle); checkMandatory("size", fontSize); Font font = new Font(fontName, Integer.parseInt(fontStyle), Integer.parseInt(fontSize)); return font; }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgRspnHandler.CFCrmXMsgRspnTagReadSingleHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from w w w .j av a 2 s .co m*/ // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTagReadSingle"); CFCrmXMsgRspnHandler xmsgRspnHandler = (CFCrmXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmXMsgRspnHandler.CFCrmXMsgRspnDomainReadSingleHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {//from w w w . ja va2 s .c o m // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnDomainReadSingle"); CFCrmXMsgRspnHandler xmsgRspnHandler = (CFCrmXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); // Convert string attributes to native Java types } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmXMsgRspnHandler.CFCrmXMsgRspnTagDeletedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {// www . j a va 2 s. c om // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTagDeleted"); CFCrmXMsgRspnHandler xmsgRspnHandler = (CFCrmXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); // Convert string attributes to native Java types xmsgRspnHandler.setDeleted(true); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmXMsgRspnHandler.CFCrmXMsgRspnTldDeletedHandler.java
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { try {/*from ww w . j a va 2 s . c o m*/ // Common XML Attributes String attrId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RspnTldDeleted"); CFCrmXMsgRspnHandler xmsgRspnHandler = (CFCrmXMsgRspnHandler) getParser(); if (xmsgRspnHandler == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } ICFCrmSchemaObj schemaObj = xmsgRspnHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Extract Attributes numAttrs = attrs.getLength(); for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) { attrLocalName = attrs.getLocalName(idxAttr); if (attrLocalName.equals("Id")) { if (attrId != null) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, S_LocalName, attrLocalName); } attrId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("schemaLocation")) { // ignored } else { throw CFLib.getDefaultExceptionFactory().newUnrecognizedAttributeException(getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName); } } // Ensure that required attributes have values // Save named attributes to context CFLibXmlCoreContext curContext = getParser().getCurContext(); curContext.putNamedValue("Id", attrId); // Convert string attributes to native Java types xmsgRspnHandler.setDeleted(true); } catch (RuntimeException e) { throw new RuntimeException("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } catch (Error e) { throw new Error("Near " + getParser().getLocationInfo() + ": Caught and rethrew " + e.getClass().getName() + " - " + e.getMessage(), e); } }