List of usage examples for javax.xml.stream.events Attribute getValue
public String getValue();
From source file:com.streamsets.pipeline.lib.xml.StreamingXmlParser.java
Map<String, Field> toField(StartElement startE) { Map<String, Field> map = new LinkedHashMap<>(); Iterator attrs = startE.getAttributes(); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); map.put(getName(ATTR_PREFIX_KEY, attr), Field.create(attr.getValue())); }//from ww w . java 2s .c om Iterator nss = startE.getNamespaces(); while (nss.hasNext()) { Namespace ns = (Namespace) nss.next(); map.put(getName(NS_PREFIX_KEY, ns), Field.create(ns.getNamespaceURI())); } return map; }
From source file:com.joliciel.frenchTreebank.upload.TreebankXmlReader.java
public void startElement(StartElement startElementEvent) { String qName = startElementEvent.getName().getLocalPart(); @SuppressWarnings("rawtypes") Iterator iAttributes = startElementEvent.getAttributes(); Map<String, String> attributes = new HashMap<String, String>(); while (iAttributes.hasNext()) { Attribute attribute = (Attribute) iAttributes.next(); String name = attribute.getName().getLocalPart(); String value = attribute.getValue(); attributes.put(name, value);/*from w w w .j ava 2 s .c o m*/ } // clear out tempVal whenever a new element is started tempVal = ""; if (qName.equalsIgnoreCase("SENT")) { // a new sentence sentence = treebankService.newSentence(); String sentenceNumber = attributes.get("nb"); if (LOG.isDebugEnabled()) LOG.debug("Sentence number " + sentenceNumber); sentence.setSentenceNumber(sentenceNumber); sentence.setFile(treebankFile); } else if (qName.equalsIgnoreCase("w")) { // a new word or compound word if (phraseUnit == null) { String categoryCode = attributes.get("cat"); String subCategoryCode = attributes.get("subcat"); String morphologyCode = attributes.get("mph"); String lemma = attributes.get("lemma"); boolean isCompound = false; String isCompoundStr = attributes.get("compound"); if (isCompoundStr != null && isCompoundStr.equalsIgnoreCase("yes")) isCompound = true; String compoundId = attributes.get("id"); String compoundNextId = attributes.get("next"); String compoundPrevId = attributes.get("prev"); //String isCompound = attributes.getValue("compound"); // ignoring compound attribute as not reliable - instead relying on embedded words to indicate a compound phrase unit if (LOG.isTraceEnabled()) LOG.trace("Opening w " + lemma); phraseUnit = sentence.newPhraseUnit(categoryCode, subCategoryCode, morphologyCode, lemma, isCompound, compoundId, compoundNextId, compoundPrevId); String word = attributes.get("word"); if (word != null) { phraseUnit.setText(word); } } else { isPhraseUnitCompound = true; String categoryCode = attributes.get("catint"); String subCategoryCode = attributes.get("subcat"); String morphologyCode = attributes.get("mph"); if (LOG.isTraceEnabled()) LOG.trace("Opening subunit " + categoryCode); phraseSubunit = phraseUnit.newSubunit(categoryCode, subCategoryCode, morphologyCode); } } else if (qName.equalsIgnoreCase("sentence")) { // ignore for now, will only be treated in end element } else if (qName.equalsIgnoreCase("text")) { // top level text tag, we don't need to do nothing } else { // must be a phrase if (sentence != null) { String functionCode = attributes.get("fct"); if (LOG.isTraceEnabled()) LOG.trace("Opening phrase " + qName + ", " + functionCode); sentence.openPhrase(qName, functionCode); } } }
From source file:com.streamsets.pipeline.lib.xml.StreamingXmlParser.java
@SuppressWarnings("unchecked") Field parse(XMLEventReader reader, StartElement startE) throws XMLStreamException, ObjectLengthException { Map<String, Field> map = this.useFieldAttributesInsteadOfFields ? new LinkedHashMap<>() : toField(startE); Map<String, Field> startEMap = map; Map<String, Object> contents = new LinkedHashMap<>(); boolean maybeText = true; while (hasNext(reader) && !peek(reader).isEndElement()) { XMLEvent next = read(reader); if (next.isCharacters()) { // If this set of characters is all whitespace, ignore. if (next.asCharacters().isWhiteSpace()) { continue; } else if (peek(reader).isEndElement() && maybeText) { contents.put(VALUE_KEY, Field.create(((Characters) next).getData())); } else if (peek(reader).isStartElement()) { StartElement subStartE = (StartElement) read(reader); Field subField = parse(reader, subStartE); addContent(contents, getName(subStartE), subField); if (hasNext(reader) && peek(reader).isCharacters()) { read(reader);/*from ww w . j a va2 s . c o m*/ } } else if (maybeText) { throw new XMLStreamException(Utils .format("Unexpected XMLEvent '{}', it should be START_ELEMENT or END_ELEMENT", next), next.getLocation()); } } else if (next.isStartElement()) { String name = getName((StartElement) next); Field field = parse(reader, (StartElement) next); addContent(contents, name, field); } else { throw new XMLStreamException( Utils.format("Unexpected XMLEvent '{}', it should be START_ELEMENT or CHARACTERS", next), next.getLocation()); } maybeText = false; } if (hasNext(reader)) { EndElement endE = (EndElement) read(reader); if (!endE.getName().equals(startE.getName())) { throw new XMLStreamException(Utils.format("Unexpected EndElement '{}', it should be '{}'", endE.getName().getLocalPart(), startE.getName().getLocalPart()), endE.getLocation()); } for (Map.Entry<String, Object> entry : contents.entrySet()) { if (entry.getValue() instanceof Field) { startEMap.put(entry.getKey(), (Field) entry.getValue()); } else { startEMap.put(entry.getKey(), Field.create((List<Field>) entry.getValue())); } } } final Field field = Field.create(startEMap); if (this.useFieldAttributesInsteadOfFields) { Iterator attrs = startE.getAttributes(); while (attrs.hasNext()) { Attribute attr = (Attribute) attrs.next(); field.setAttribute(getName(XMLATTR_ATTRIBUTE_PREFIX, attr), attr.getValue()); } Iterator nss = startE.getNamespaces(); while (nss.hasNext()) { Namespace ns = (Namespace) nss.next(); field.setAttribute(getName(null, ns), ns.getNamespaceURI()); } } lastParsedFieldXpathPrefix = getXpathPrefix(); return field; }
From source file:com.prowidesoftware.swift.model.mx.XmlEventWriter.java
public void add(final XMLEvent event) throws XMLStreamException { if (event != null) { log.finest("XmlEventType: " + event.getEventType()); try {// www. ja va 2 s. c o m final int type = event.getEventType(); switch (type) { case XMLEvent.START_DOCUMENT: if (this.includeXMLDeclaration) { log.finer(">> START_DOCUMENT"); log.finer("START_DOCUMENT XMLEvent " + ToStringBuilder.reflectionToString(event)); final String str = "<?xml version=\"1.0\" encoding=\"" + ((StartDocument) event).getCharacterEncodingScheme() + "\"?>"; out.write(str); logStep(str); } else { log.finer("skipping xml declaration"); } break; case XMLEvent.START_ELEMENT: this.startElementCount++; closeStartTagIfNeeded(); log.finer(">> START_ELEMENT"); indent.append(' '); final StartElement se = event.asStartElement(); @SuppressWarnings("rawtypes") final Iterator it = se.getNamespaces(); while (it.hasNext()) { log.fine("ns: " + it.next()); } /*--------------------------------------------------------------------------------------- * 2015.03 miguel * Cuidado con esta condicion! esto generaba el bug de que no abria el Document anidado dentro del xs:any * Esto es porque este document delayed solo se completa cuando recibe un namespace, pensado como elemento inicial * esto DEEEEBEEEEEEEEEEe corregirse cuando se cambie la serializacion, si se cambia * porque si el document queda dentro de un elemento payload, entonces en count es != 1 y debe revisarse como se identifica el primer * document y un document anidado. * */ if (StringUtils.equals(se.getName().getLocalPart(), this.rootElement) && this.startElementCount == 1) { // 2015.03 miguel: ESTE era el bug de esprow, que aparecian tags anidados de document cerrando que no abria, era porque entraban por aca sin esta condicion de depth count delayedStart = se; log.finer("local part is Document, initializing delayed start, startElementCount=" + this.startElementCount); } else { final String s = "\n" + indent + "<" + prefix() + se.getName().getLocalPart() /* + ">" */; out.write(s); logStep(s); /* 2014.11 miguel * para soportar atributos en lugar de cerrar aca seteamos un flag para indicar * que hace falta cerrar el startTag */ startTagIncomplete = true; if (se.isNamespace()) { log.fine("is ns in start XMLEvent " + ToStringBuilder.reflectionToString(event)); } } break; case XMLEvent.NAMESPACE: log.finer(">> NAMESPACE"); final Namespace ne = (Namespace) event; if (delayedStart != null) { final String s = "\n" + indent + "<" + prefix() + delayedStart.getName().getLocalPart() + " " + "xmlns" + (this.prefix != null ? ":" + this.prefix : "") + "=\"" + ne.getValue() + "\" xmlns:xsi=\"" + ne.getName() + "\"" + ">"; out.write(s); logStep(s); delayedStart = null; } else { log.fine("NAMESPACE XMLEvent " + ToStringBuilder.reflectionToString(event)); } break; case XMLEvent.CHARACTERS: log.finer(">> CHARACTERS"); closeStartTagIfNeeded(); final Characters ce = event.asCharacters(); final char[] arr = ce.getData().toCharArray(); out.write(escape(arr)); logStep(ce.getData()); break; case XMLEvent.END_ELEMENT: log.finer(">> END_ELEMENT"); closeStartTagIfNeeded(); indent.deleteCharAt(0); final EndElement ee = event.asEndElement(); final String str2 = "</" + prefix() + ee.getName().getLocalPart() + ">\n" + indent; out.write(str2); logStep(str2); break; case XMLEvent.END_DOCUMENT: log.finer(">> END_DOCUMENT"); closeStartTagIfNeeded(); /* 2014.10 miguel * No need to do anything while writing to a string */ log.finer("END_DOCUMENT XMLEvent " + ToStringBuilder.reflectionToString(event)); break; case XMLEvent.ATTRIBUTE: log.finer(">> ATTRIBUTE"); final Attribute a = (Attribute) event; final String str3 = " " + a.getName() + "=\"" + a.getValue() + "\" "; out.write(str3); log.fine(ToStringBuilder.reflectionToString(a)); logStep(str3); break; default: log.info("getEventType " + event.getEventType()); log.info("PW Unhandled XMLEvent " + ToStringBuilder.reflectionToString(event)); break; } } catch (IOException e) { log.log(Level.SEVERE, "PW I/O error: " + e); log.log(Level.FINER, "PW I/O error: ", e); throw new XMLStreamException(e); } } }
From source file:eu.delving.sip.xml.SourceConverter.java
private void handleAttribute(Path path, Attribute attr) { Path extended = path.child(Tag.attribute(attr.getName())); if (extended.equals(uniqueElementPath)) { unique = attr.getValue(); } else if (path.equals(recordRootPath)) { QName a = attr.getName(); QName attrName = new QName(a.getNamespaceURI(), "_" + a.getLocalPart(), a.getPrefix()); eventBuffer.add(eventFactory.createStartElement(attrName, null, null)); eventBuffer.add(eventFactory.createCharacters(attr.getValue())); eventBuffer.add(eventFactory.createEndElement(attrName, null)); eventBuffer.add(eventFactory.createCharacters("\n")); }// w w w . j a va2 s .c o m }
From source file:com.adobe.acs.commons.it.build.ScrMetadataIT.java
private Descriptor parseScr(InputStream is, String name, boolean checkNs) throws Exception { Descriptor result = new Descriptor(); XMLEventReader reader = xmlInputFactory.createXMLEventReader(is); while (reader.hasNext()) { XMLEvent event = reader.nextEvent(); if (event.isStartElement()) { StartElement start = event.asStartElement(); String elementName = start.getName().getLocalPart(); if (elementName.equals("component")) { result.name = start.getAttributeByName(new QName("name")).getValue(); if (checkNs) { String scrUri = start.getName().getNamespaceURI(); if (!ALLOWED_SCR_NS_URIS.contains(scrUri)) { throw new Exception( String.format("Banned Namespace URI %s found for %s", scrUri, name)); }/*w ww . j a v a2 s.c o m*/ } } else if (elementName.equals("property")) { String propName = start.getAttributeByName(new QName("name")).getValue(); Attribute value = start.getAttributeByName(new QName("value")); Attribute typeAttr = start.getAttributeByName(new QName("type")); String type = typeAttr == null ? "String" : typeAttr.getValue(); if (value != null) { result.properties.add(new Property(propName, value.getValue(), type)); } else { result.properties.add(new Property(propName, cleanText(reader.getElementText()), type)); } } } } return result; }
From source file:com.adobe.acs.commons.it.build.ScrMetadataIT.java
private Descriptor parseMetatype(InputStream is, String name) throws Exception { Descriptor result = new Descriptor(); XMLEventReader reader = xmlInputFactory.createXMLEventReader(is); while (reader.hasNext()) { XMLEvent event = reader.nextEvent(); if (event.isStartElement()) { StartElement start = event.asStartElement(); String elementName = start.getName().getLocalPart(); if (elementName.equals("Designate")) { Attribute pidAttribute = start.getAttributeByName(new QName("pid")); if (pidAttribute != null) { result.name = pidAttribute.getValue(); } else { pidAttribute = start.getAttributeByName(new QName("factoryPid")); if (pidAttribute != null) { result.name = pidAttribute.getValue(); }// w w w .j a va2 s . c o m result.factory = true; } } else if (elementName.equals("AD")) { String propName = start.getAttributeByName(new QName("id")).getValue(); Attribute value = start.getAttributeByName(new QName("default")); Attribute typeAttr = start.getAttributeByName(new QName("type")); String type = typeAttr == null ? "String" : typeAttr.getValue(); if (value == null) { result.properties.add(new Property(propName, "", type)); } else { result.properties.add(new Property(propName, value.getValue(), type)); } } } } if (result.name == null) { throw new Exception("Could not identify pid for " + name); } return result; }
From source file:edu.monash.merc.system.parser.xml.GPMWSXmlParser.java
public List<GPMEntryBean> parseGPMXml(String fileName, XMLInputFactory2 factory2) { xmlif2 = factory2;/*from w w w. ja va2s . c o m*/ logger.info("Starting to parse " + fileName); XMLEventReader2 xmlEventReader = null; List<GPMEntryBean> gpmEntryBeans = new ArrayList<GPMEntryBean>(); try { xmlEventReader = (XMLEventReader2) xmlif2.createXMLEventReader(new FileInputStream(fileName)); QName proteinQN = new QName(ELE_GPM_PROTEIN); QName enspQN = new QName(ATTR_GPM_ENSP); QName ensgQN = new QName(ATTR_GPM_ENSG); QName identiQN = new QName(ELE_GPM_IDENTIFICATION); QName besteQN = new QName(ATTR_GPM_IDEN_BESTE); QName samplesQN = new QName(ATTR_GPM_IDEN_SAMPLES); String ensg = null; String ensp = null; String beste = null; String samples = null; GPMEntryBean gpmEntryBean = null; while (xmlEventReader.hasNextEvent()) { //eventType = reader.next(); XMLEvent event = xmlEventReader.nextEvent(); if (event.isStartElement()) { StartElement element = event.asStartElement(); //protein entry if (element.getName().equals(proteinQN)) { //get the version attribute Attribute enspAttr = element.getAttributeByName(enspQN); Attribute ensgAttr = element.getAttributeByName(ensgQN); if (enspAttr != null) { ensp = enspAttr.getValue(); } if (ensgAttr != null) { ensg = ensgAttr.getValue(); } //create gpn entry bean gpmEntryBean = new GPMEntryBean(); //create gpm dbsource DBSourceBean gpmDbSourceBean = new DBSourceBean(); gpmDbSourceBean.setDbName(DbAcType.GPM.type()); gpmDbSourceBean.setPrimaryEvidences(true); //set the gpm dbsource gpmEntryBean.setPrimaryDbSourceBean(gpmDbSourceBean); //create a gene bean if (StringUtils.isNotBlank(ensg)) { GeneBean geneBean = new GeneBean(); geneBean.setEnsgAccession(ensg); gpmEntryBean.setGeneBean(geneBean); } //create an identified accession bean AccessionBean identAccessionBean = parseIdentifiedAccessionBean(ensp); gpmEntryBean.setIdentifiedAccessionBean(identAccessionBean); //create dbsource and accession entry bean List<DbSourceAcEntryBean> dbSourceAcEntryBeanList = parseDBSourceAcEntryBeans(ensp, ensg); gpmEntryBean.setDbSourceAcEntryBeans(dbSourceAcEntryBeanList); } //protein entry if (element.getName().equals(identiQN)) { Attribute besteAttr = element.getAttributeByName(besteQN); Attribute samplesAttr = element.getAttributeByName(samplesQN); if (besteAttr != null) { beste = besteAttr.getValue(); } if (samplesAttr != null) { samples = samplesAttr.getValue(); } //create pe ms prob evidence based on beste and ensp accesion PEEvidenceBean peMsProbEvidence = createMsProbEvidence(beste, ensp); //parse pe ms samples evidence PEEvidenceBean peMsSamplesEvidence = createMsSamplesEvidence(samples, ensp); if (peMsProbEvidence != null) { gpmEntryBean.setPeMsProbEvidenceBean(peMsProbEvidence); } if (peMsSamplesEvidence != null) { gpmEntryBean.setPeMsSamplesEvidenceBean(peMsSamplesEvidence); } } } //End of element if (event.isEndElement()) { EndElement endElement = event.asEndElement(); //hpa entry end if (endElement.getName().equals(proteinQN)) { //if gene is not null, the accession is not null and get some evidences for this gpm entry, then we add it to the list GeneBean geneBean = gpmEntryBean.getGeneBean(); AccessionBean identifiedAcBean = gpmEntryBean.getIdentifiedAccessionBean(); PEEvidenceBean peMsProbEvidence = gpmEntryBean.getPeMsProbEvidenceBean(); PEEvidenceBean peMsSampEvidence = gpmEntryBean.getPeMsProbEvidenceBean(); if (geneBean != null && identifiedAcBean != null) { if (peMsProbEvidence != null || peMsSampEvidence != null) { gpmEntryBeans.add(gpmEntryBean); } } } } } return gpmEntryBeans; } catch (Exception ex) { logger.error(ex); throw new DMXMLParserException(ex); } finally { if (xmlEventReader != null) { try { xmlEventReader.close(); } catch (Exception e) { //ignore whatever caught. } } } }
From source file:sapience.injectors.stax.inject.ModelBasedStaxStreamInjector.java
/** * If the reference is a attribute (e.g. sawsdl:modelreference), we add it here (by creating * the according XMLEvent). The ref//from w w w . ja v a2s .co m * @param w * @param ref * @param se * @throws XMLStreamException */ private StartElement handleAttribute(XMLEventWriter w, Reference ref, StartElement se) throws XMLStreamException { /* we are having attributes which are in both, the reference and the current element. We only add * a new Attribute event, if it is not already contained in the Start Element * * Example: * reference <element ns:attr1="value" reference="http://example.com"> * element <element ns:attr1="value"> */ StringBuilder referenceString = new StringBuilder(ref.getTarget().toString()); Matcher matcher = findAttributeInReference.matcher(referenceString); List<Attribute> attributeList = new ArrayList<Attribute>(); // copy namespaces LocalNamespaceContext lnc = new LocalNamespaceContext((BaseNsContext) se.getNamespaceContext()); while (matcher.find()) { int start = matcher.start(); int end = matcher.end(); String key = null; String prefix = null; String value = null; // [ns:attr1, "value"] String[] l = referenceString.substring(start, end).split("="); if (l.length > 0) { // [ns, attr1] String[] n = l[0].split(":"); if (n.length == 2) { key = n[1]; prefix = n[0]; } else { key = n[0]; } if (l.length == 2) { value = l[1].substring(1, l[1].length() - 1); // remove "" } } // check if this is a namespace definition if ((prefix != null) && ("xmlns".contentEquals(prefix))) { lnc.put(key, value); } else { QName name = null; // create QName if (prefix != null) { name = new QName(null, key, prefix); } else { String namespaceURI = se.getNamespaceContext().getNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX); name = new QName(namespaceURI, key); } if (name != null) { Attribute created = getXMLEventFactory().createAttribute(name, value); attributeList.add(created); } } } // remove redundant attribute from reference list Iterator<?> it = se.getAttributes(); while (it.hasNext()) { Attribute ae = (Attribute) it.next(); for (Attribute ar : attributeList) { if ((ar.getName().getLocalPart().contentEquals(ae.getName().getLocalPart())) && (ar.getValue().contentEquals(ae.getValue()))) { //System.out.println("Attribute removed! -> " + ar.getName() + "= " + ar.getValue()); attributeList.remove(ar); break; } } } // merge everything again Iterator<? extends Attribute> it2 = se.getAttributes(); while (it2.hasNext()) { attributeList.add(it2.next()); } // create a new element with the attribute set and return it return StartElementEventImpl.construct(se.getLocation(), se.getName(), attributeList.iterator(), lnc.getNamespaces().iterator(), lnc); }
From source file:com.google.code.activetemplates.impl.TemplateCompilerImpl.java
private void doCompile(String name, CompileContext cc) throws XMLStreamException { while (cc.hasNextEvent()) { XMLEvent e = cc.nextEvent(); //Location loc = e.getLocation(); if (e.isAttribute()) { //System.out.println("Adding " + e); // attributes added during tag processing and under the same tag // get handled here, outcome is always PROCESS_ALL Attribute a = (Attribute) e; if (h.isAttributeHandled(a.getName())) { h.processAttribute(cc, a); } else { String value = a.getValue(); String nvalue = processText(cc, value); if (nvalue != null) { a = cc.getElementFactory().createAttribute(a.getName(), nvalue); }/*from w w w . j ava 2s . c om*/ //System.out.println("Adding " + e); cc.getWriter().add(a); } } else if (e.isStartElement()) { StartElement se = e.asStartElement(); Processing processing = Processing.DEFAULT; // collect namespaces @SuppressWarnings("unchecked") Iterator<Namespace> nsit = se.getNamespaces(); List<Namespace> namespaces = new ArrayList<Namespace>(); while (nsit.hasNext()) { Namespace ns = nsit.next(); if (excludedNamespaces.contains(ns.getNamespaceURI())) { processing = Processing.REPLACE; } else { namespaces.add(ns); } } // collect attributes @SuppressWarnings("unchecked") Iterator<Attribute> it = se.getAttributes(); List<Attribute> attributes = new LinkedList<Attribute>(); while (it.hasNext()) { attributes.add(it.next()); } // collect any separate attribute and namespace xml events while (cc.hasNextEvent()) { if (cc.peekEvent().isNamespace()) { namespaces.add((Namespace) cc.nextEvent()); processing = Processing.REPLACE; } else if (cc.peekEvent().isAttribute()) { attributes.add((Attribute) cc.nextEvent()); processing = Processing.REPLACE; } else { break; } } // preprocess attributes it = attributes.iterator(); attributes = new ArrayList<Attribute>(); while (it.hasNext() && processing != Processing.SKIP) { Attribute a = it.next(); if (h.isAttributeHandled(a.getName())) { processing = Processing.REPLACE; AttributeHandler.Outcome o = h.processAttribute(cc, a); if (o == Outcome.PROCESS_NONE) { processing = Processing.SKIP; } } else { String value = a.getValue(); String nvalue = processText(cc, value); if (nvalue != null) { a = cc.getElementFactory().createAttribute(a.getName(), nvalue); processing = Processing.REPLACE; } attributes.add(a); } } if (processing == Processing.SKIP) { skipChildren(cc, false); } else { if (processing == Processing.REPLACE) { // replace element with new one se = cc.getElementFactory().createStartElement(se.getName(), attributes.iterator(), namespaces.iterator()); } // handle start element if (h.isElementHandled(se.getName())) { ElementHandler.Outcome o = h.processStartElement(cc, se); cc.flushEventQueue(); switch (o) { case PROCESS_SIBLINGS: skipChildren(cc, true); break; } } else { //System.out.println("Adding " + se); cc.getWriter().add(se); cc.flushEventQueue(); // flush events added by any attribute handlers } } } else if (e.isEndElement()) { // handle end element if (h.isElementHandled(e.asEndElement().getName())) { h.processEndElement(cc, e.asEndElement()); cc.flushEventQueue(); } else { //System.out.println("Adding " + e); cc.getWriter().add(e); } } else if (e.isCharacters()) { // process text Characters ce = e.asCharacters(); String s = ce.getData(); String ns = processText(cc, s); if (ns != null) { ce = cc.getElementFactory().createCharacters(ns); } //System.out.println("Adding " + e); cc.getWriter().add(ce); } } }