Java Code Examples for org.xml.sax.Attributes
The following code examples are extracted from open source projects. You can click to
vote up the examples that are useful to you.
Example 1
From project des, under directory /daemon/lib/apache-log4j-1.2.16/src/main/java/org/apache/log4j/or/sax/.
Source file: AttributesRenderer.java

/** * Render a {@link org.xml.sax.Attributes}. */ public String doRender(Object o){ if (o instanceof Attributes) { StringBuffer sbuf=new StringBuffer(); Attributes a=(Attributes)o; int len=a.getLength(); boolean first=true; for (int i=0; i < len; i++) { if (first) { first=false; } else { sbuf.append(", "); } sbuf.append(a.getQName(i)); sbuf.append('='); sbuf.append(a.getValue(i)); } return sbuf.toString(); } else { try { return o.toString(); } catch ( Exception ex) { return ex.toString(); } } }
Example 2
From project accounted4, under directory /accounted4/stock-quote/stock-quote-tmx/src/main/java/com/accounted4/stockquote/tmx/.
Source file: TmxOptionPageHandler.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { if (!underlyingCommodoityPriceFieldToCollect.isEmpty() && qName.equalsIgnoreCase("STRONG")) { collectUnderlyingCommodityPrice=true; return; } if (null == optionType) { return; } if (qName.equalsIgnoreCase("TR") && null != attributes.getValue("title")) { String title=attributes.getValue("title"); optionBuilder=new String[6]; optionBuilder[0]=title; optionRowProcessing=true; optionColumnIndex=-1; return; } if (optionRowProcessing && qName.equalsIgnoreCase("TD")) { optionColumnIndex++; optionColumnProcessing=true; return; } }
Example 3
From project adg-android, under directory /src/com/analysedesgeeks/android/rss/.
Source file: RssHandler.java

@Override public void startElement(final String uri,final String localName,final String name,final Attributes attributes) throws SAXException { super.startElement(uri,localName,name,attributes); if (localName.equalsIgnoreCase(ITEM)) { this.currentFeedItem=new FeedItem(); } }
Example 4
From project Aion-Extreme, under directory /AE-go_GameServer/src/com/aionemu/gameserver/configs/.
Source file: IPConfig.java

/** * Method that loads IPConfig */ static void load(){ try { SAXParser parser=SAXParserFactory.newInstance().newSAXParser(); parser.parse(new File(CONFIG_FILE),new DefaultHandler(){ @Override public void startElement( String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equals("ipconfig")) { defaultAddress=IPRange.toByteArray(attributes.getValue("default")); } else if (qName.equals("iprange")) { String min=attributes.getValue("min"); String max=attributes.getValue("max"); String address=attributes.getValue("address"); IPRange ipRange=new IPRange(min,max,address); ranges.add(ipRange); } } } ); } catch ( Exception e) { log.fatal("Critical error while parsing ipConfig",e); throw new Error("Can't load ipConfig",e); } }
Example 5
From project Airports, under directory /src/com/nadmm/airports/wx/.
Source file: AirSigmetParser.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { String attr; if (qName.equalsIgnoreCase("AIRSIGMET")) { entry=new AirSigmetEntry(); } else if (qName.equalsIgnoreCase("altitude")) { attr=attributes.getValue("min_ft_msl"); if (attr != null) { entry.minAltitudeFeet=Integer.valueOf(attr); } attr=attributes.getValue("max_ft_msl"); if (attr != null) { entry.maxAltitudeFeet=Integer.valueOf(attr); } } else if (qName.equalsIgnoreCase("hazard")) { entry.hazardType=attributes.getValue("type"); entry.hazardSeverity=attributes.getValue("severity"); } else if (qName.equalsIgnoreCase("area")) { entry.points=new ArrayList<AirSigmetPoint>(); } else if (qName.equalsIgnoreCase("point")) { point=new AirSigmetPoint(); } else { text.setLength(0); } }
Example 6
From project and-bible, under directory /AndBackendTest/src/net/bible/service/format/.
Source file: HandleScripRef.java

/** * TSK is Thml format and contains scripRef tags but must be converted to OSIS reference tags */ public void testJSwordThmlProcessing() throws Exception { Book book=Books.installed().getBook("TSK"); Key key=book.getKey("Matt 21:21"); BookData data=new BookData(book,key); SAXEventProvider osissep=data.getSAXEventProvider(); final StringBuilder tags=new StringBuilder(); ContentHandler saxHandler=new DefaultHandler(){ @Override public void startElement( String uri, String localName, String qName, Attributes attributes) throws SAXException { tags.append("<" + qName + ">"); } } ; osissep.provideSAXEvents(saxHandler); String html=tags.toString(); System.out.println(html); assertTrue("Thml not converted to OSIS",html.contains("reference") && !html.contains("scripRef")); }
Example 7
From project Android-Flashcards, under directory /src/com/secretsockssoftware/androidflashcards/.
Source file: FCParser.java

public void startElement(String uri,String name,String qName,Attributes atts){ String qn=null; if (qName.equals("")) qn=name.toLowerCase(); else qn=qName.toLowerCase(); if (qn.equals("card")) { if (inCard) Log.e(AndroidFlashcards.TAG,"Got card element inside a card"); else inCard=true; } else if (qn.equals("frontside")) { if (!inCard) { Log.e(AndroidFlashcards.TAG,"Got frontside element NOT inside a card"); return; } if (inFront) Log.e(AndroidFlashcards.TAG,"Got frontside element inside a frontside"); else inFront=true; } else if (qn.equals("backside") || qn.equals("reverseside")) { if (!inCard) { Log.e(AndroidFlashcards.TAG,"Got backside element NOT inside a card"); return; } if (inBack) Log.e(AndroidFlashcards.TAG,"Got backside element inside a backside"); else inBack=true; } else if (qn.equals("name")) { if (inCard || inFront || inBack) { Log.e(AndroidFlashcards.TAG,"Got a name inside a card somewhere"); return; } inName=true; } else if (qn.equals("description")) { if (inCard || inFront || inBack) { Log.e(AndroidFlashcards.TAG,"Got a description inside a card somewhere"); return; } inDesc=true; dbuf.setLength(0); } }
Example 8
From project android-rackspacecloud, under directory /src/com/rackspace/cloud/files/api/client/parsers/.
Source file: ContainerObjectXMLparser.java

public void startElement(String uri,String name,String qName,Attributes atts){ currentData=new StringBuffer(); if ("container".equals(name)) { files=new ArrayList<ContainerObjects>(); } else if ("object".equals(name)) { object=new ContainerObjects(); } }
Example 9
From project android-thaiime, under directory /makedict/src/com/android/inputmethod/latin/.
Source file: XmlDictInputOutput.java

@Override public void startElement(String uri,String localName,String qName,Attributes attrs){ if (WORD_TAG.equals(localName)) { mState=WORD; mWord=""; for (int attrIndex=0; attrIndex < attrs.getLength(); ++attrIndex) { final String attrName=attrs.getLocalName(attrIndex); if (FREQUENCY_ATTR.equals(attrName)) { mFreq=Integer.parseInt(attrs.getValue(attrIndex)); } } } else { mState=UNKNOWN; } }
Example 10
From project android_external_tagsoup, under directory /src/org/ccil/cowan/tagsoup/.
Source file: AttributesImpl.java

/** * Copy an entire Attributes object. <p>It may be more efficient to reuse an existing object rather than constantly allocating new ones.</p> * @param atts The attributes to copy. */ public void setAttributes(Attributes atts){ clear(); length=atts.getLength(); if (length > 0) { data=new String[length * 5]; for (int i=0; i < length; i++) { data[i * 5]=atts.getURI(i); data[i * 5 + 1]=atts.getLocalName(i); data[i * 5 + 2]=atts.getQName(i); data[i * 5 + 3]=atts.getType(i); data[i * 5 + 4]=atts.getValue(i); } } }
Example 11
From project android_packages_apps_Gallery3D, under directory /src/com/cooliris/picasa/.
Source file: GDataParser.java

public void startElement(String uri,String localName,String qName,Attributes attrs) throws SAXException { switch (mState) { case STATE_DOCUMENT: if (uri.equals(ATOM_NAMESPACE) && localName.equals(FEED_ELEMENT)) { mState=STATE_FEED; } else { throw new SAXException(); } break; case STATE_FEED: if (uri.equals(ATOM_NAMESPACE) && localName.equals(ENTRY_ELEMENT)) { mState=STATE_ENTRY; mEntry.clear(); } else { startProperty(uri,localName,attrs); } break; case STATE_ENTRY: startProperty(uri,localName,attrs); break; } }
Example 12
From project android_packages_inputmethods_LatinIME, under directory /tools/makedict/src/com/android/inputmethod/latin/.
Source file: XmlDictInputOutput.java

@Override public void startElement(String uri,String localName,String qName,Attributes attrs){ if (WORD_TAG.equals(localName)) { mState=WORD; mWord=""; for (int attrIndex=0; attrIndex < attrs.getLength(); ++attrIndex) { final String attrName=attrs.getLocalName(attrIndex); if (FREQUENCY_ATTR.equals(attrName)) { mFreq=Integer.parseInt(attrs.getValue(attrIndex)); } } } else { mState=UNKNOWN; } }
Example 13
From project Anki-Android, under directory /src/com/tomgibara/android/veecheck/.
Source file: VeecheckResult.java

@Override public void startElement(String uri,String localName,String qName,Attributes attrs) throws SAXException { if (skip) { return; } if (!uri.equals(XML_NAMESPACE)) { return; } if (recordNext) { if (!localName.equals(INTENT_TAG)) { return; } action=attrs.getValue("action"); data=attrs.getValue("data"); type=attrs.getValue("type"); extras=toMap(attrs.getValue("extras")); recordMatch(true); } else { if (!localName.equals(VERSION_TAG)) { return; } VeecheckVersion version=new VeecheckVersion(attrs); recordNext=this.version.matches(version); } }
Example 14
From project anode, under directory /src/net/haltcondition/anode/.
Source file: ServiceParser.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { Log.d(TAG,"Element Start: " + localName); if (localName.equals("service")) { service=new Service(); service.setServiceName(attributes.getValue("type")); inElement=true; } }
Example 15
From project ant4eclipse, under directory /org.ant4eclipse.ant.pde/src/org/ant4eclipse/ant/pde/.
Source file: TargetPlattformContentHandler.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { if ("location".equals(qName)) { String type=attributes.getValue("type"); if ("Directory".equals(type)) { String path=attributes.getValue("path"); if (path != null) { if (path.contains(ECLIPSE_VAR_PROJECT_LOC)) { path=replaceProjectLoc(path); } A4ELogging.info("Add path '%s' from target definition.",path); File file=new File(path); Location location=new TargetPlatformDefinitionDataType.Location(file); this.dataType.addConfiguredLocation(location); } else { A4ELogging.warn("Directory entry without path encountered, ignored!"); } } else { A4ELogging.warn("Only Directory entries are supported at the momment, entry with type %s ignored!",type); } } }
Example 16
From project apps-for-android, under directory /Samples/Downloader/src/com/google/android/downloader/.
Source file: DownloaderActivity.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { if (localName.equals("config")) { mConfig.version=getRequiredString(attributes,"version"); } else if (localName.equals("file")) { String src=attributes.getValue("","src"); String dest=getRequiredString(attributes,"dest"); String md5=attributes.getValue("","md5"); long size=getLong(attributes,"size",-1); mConfig.mFiles.add(new Config.File(src,dest,md5,size)); } else if (localName.equals("part")) { String src=getRequiredString(attributes,"src"); String md5=attributes.getValue("","md5"); long size=getLong(attributes,"size",-1); int length=mConfig.mFiles.size(); if (length > 0) { mConfig.mFiles.get(length - 1).mParts.add(new Config.File.Part(src,md5,size)); } } }
Example 17
From project AudioBox.fm-JavaLib, under directory /audiobox.fm-core/src/main/java/fm/audiobox/core/parsers/.
Source file: XmlParser.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { if ("".equals(localName.trim())) { localName=qName; } if (localName.matches(this.stack.peek().getTagName())) { return; } if (this.config.getFactory().containsEntity(localName)) { IEntity newEntity=this.config.getFactory().getEntity(localName,this.config); this.stack.push(newEntity); if (log.isTraceEnabled()) { log.trace("New Entity '" + newEntity,getClass().getName() + "' for tag: " + localName); } } else { this.bodyContent=new StringBuffer(""); } }
Example 18
From project autopsy, under directory /thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/.
Source file: ThunderbirdXHTMLContentHandler.java

/** * Starts the given element. Table cells and list items are automatically indented by emitting a tab character as ignorable whitespace. */ @Override public void startElement(String uri,String local,String name,Attributes attributes) throws SAXException { if (name.equals("frameset")) { lazyEndHead(true); } else if (!AUTO.contains(name)) { if (HEAD.contains(name)) { lazyStartHead(); } else { lazyEndHead(false); } if (XHTML.equals(uri) && INDENT.contains(name)) { ignorableWhitespace(TAB,0,TAB.length); } super.startElement(uri,local,name,attributes); } }
Example 19
From project aviator, under directory /src/main/java/com/googlecode/aviator/asm/xml/.
Source file: ASMContentHandler.java

/** * Process notification of the start of an XML element being reached. * @param ns - The Namespace URI, or the empty string if the element has noNamespace URI or if Namespace processing is not being performed. * @param lName - The local name (without prefix), or the empty string ifNamespace processing is not being performed. * @param qName - The qualified name (with prefix), or the empty string ifqualified names are not available. * @param list - The attributes attached to the element. If there are noattributes, it shall be an empty Attributes object. * @exception SAXException if a parsing error is to be reported */ public final void startElement(final String ns,final String lName,final String qName,final Attributes list) throws SAXException { String name=lName == null || lName.length() == 0 ? qName : lName; StringBuffer sb=new StringBuffer(match); if (match.length() > 0) { sb.append('/'); } sb.append(name); match=sb.toString(); Rule r=(Rule)RULES.match(match); if (r != null) { r.begin(name,list); } }
Example 20
From project beam-third-party, under directory /beam-meris-veg/src/main/java/org/esa/beam/processor/baer/auxdata/.
Source file: AerPhaseLoader.java

/** * Callback invoked from SAX parser when an object starts. * @param nameSpaceURI * @param sName simple (local) name * @param qName qualified name * @param attrs the element attributes */ private void createLUTElement(String nameSpaceURI,String sName,String qName,Attributes attrs) throws SAXException { if (qName.equalsIgnoreCase(BaerConstants.AER_PARAMETER_TAG)) { parseParameter(attrs); } else if (qName.equalsIgnoreCase(BaerConstants.AER_BAND_TAG)) { startBand(attrs); } else if (qName.equalsIgnoreCase(BaerConstants.AER_LUT_TAG)) { startLut(attrs); } else if (qName.equalsIgnoreCase(BaerConstants.AER_LUT_LIST_TAG)) { startAerLutList(attrs); } }
Example 21
From project behemoth, under directory /tika/src/main/java/com/digitalpebble/behemoth/tika/.
Source file: TikaMarkupHandler.java

public void startElement(String uri,String localName,String qName,Attributes atts) throws SAXException { int startOffset=textBuffer.length(); Annotation annot=new Annotation(); annot.setStart(startOffset); annot.setType(localName); for (int i=0; i < atts.getLength(); i++) { String key=atts.getLocalName(i); String value=atts.getValue(i); annot.getFeatures().put(key,value); } this.startedAnnotations.addLast(annot); }
Example 22
From project blacktie, under directory /jatmibroker-nbf/src/main/java/org/jboss/narayana/blacktie/jatmibroker/nbf/.
Source file: NBFHandlers.java

public void startElement(String uri,String localName,String qName,Attributes atts) throws SAXException { if (qName.equals(id)) { if (index == curIndex) { found=true; } curIndex++; ElementPSVI psvi=provider.getElementPSVI(); if (psvi != null) { XSTypeDefinition typeInfo=psvi.getTypeDefinition(); while (typeInfo != null) { String typeName=typeInfo.getName(); if (typeName != null && (typeName.equals("long") || typeName.equals("string") || typeName.equals("integer")|| typeName.equals("float")|| typeName.endsWith("_type"))) { type=typeName; log.debug(qName + " has type of " + type); break; } typeInfo=typeInfo.getBaseType(); } } } }
Example 23
From project boilerpipe, under directory /boilerpipe-core/src/main/de/l3s/boilerpipe/sax/.
Source file: BoilerpipeHTMLContentHandler.java

public void startElement(String uri,String localName,String qName,Attributes atts) throws SAXException { labelStacks.add(null); TagAction ta=tagActions.get(localName); if (ta != null) { if (ta.changesTagLevel()) { tagLevel++; } flush=ta.start(this,localName,qName,atts) | flush; } else { tagLevel++; flush=true; } lastEvent=Event.START_TAG; lastStartTag=localName; }
Example 24
From project boilerpipe_1, under directory /boilerpipe-core/src/main/de/l3s/boilerpipe/sax/.
Source file: BoilerpipeHTMLContentHandler.java

public void startElement(String uri,String localName,String qName,Attributes atts) throws SAXException { TagAction ta=tagActions.get(localName); if (ta != null) { flush=ta.start(this,localName,qName,atts) | flush; } else { flush=true; } lastEvent=Event.START_TAG; lastStartTag=localName; }
Example 25
From project Book-Catalogue, under directory /src/com/eleybourn/bookcatalogue/goodreads/api/.
Source file: TrivialParser.java

@Override public void startElement(String uri,String localName,String name,Attributes attributes) throws SAXException { super.startElement(uri,localName,name,attributes); m_Builder.append("<"); if (uri != null && !uri.equals("")) m_Builder.append(uri + ":"); if (localName != null && !localName.equals("")) m_Builder.append(localName); if (attributes != null && attributes.getLength() > 0) { for (int i=0; i < attributes.getLength(); i++) { m_Builder.append(" "); String attrName=attributes.getQName(i); if (attrName == null || attrName.equals("")) attrName=attributes.getLocalName(i); m_Builder.append(attrName); m_Builder.append("='"); m_Builder.append(attributes.getValue(i)); m_Builder.append("'"); } } m_Builder.append(">"); }
Example 26
From project box-android-sdk, under directory /BoxAndroidLibrary/src/com/box/androidlib/ResponseParsers/.
Source file: CollaborationsResponseParser.java

@Override public void startElement(final String uri,final String localName,final String qName,final Attributes attributes) throws SAXException { super.startElement(uri,localName,qName,attributes); if (localName.equals("collaboration")) { collaboration=new Collaboration(); } }
Example 27
From project C-Cat, under directory /util/src/main/java/gov/llnl/ontology/text/corpora/.
Source file: PubMedDocumentReader.java

@Override public void startElement(String uri,String localName,String name,Attributes atts) throws SAXException { if ("Abstract".equals(name)) { inAbstract=true; } else if (inAbstract) { if ("p".equals(name)) { b.append("\n\n"); } else if (ignorableAbstractTags.contains(name)) { inIgnoreAbstract=true; } } else if ("DescriptorName".equals(name)) { inChemicalName=true; } else if ("PMID".equals(name)) { inPMID=true; } else if ("ArticleTitle".equals(name)) { inTitle=true; } }
Example 28
From project Carolina-Digital-Repository, under directory /fcrepo-clients/src/main/java/edu/unc/lib/dl/fedora/.
Source file: StructMapOrderExtractor.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { super.startElement(uri,localName,qName,attributes); if ("div".equals(localName)) { String id=attributes.getValue("ID"); if (pid.getPid().equals(id)) { this.order=attributes.getValue("ORDER"); } } }
Example 29
From project cdk, under directory /xinclude/src/main/java/org/apache/cocoon/pipeline/component/sax/.
Source file: XIncludeTransformer.java

public void startElement(String uri,String localName,String name,Attributes atts) throws SAXException { if (XINCLUDE_NAMESPACE_URI.equals(uri)) { if (XINCLUDE_INCLUDE.equals(localName)) { if (isEvaluatingContent()) { String href=atts.getValue("",XINCLUDE_HREF); String parse=atts.getValue("",XINCLUDE_PARSE); if (parse == null) { parse=XINCLUDE_PARSE_XML; } String xpointer=atts.getValue("",XINCLUDE_XPOINTER); String encoding=atts.getValue("",XINCLUDE_ENCODING); String accept=atts.getValue("",XINCLUDE_ACCEPT); String acceptLanguage=atts.getValue("",XINCLUDE_ACCEPT_LANGUAGE); processXIncludeElement(href,parse,xpointer,encoding,accept,acceptLanguage); } xIncludeElementLevel++; } else if (XINCLUDE_FALLBACK.equals(localName)) { fallbackElementLevel++; } else { throw new SAXException("Unknown XInclude element " + localName + " at "+ getLocation()); } } else if (isEvaluatingContent()) { getContentHandler().startElement(uri,localName,name,atts); } }
Example 30
From project chatbots-library, under directory /distribution/src/codeanticode/chatbots/alice/aiml/.
Source file: AIMLHandler.java

private void updateIgnoreWhitespace(Attributes attributes){ try { ignoreWhitespace=!"preserve".equals(attributes.getValue("xml:space")); } catch ( NullPointerException e) { } }
Example 31
From project ChkBugReport, under directory /src/com/sonyericsson/chkbugreport/util/.
Source file: XMLNode.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { XMLNode node=new XMLNode(qName); if (mRoot == null) { mRoot=node; } if (mCur != null) { mCur.add(node); } mCur=node; for (int i=0; i < attributes.getLength(); i++) { node.addAttr(attributes.getQName(i),attributes.getValue(i)); } }
Example 32
From project CineShowTime-Android, under directory /Libraries/CineShowTime/src/com/binomed/showtime/android/parser/xml/.
Source file: ParserSimpleResultXml.java

@Override public void startElement(String uri,String localName,String name,Attributes atts) throws SAXException { if (XmlGramarSimpleResult.NODE_SIMPLE_RESP.equals(localName)) { if (atts.getValue(XmlGramarSimpleResult.ATTR_URL) != null) { url=atts.getValue(XmlGramarSimpleResult.ATTR_URL); } } }
Example 33
From project closure-templates, under directory /java/src/com/google/template/soy/xliffmsgplugin/.
Source file: XliffParser.java

@Override public void startElement(String uri,String localName,String qName,Attributes atts){ if (qName.equals("file")) { if (targetLocaleString == null) { targetLocaleString=atts.getValue("target-language"); } else { if (!atts.getValue("target-language").equals(targetLocaleString)) { throw new SoyMsgException("If XLIFF input contains multiple 'file' elements, they must have the same" + " 'target-language'."); } } } else if (qName.equals("trans-unit")) { String id=atts.getValue("id"); try { currMsgId=Long.parseLong(id); } catch ( NumberFormatException e) { throw new SoyMsgException("Invalid message id '" + id + "' could not have been generated by the Soy compiler."); } } else if (qName.equals("target")) { currMsgParts=Lists.newArrayList(); currRawTextPart=null; isInMsg=true; } else if (isInMsg) { if (!qName.equals("x")) { throw new SoyMsgException("In messages extracted by the Soy compiler, all placeholders should be element 'x'" + " (found element '" + qName + "' in message)."); } if (currRawTextPart != null) { currMsgParts.add(new SoyMsgRawTextPart(currRawTextPart)); currRawTextPart=null; } currMsgParts.add(new SoyMsgPlaceholderPart(atts.getValue("id"))); } }
Example 34
From project cocos2d, under directory /cocos2d-android/src/org/cocos2d/utils/.
Source file: PlistParser.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { if (localName.equals(EL_KEY)) { currentElement=TYPE_KEY; } else if (localName.equals(EL_STRING)) { currentElement=TYPE_STRING; } else if (localName.equals(EL_INTEGER)) { currentElement=TYPE_INTEGER; } else if (localName.equals(EL_REAL)) { currentElement=TYPE_REAL; } else if (localName.equals(EL_DATA)) { currentElement=TYPE_DATA; } else if (localName.equals(EL_DATE)) { currentElement=TYPE_DATE; } else if (localName.equals(EL_TRUE)) { addToCollection(true); } else if (localName.equals(EL_FALSE)) { addToCollection(false); } else if (localName.equals(EL_DICT)) { depthUp(new HashMap<String,Object>()); } else if (localName.equals(EL_ARRAY)) { depthUp(new ArrayList<Object>()); } }
Example 35
From project codjo-control, under directory /codjo-control-common/src/main/java/net/codjo/control/common/loader/.
Source file: StepFactory.java

public Object createObject(Attributes attributes) throws Exception { Step step; String inheritId=attributes.getValue("inheritId"); if (inheritId == null) { step=new Step(); } else { IntegrationPlan ip=(IntegrationPlan)digester.peek(digester.getCount() - 1); StepsList abstractSteps=ip.getAbstractSteps(); if (abstractSteps == null) { throw new IllegalArgumentException("A step inherits from abstract step " + inheritId + ", but no abstract step has been declared!"); } Step abstractStep=abstractSteps.getStep(inheritId); if (abstractStep == null) { throw new IllegalArgumentException("A step inherits from abstract step " + inheritId + ", but this abstract step has not been declared!"); } step=(Step)abstractStep.clone(); } return step; }
Example 36
From project codjo-webservices, under directory /codjo-webservices-common/src/main/java/com/tilab/wsig/soap/.
Source file: SoapToJade.java

/** * startElement Level: 1: Envelope 2: Body 3: Operation >=4: Parameters */ public void startElement(String uri,String name,String qName,Attributes attrs){ try { elContent.setLength(0); ++level; if (level >= 4) { String attrValue=attrs.getValue(WSDLConstants.XSI,"type"); if (attrValue != null) { int pos=attrValue.indexOf(':'); String valueType=attrValue.substring(pos + 1); log.debug("Start managing parameter " + name + " of type "+ valueType); int params4LevelIndex=level - 4; Vector<ParameterInfo> params=null; if (params4Level.size() <= params4LevelIndex) { params=new Vector<ParameterInfo>(); params4Level.add(params4LevelIndex,params); } else { params=params4Level.get(params4LevelIndex); } ParameterInfo ei=new ParameterInfo(); ei.setName(name); ei.setType(valueType); params.add(ei); } } } catch ( Exception e) { level=0; throw new RuntimeException("Error parsing element " + name + " - "+ e.getMessage(),e); } }
Example 37
From project Coffee-Framework, under directory /coffeeframework-core/src/main/java/coffee/.
Source file: CoffeeConfiguration.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { parserCursor++; textContent.delete(0,textContent.length()); if (!localName.equals("bundle")) return; currentBundleResource=new BundleResource(); currentBundleResource.setContentType(attributes.getValue("content-type")); String uriAttr=attributes.getValue("url"); bundleResources.put(uriAttr,currentBundleResource); }
Example 38
From project core_1, under directory /common/src/main/java/org/switchyard/common/xml/.
Source file: Element.java

/** * Construct the element. * @param namespaceURI The namespace for the element. * @param localName The local name of the element. * @param attributes The associated attributes. */ Element(final String namespaceURI,final String localName,final Attributes attributes){ _name=new QName(namespaceURI,localName); final int numAttributes=attributes.getLength(); for (int count=0; count < numAttributes; count++) { final String attrNamespaceURI=attributes.getURI(count); final String attrLocalName=attributes.getLocalName(count); final String attrValue=attributes.getValue(count); this._attributes.put(new QName(attrNamespaceURI,attrLocalName),attrValue); } }
Example 39
From project core_5, under directory /exo.core.component.document/src/main/java/org/exoplatform/services/document/impl/.
Source file: OpenOfficeDocumentReader.java

@Override public void startElement(String namespaceURI,String localName,String rawName,Attributes atts) throws SAXException { if (rawName.startsWith("text:")) { appendChar=true; if (content.length() > 0) { content.append(" "); } } }
Example 40
From project cpptasks-parallel, under directory /src/main/java/net/sf/antcontrib/cpptasks/.
Source file: DependencyTable.java

/** * startElement handler */ public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException { if (qName.equals("include")) { includes.addElement(atts.getValue("file")); } else { if (qName.equals("sysinclude")) { sysIncludes.addElement(atts.getValue("file")); } else { if (qName.equals("source")) { source=atts.getValue("file"); sourceLastModified=Long.parseLong(atts.getValue("lastModified"),16); includes.setSize(0); sysIncludes.setSize(0); } else { if (qName.equals("includePath")) { includePath=atts.getValue("signature"); } } } } }
Example 41
From project crash, under directory /jcr/core/src/main/java/org/crsh/jcr/.
Source file: Exporter.java

@Override public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { try { String fileName=XML.fileName(qName); fs.startDirectory(fileName); ByteArrayOutputStream out=new ByteArrayOutputStream(); StreamResult streamResult=new StreamResult(out); SAXTransformerFactory tf=(SAXTransformerFactory)SAXTransformerFactory.newInstance(); TransformerHandler hd=tf.newTransformerHandler(); Transformer serializer=hd.getTransformer(); serializer.setOutputProperty(OutputKeys.ENCODING,"UTF-8"); serializer.setOutputProperty(OutputKeys.INDENT,"yes"); hd.setResult(streamResult); hd.startDocument(); for ( Map.Entry<String,String> mapping : mappings.entrySet()) { String prefix=mapping.getKey(); hd.startPrefixMapping(prefix,mapping.getValue()); } hd.startElement(uri,localName,qName,attributes); hd.endElement(uri,localName,qName); for ( String prefix : mappings.keySet()) { hd.endPrefixMapping(prefix); } hd.endDocument(); out.close(); byte[] content=out.toByteArray(); fs.file("crash__content.xml",content.length,new ByteArrayInputStream(content)); } catch ( Exception e) { throw new SAXException(e); } }
Example 42
From project dcm4che, under directory /dcm4che-hl7/src/main/java/org/dcm4che/hl7/.
Source file: HL7ContentHandler.java

private void startHeaderSegment(String seg,Attributes atts) throws IOException { Delimiter[] values=Delimiter.values(); for (int i=0; i < values.length; i++) { String value=atts.getValue(values[i].attribute()); if (value != null) delimiters[i]=value.charAt(0); } this.escape[0]=this.escape[2]=delimiters[3]; writer.write(seg); writer.write(delimiters); }
Example 43
From project DeliciousDroid, under directory /src/com/deliciousdroid/xml/.
Source file: SaxBundleParser.java

public ArrayList<Bundle> parse() throws ParseException { final Bundle currentBundle=new Bundle(); RootElement root=new RootElement("bundles"); final ArrayList<Bundle> bundles=new ArrayList<Bundle>(); root.getChild("bundle").setStartElementListener(new StartElementListener(){ public void start( Attributes attributes){ String tags=attributes.getValue("","tags"); String name=attributes.getValue("","name"); if (tags != null) { currentBundle.setTagString(tags); } if (name != null) { currentBundle.setName(name); } bundles.add(currentBundle.copy()); } } ); try { Xml.parse(is,Xml.Encoding.UTF_8,root.getContentHandler()); } catch ( Exception e) { } return bundles; }
Example 44
From project dev-examples, under directory /iteration-demo/src/main/java/org/richfaces/demo/.
Source file: TreeNodeParser.java

public void startElement(String uri,String localName,String qName,Attributes atts) throws SAXException { SwingTreeNodeImpl<String> newNode=new SwingTreeNodeImpl<String>(); if (currentNode == null) { rootNodes.add(newNode); } else { currentNode.addChild(newNode); } newNode.setData(JOINER.join(newNode.getData(),localName.toLowerCase(Locale.US)," [")); currentNode=newNode; }
Example 45
From project DigitbooksExamples, under directory /DigitbooksExamples/src/fr/digitbooks/android/examples/chapitre08/.
Source file: DigitbooksGuestbookXml.java

public void startElement(String uri,String name,String qName,Attributes atts){ if (name.trim().equals("data")) { inData=true; HashMap<String,String> map=new HashMap<String,String>(); for (int i=0; i < atts.getLength(); i++) { if (atts.getLocalName(i).equals("rating")) { if (Config.INFO_LOGS_ENABLED) { Log.i(LOG_TAG,"rating = " + atts.getValue(i)); } map.put("rating",atts.getValue(i)); } else if (atts.getLocalName(i).equals("comment")) { if (Config.INFO_LOGS_ENABLED) { Log.i(LOG_TAG,"comment = " + atts.getValue(i)); } map.put("content",atts.getValue(i)); } else if (atts.getLocalName(i).equals("date")) { if (Config.INFO_LOGS_ENABLED) { Log.i(LOG_TAG,"date = " + atts.getValue(i)); } map.put("date",atts.getValue(i)); } else { Log.e(LOG_TAG,"attrinute unknown = " + atts.getLocalName(i)); } } mData.add(map); } }
Example 46
From project dreamDroid, under directory /src/net/reichholf/dreamdroid/parsers/enigma2/saxhandler/.
Source file: E2EpgNowNextListHandler.java

@Override public void startElement(String namespaceUri,String localName,String qName,Attributes attrs){ if (localName.equals(TAG_E2EVENT)) { inEvent=true; if (!isFirst || mEvent == null) mEvent=new ExtendedHashMap(); isFirst=!isFirst; } else if (localName.equals(TAG_E2EVENTID)) { inId=true; } else if (localName.equals(TAG_E2EVENTSTART)) { inStart=true; } else if (localName.equals(TAG_E2EVENTDURATION)) { inDuration=true; } else if (localName.equals(TAG_E2EVENTCURRENTTIME)) { inCurrentTime=true; } else if (localName.equals(TAG_E2EVENTTITLE)) { inTitle=true; } else if (localName.equals(TAG_E2EVENTDESCRIPTION)) { inDescription=true; } else if (localName.equals(TAG_E2EVENTDESCRIPTIONEXTENDED)) { inDescriptionEx=true; } else if (localName.equals(TAG_E2EVENTSERVICEREFERENCE)) { inServiceRef=true; } else if (localName.equals(TAG_E2EVENTSERVICENAME)) { inServiceName=true; } }
Example 47
From project DrmLicenseService, under directory /src/com/sonyericsson/android/drm/drmlicenseservice/jobs/.
Source file: WebInitiatorJob.java

/** * Will be called on opening tags like: <tag> Can provide attribute(s), when xml is: <tag attribute="value"> */ @Override public void startElement(String namespaceURI,String localName,String qName,Attributes atts) throws SAXException { if (mTagStack.size() == 1) { currentItem=new InitiatorDataItem(); currentItem.type=localName; } if (headerBuffer != null) { headerBuffer.append('<').append(localName); if (namespaceURI != null) { if (currentNs == null || !currentNs.equals(namespaceURI)) { headerBuffer.append(" xmlns=\"").append(namespaceURI).append('\"'); currentNs=namespaceURI; currentNsLevel=localName; } } if (atts != null) { for (int i=0; i < atts.getLength(); i++) { headerBuffer.append(' ').append(atts.getLocalName(i)).append("=\""); headerBuffer.append(atts.getValue(i)).append('\"'); } } headerBuffer.append('>'); } else if (localName != null && localName.equals("Header")) { headerBuffer=new StringBuffer(); } mTagStack.push(localName); }
Example 48
From project EasySOA, under directory /easysoa-registry/easysoa-registry-web/src/main/java/org/easysoa/beans/.
Source file: EasySOAImportSoapUIParser.java

public void startElement(String uri,String localName,String qName,Attributes attributes) throws SAXException { if (qName.equals("con:interface")) { serviceName=attributes.getValue("name"); serviceWsdlUrl=attributes.getValue("definition"); serviceEndpointUrl=null; } else if (qName.equals("con:mockService")) { serviceName=attributes.getValue("name"); serviceWsdlUrl=null; serviceEndpointUrl="http://localhost:" + attributes.getValue("port") + attributes.getValue("path"); } else if (qName.equals("con:endpoint")) { inEndpointTag=true; } }
Example 49
From project eclim, under directory /org.eclim.jdt/java/org/eclim/plugin/jdt/command/log4j/.
Source file: ValidateCommand.java

/** * {@inheritDoc} * @see org.xml.sax.helpers.DefaultHandler#startElement(String,String,String,Attributes) */ public void startElement(String uri,String localName,String qName,Attributes atts) throws SAXException { try { if (CATEGORY.equals(localName) || LOGGER.equals(localName)) { String name=atts.getValue(NAME); if (name != null) { IPackageFragment pkg=getPackage(name); if (pkg == null) { IType type=project.findType(name); if (type == null || !type.exists()) { String message=Services.getMessage("log4j.logger.name.invalid",name); errors.add(new Error(message,file,locator.getLineNumber(),1,false)); } } } } else if (PRIORITY.equals(localName) || LEVEL.equals(localName)) { String value=atts.getValue(VALUE); if (atts.getValue(CLASS) == null && value != null) { if (!LEVELS.contains(value.trim().toLowerCase())) { String message=Services.getMessage("log4j.level.name.invalid",value); errors.add(new Error(message,file,locator.getLineNumber(),1,false)); } } } String classname=atts.getValue(CLASS); if (classname != null) { IType type=project.findType(classname); if (type == null || !type.exists()) { String message=Services.getMessage("type.not.found",project.getElementName(),classname); errors.add(new Error(message,file,locator.getLineNumber(),1,false)); } } } catch ( Exception e) { throw new RuntimeException(e); } }
Example 50
From project Eclipse, under directory /com.mobilesorcery.sdk.core/src/com/mobilesorcery/sdk/core/.
Source file: IconManager.java

/** * Invoked by SAX parser at the start of an XML tag * @param uri The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed. * @param localName The local name (without prefix), or the empty string if Namespace processing is not being performed. * @param qName The qualified name (with prefix), or the empty string if qualified names are not available. * @param attributes The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. * @exception RuntimeException Occurs if the XML isn't properly formated. */ public void startElement(String uri,String localName,String qName,Attributes atts){ if (qName.equals("instance") == true) { if (m_parseStack.empty() == false && m_parseStack.peek().equals("icon") == true) { int w=0; int h=0; String size=""; String path=""; Entry<Integer,Integer> iconSize; for (int i=0; i < atts.getLength(); i++) { String n=atts.getQName(i); if (n.equals("size") == true) size=atts.getValue(i); else if (n.equals("src") == true) path=atts.getValue(i); } if (path.isEmpty() == true) throw new RuntimeException("Badly formated icon xml: no src"); if (size.isEmpty() == true && path.endsWith(".svg") == false) throw new RuntimeException("Badly formated icon xml: src, but no size"); if (size.isEmpty() == false) { if (size.equalsIgnoreCase("default") == false) { String[] tmp=size.split("x"); if (tmp.length != 2) throw new RuntimeException("Badly formated icon xml: bad size format"); try { w=Integer.parseInt(tmp[0]); h=Integer.parseInt(tmp[1]); } catch ( NumberFormatException e) { throw new RuntimeException("Badly formated icon xml, size attribute",e); } } } iconSize=new SimpleEntry<Integer,Integer>(w,h); m_iconList.add(new SimpleEntry<String,Entry<Integer,Integer>>(path,iconSize)); } } m_parseStack.push(qName); }
Example 51
From project enclojure, under directory /org-enclojure-ide/src/main/java/org/enclojure/ide/asm/xml/.
Source file: ASMContentHandler.java

/** * Process notification of the start of an XML element being reached. * @param ns - The Namespace URI, or the empty string if the element has noNamespace URI or if Namespace processing is not being performed. * @param lName - The local name (without prefix), or the empty string ifNamespace processing is not being performed. * @param qName - The qualified name (with prefix), or the empty string ifqualified names are not available. * @param list - The attributes attached to the element. If there are noattributes, it shall be an empty Attributes object. * @exception SAXException if a parsing error is to be reported */ public final void startElement(final String ns,final String lName,final String qName,final Attributes list) throws SAXException { String name=lName == null || lName.length() == 0 ? qName : lName; StringBuffer sb=new StringBuffer(match); if (match.length() > 0) { sb.append('/'); } sb.append(name); match=sb.toString(); Rule r=(Rule)RULES.match(match); if (r != null) { r.begin(name,list); } }