List of usage examples for org.w3c.dom Element getLocalName
public String getLocalName();
From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java
/**************************************************************************** * APPINFO UTILITIES/* w w w.j a v a2 s . co m*/ ****************************************************************************/ private Element getAppInfo(String regex) { Element appInfo = null; ArrayList<Element> list = new ArrayList<Element>(); // list.addAll(annotation.getUserInformation()); if (annotation == null) { return null; } list.addAll(annotation.getApplicationInformation()); for (Iterator<Element> iter = list.iterator(); iter.hasNext();) { Element ann = iter.next(); String name = ann.getLocalName(); if ("appinfo".equals(name.toLowerCase())) {//$NON-NLS-1$ name = ann.getAttribute("source");//$NON-NLS-1$ if (name.matches(regex)) { appInfo = ann; break; } } } return appInfo; }
From source file:com.hp.hpl.inkml.InkMLDOMParser.java
/** * bind data from parsed xml to the inkml data objects it passes the element to coresponding getXXX method based on their type(tag name) and performs the * data binding//from www .ja v a2s. com * * @param ink the ink document data object to be populated with parsing an inkml file */ protected void bindData(final Ink ink) throws InkMLException { InkMLDOMParser.LOG.info("\nTo bind the parsed data to InkML data objects.\n"); if (null == this.inkmlDOMDocument) { InkMLDOMParser.LOG.warning("No parsed data available for data binding."); return; } final Element rootElmnt = this.inkmlDOMDocument.getDocumentElement(); if ("ink".equalsIgnoreCase(rootElmnt.getLocalName())) { ink.setDocID(rootElmnt.getAttribute("documentID")); final NodeList list = rootElmnt.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { final Node node = list.item(i); if (!(node instanceof Element)) { continue; } final Element element = (Element) node; this.addToInkElementList(element, ink); } } else if ("inkMLFragment".equalsIgnoreCase(rootElmnt.getLocalName())) { final NodeList list = rootElmnt.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { final Node node = list.item(i); if (!(node instanceof Element)) { continue; } final Element element = (Element) node; this.addToInkElementList(element, ink); } } }
From source file:org.apache.taverna.scufl2.translator.t2flow.T2FlowParser.java
protected Revision parseIdentificationAnnotations(Annotations annotations) { SortedMap<Calendar, UUID> revisions = new TreeMap<>(); if (annotations == null || annotations.getAnnotationChainOrAnnotationChain22() == null) return null; for (JAXBElement<AnnotationChain> el : annotations.getAnnotationChainOrAnnotationChain22()) { NetSfTavernaT2AnnotationAnnotationAssertionImpl ann = el.getValue() .getNetSfTavernaT2AnnotationAnnotationChainImpl().getAnnotationAssertions() .getNetSfTavernaT2AnnotationAnnotationAssertionImpl(); String annClass = ann.getAnnotationBean().getClazz(); if (!annClass.equals(IDENTIFICATION_ASSERTION)) continue; for (Object obj : ann.getAnnotationBean().getAny()) { if (!(obj instanceof Element)) continue; Element elem = (Element) obj; if (elem.getNamespaceURI() == null && elem.getLocalName().equals("identification")) { String uuid = elem.getTextContent().trim(); String date = ann.getDate(); Calendar cal = parseDate(date); revisions.put(cal, UUID.fromString(uuid)); }//w w w . ja va 2s . co m } } Revision rev = null; for (Entry<Calendar, UUID> entry : revisions.entrySet()) { Calendar cal = entry.getKey(); UUID uuid = entry.getValue(); URI uri = WORKFLOW_ROOT.resolve(uuid.toString() + "/"); rev = new Revision(uri, rev); rev.setGeneratedAtTime(cal); } return rev; }
From source file:com.hp.hpl.inkml.InkMLDOMParser.java
/** * Method to bind the children of context element * /*from www . ja va 2 s . co m*/ * @param ctxChild child element of context element * @param context context data object * @param definitions the definitions data object to resolve the reference attributes * @throws InkMLException */ protected void addToContextChildrenList(final Element ctxChild, final Context context, final Definitions definitions) throws InkMLException { final String tagName = ctxChild.getLocalName(); // Content of <context> is ( brush | traceFormat | ) if (tagName.equals("brush")) { final Brush brush = this.getBrush(ctxChild); context.addToContextElementList(brush); } else if (tagName.equals("traceFormat")) { final TraceFormat tf = this.getTraceFormat(ctxChild, definitions); context.addToContextElementList(tf); } else if (tagName.equals("canvas")) { final Canvas canvas = this.getCanvas(ctxChild, definitions); context.addToContextElementList(canvas); } else if (tagName.equals("canvasTransform")) { final CanvasTransform canvasTransform = this.getCanvasTransform(ctxChild); context.addToContextElementList(canvasTransform); } else if (tagName.equals("inkSource")) { final InkSource inkSrc = this.getInkSource(ctxChild, definitions); context.addToContextElementList(inkSrc); } else if (tagName.equals("timeStamp")) { final Timestamp timeStamp = this.getTimestamp(ctxChild); context.addToContextElementList(timeStamp); } }
From source file:com.hp.hpl.inkml.InkMLDOMParser.java
/** * Method to bind the direct children of Ink data object * // www . j a va 2 s . com * @param element child element of Ink * @param ink ink data object * @throws InkMLException */ protected void addToInkElementList(final Element element, final Ink ink) throws InkMLException { final String tagName = element.getLocalName(); // Content of <ink> is ( definitions | context | trace | traceGroup | // traceView | annotation | annotationXML ) if (tagName.equals("definitions")) { final Definitions definitions = ink.getDefinitions(); final NodeList childElements = element.getChildNodes(); this.addToDefinitions(childElements, definitions); } else if (tagName.equals("context")) { // a <context> as direct child to <ink> updates the curentContext. final Definitions defs = ink.getDefinitions(); final Context context = this.getContext(element, defs); // replace 'implicit contextRef' to the 'id' of the current context if ("".equals(context.getContextRef())) { context.setContextRef("#" + ink.getCurrentContext().getId()); } context.deriveContextualChildrenData(ink.getDefinitions(), ink.getCurrentContext()); final List<Ink.ContextChangeStatus> ctxChanges = ink.getContextChanges(context); if (ctxChanges.isEmpty()) { // no context change occured. Ignore this context element return; } // assign ID and place it in definitions if ("".equals(context.getId())) { String ctxId = InkMLIDGenerator.getNextIDForContext(); while (defs.contains(ctxId)) { ctxId = InkMLIDGenerator.getNextIDForContext(); } context.setId(ctxId); } defs.addToDirectChildrenMap(context); this.inkMLProcessor.notifyContextChanged(context, ctxChanges); ink.setCurrentContext(context); } else if (tagName.equals("trace")) { final Trace trace = this.getTrace(element); ink.addTrace(trace); this.inkMLProcessor.notifyTraceReceived(trace); if (!"".equals(trace.getId())) { ink.getDefinitions().addToIndirectChildrenMap(trace); } } else if (tagName.equals("traceGroup")) { final TraceGroup traceGroup = this.getTraceGroup(element); traceGroup.resolveAssociatedContext(ink.getCurrentContext()); ink.addTraceGroup(traceGroup); this.inkMLProcessor.notifyTraceGroupReceived(traceGroup); // store traceData having 'id' attibute to IndirectChildren if (!"".equals(traceGroup.getId())) { ink.getDefinitions().addToIndirectChildrenMap(traceGroup); } final List<TraceDataElement> children = traceGroup.getTraceDataList(); if (null != children) { for (int i = 0; i < children.size(); i++) { final TraceDataElement child = children.get(i); if (!"".equals(child.getId())) { ink.getDefinitions().addToIndirectChildrenMap(child); } } } } else if (tagName.equals("traceView")) { final TraceView traceView = this.getTraceView(element, ink.getDefinitions()); traceView.setAssociatedContext(ink.getCurrentContext()); ink.addTraceView(traceView); this.inkMLProcessor.notifyTraceViewReceived(traceView); if (!"".equals(traceView.getId())) { ink.getDefinitions().addToDirectChildrenMap(traceView); } } else if (tagName.equals("annotation")) { final Annotation annotation = this.getAnnotation(element); ink.addAnnotation(annotation); } else if (tagName.equals("annotationXML")) { final AnnotationXML aXml = this.getAnnotationXML(element); ink.addAnnotationXML(aXml); } else { throw new InkMLException( "The Element " + tagName + " is not a valid Child Element for InkML <Ink> Element"); } }
From source file:com.hp.hpl.inkml.InkMLDOMParser.java
/** * Method to bind AnnotationXML element//from www .j a v a2s . c o m * * @param element the AnnotationXML element * @return AnnotationXML data object * @throws InkMLException */ protected AnnotationXML getAnnotationXML(final Element element) throws InkMLException { final AnnotationXML aXml = new AnnotationXML(); final NamedNodeMap attributesMap = element.getAttributes(); final int length = attributesMap.getLength(); for (int index = 0; index < length; index++) { final Attr attribute = (Attr) attributesMap.item(index); final String attributeName = attribute.getName(); if ("type".equals(attributeName)) { aXml.setType(attribute.getValue()); } else if ("encoding".equals(attributeName)) { aXml.setEncoding(attribute.getValue()); } else { aXml.addToOtherAttributesMap(attributeName, attribute.getValue()); } } InkMLDOMParser.LOG.finest("annotationXML received: " + element.toString()); final NodeList list = element.getChildNodes(); final int nChildren = list.getLength(); if (nChildren > 0) { for (int i = 0; i < nChildren; i++) { final Node node = list.item(i); if (!(node instanceof Element)) { continue; } final Element childElement = (Element) node; // get the tagName to use as Key in the valueMap final String tagName = childElement.getLocalName(); // String key = this.parentXPath+"/"+tagName; final String value = childElement.getFirstChild().getNodeValue(); // propertyElementsMap.put(key, childElement); // propertyElementsMap.put(key, value); aXml.addToPropertyElementsMap(tagName, value); InkMLDOMParser.LOG .finer("The property with name = " + tagName + " is added to the propertyElementsMap."); } } return aXml; }
From source file:eu.semaine.util.XMLTool.java
/** * Create an XML document from the given XPath expression. * The given string is interpreted as a limited subset of XPath expressions and split into parts. * Each part except the last one is expected to follow precisely the following form: * <code>"/" ( prefix ":" ) ? localname ( "[" "@" attName "=" "'" attValue "'" "]" ) ?</code> * The last part must be either/*from w ww . j av a2 s . co m*/ * <code> "/" "text()"</code> * or * </code> "/" "@" attributeName </code>. * @param xpathExpression an xpath expression from which the given document can be created. must not be null. * @param value the value to insert at the location identified by the xpath expression. if this is null, the empty string is added. * @param namespaceContext the namespace context to use for resolving namespace prefixes. * If this is null, the namespace context returned by {@link #getDefaultNamespaceContext()} will be used. * @param document if not null, the xpath expression + value pair will be added to the document. * If null, a new document will be created from the xpathExpression and value pair. * @return a document containing the given information * @throws NullPointerException if xpathExpression is null. * @throws IllegalArgumentException if the xpath expression is not valid, or if the xpath expression is incompatible with the given document (e.g., different root node) */ public static Document xpath2doc(String xpathExpression, String value, NamespaceContext namespaceContext, Document document) throws NullPointerException, IllegalArgumentException { if (xpathExpression == null) { throw new NullPointerException("null argument"); } if (value == null) { value = ""; } if (namespaceContext == null) { namespaceContext = getDefaultNamespaceContext(); } String[][] parts = splitXPathIntoParts(xpathExpression); Element currentElt = null; for (int i = 0; i < parts.length - 1; i++) { String[] part = parts[i]; assert part != null; assert part.length == 4; String prefix = part[0]; String localName = part[1]; String attName = part[2]; String attValue = part[3]; String namespaceURI = prefix != null ? namespaceContext.getNamespaceURI(prefix) : null; if (prefix != null && namespaceURI.equals("")) { throw new IllegalArgumentException("Unknown prefix: " + prefix); } // Now traverse to or create element defined by prefix, localName and namespaceURI if (currentElt == null) { // at top level if (document == null) { // create a new document try { document = XMLTool.newDocument(localName, namespaceURI); } catch (DOMException de) { throw new IllegalArgumentException("Cannot create document for localname '" + localName + "' and namespaceURI '" + namespaceURI + "'", de); } currentElt = document.getDocumentElement(); currentElt.setPrefix(prefix); } else { currentElt = document.getDocumentElement(); if (!currentElt.getLocalName().equals(localName)) { throw new IllegalArgumentException( "Incompatible root node specification: expression requests '" + localName + "', but document already has '" + currentElt.getLocalName() + "'!"); } String currentNamespaceURI = currentElt.getNamespaceURI(); if (!(currentNamespaceURI == null && namespaceURI == null || currentNamespaceURI != null && currentNamespaceURI.equals(namespaceURI))) { throw new IllegalArgumentException( "Incompatible root namespace specification: expression requests '" + namespaceURI + "', but document already has '" + currentNamespaceURI + "'!"); } } } else { // somewhere in the tree // First check if the requested child already exists List<Element> sameNameChildren = XMLTool.getChildrenByLocalNameNS(currentElt, localName, namespaceURI); boolean found = false; if (attName == null) { if (sameNameChildren.size() > 0) { currentElt = sameNameChildren.get(0); found = true; } } else { for (Element c : sameNameChildren) { if (c.hasAttribute(attName)) { if (attValue == null || attValue.equals(c.getAttribute(attName))) { currentElt = c; found = true; break; } } } } if (!found) { // need to create it currentElt = XMLTool.appendChildElement(currentElt, localName, namespaceURI); if (prefix != null) currentElt.setPrefix(prefix); if (attName != null) { currentElt.setAttribute(attName, attValue != null ? attValue : ""); } } } } if (currentElt == null) { throw new IllegalArgumentException( "No elements or no final part created from XPath expression '" + xpathExpression + "'"); } String[] lastPart = parts[parts.length - 1]; assert lastPart.length <= 1; if (lastPart.length == 0) { // text content of the given node currentElt.setTextContent(value); } else { String attName = lastPart[0]; currentElt.setAttribute(attName, value); } return document; }
From source file:org.apache.taverna.scufl2.translator.t2flow.T2FlowParser.java
public void parseAnnotations(WorkflowBean annotatedBean, Annotations annotations) throws ReaderException { // logger.fine("Checking annotations for " + annotatedSubject); Map<String, NetSfTavernaT2AnnotationAnnotationAssertionImpl> annotationElems = new HashMap<>(); if (annotations == null || annotations.getAnnotationChainOrAnnotationChain22() == null) return;/*from w w w . java 2 s .c o m*/ for (JAXBElement<AnnotationChain> el : annotations.getAnnotationChainOrAnnotationChain22()) { NetSfTavernaT2AnnotationAnnotationAssertionImpl ann = el.getValue() .getNetSfTavernaT2AnnotationAnnotationChainImpl().getAnnotationAssertions() .getNetSfTavernaT2AnnotationAnnotationAssertionImpl(); String annClass = ann.getAnnotationBean().getClazz(); if (annotationElems.containsKey(annClass) && annotationElems.get(annClass).getDate().compareToIgnoreCase(ann.getDate()) > 0) // ann.getDate() is less than current 'latest' annotation, skip continue; annotationElems.put(annClass, ann); } for (String clazz : annotationElems.keySet()) { NetSfTavernaT2AnnotationAnnotationAssertionImpl ann = annotationElems.get(clazz); Calendar cal = parseDate(ann.getDate()); String value = null; String semanticMediaType = TEXT_TURTLE; for (Object obj : ann.getAnnotationBean().getAny()) { if (!(obj instanceof Element)) continue; Element elem = (Element) obj; if (!(elem.getNamespaceURI() == null)) continue; if (elem.getLocalName().equals("text")) { value = elem.getTextContent().trim(); break; } if (clazz.equals(SEMANTIC_ANNOTATION)) { if (elem.getLocalName().equals("content")) value = elem.getTextContent().trim(); if (elem.getLocalName().equals("mimeType")) semanticMediaType = elem.getTextContent().trim(); } } if (value != null) { // Add the annotation Annotation annotation = new Annotation(); WorkflowBundle workflowBundle = parserState.get().getCurrentWorkflowBundle(); annotation.setParent(workflowBundle); String path = "annotation/" + annotation.getName() + ".ttl"; URI bodyURI = URI.create(path); annotation.setTarget(annotatedBean); annotation.setAnnotatedAt(cal); // annotation.setAnnotator(); annotation.setSerializedBy(t2flowParserURI); annotation.setSerializedAt(new GregorianCalendar()); URI annotatedSubject = uriTools.relativeUriForBean(annotatedBean, annotation); String body; if (clazz.equals(SEMANTIC_ANNOTATION)) { String baseStr = "@base <" + annotatedSubject.toASCIIString() + "> .\n"; body = baseStr + value; } else { // Generate Turtle from 'classic' annotation URI predicate = getPredicatesForClass().get(clazz); if (predicate == null) { if (isStrict()) throw new ReaderException("Unsupported annotation class " + clazz); return; } StringBuilder turtle = new StringBuilder(); turtle.append("<"); turtle.append(annotatedSubject.toASCIIString()); turtle.append("> "); turtle.append("<"); turtle.append(predicate.toASCIIString()); turtle.append("> "); // A potentially multi-line string turtle.append("\"\"\""); // Escape existing \ to \\ String escaped = value.replace("\\", "\\\\"); // Escape existing " to \" (beware Java's escaping of \ and " below) escaped = escaped.replace("\"", "\\\""); turtle.append(escaped); turtle.append("\"\"\""); turtle.append(" ."); body = turtle.toString(); } try { workflowBundle.getResources().addResource(body, path, semanticMediaType); } catch (IOException e) { throw new ReaderException("Could not store annotation body to " + path, e); } annotation.setBody(bodyURI); } } }
From source file:com.silverwrist.venice.std.TrackbackManager.java
/** * Loads the HTTP content at the specified URL, scans it for RDF description blocks, and adds those blocks * as {@link com.silverwrist.venice.std.TrackbackItem TrackbackItem}s to our internal cache. Uses modification * detection to keep from reloading a page unless necessary. * * @param url The URL of the resource to be loaded. * @param attrs The attributes of the specified page; if this is <code>null</code>, we'll check the page * cache for the right attributes. * @return <code>true</code> if the page data was loaded and scanned for trackback items; <code>false</code> * if no data was loaded (because it was not modified since the last time we loaded it, for instance). * @exception com.silverwrist.venice.except.TrackbackException If there was an error loading or interpreting * the page data.//from w w w . ja va2 s . c o m */ private synchronized boolean load(URL url, PageAttributes attrs) throws TrackbackException { if (attrs == null) attrs = (PageAttributes) (m_page_cache.get(url)); // Create the GET method and set its headers. String s = url.toString(); int x = s.lastIndexOf('#'); if (x >= 0) s = s.substring(0, x); GetMethod getter = new GetMethod(s); HttpMethodParams params = getter.getParams(); getter.setDoAuthentication(false); getter.setFollowRedirects(true); getter.setRequestHeader("User-Agent", USER_AGENT); getter.setRequestHeader("Accept", "text/*"); getter.setRequestHeader("Accept-Encoding", "identity"); params.setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler()); getter.setParams(params); boolean get_resp = false; PageAttributes newattrs = null; ContentType ctype = null; byte[] rawdata = null; try { // set the Last-Modified date as an If-Modified-Since header on the request java.util.Date lmod = null; if (attrs != null) lmod = attrs.getLastModified(); if (lmod != null) getter.setRequestHeader("If-Modified-Since", s_httpdate_format.format(lmod)); // execute the Get method! int rc = m_http_client.executeMethod(getter); get_resp = true; if ((lmod != null) && (rc == HttpStatus.SC_NOT_MODIFIED)) return false; // we were not modified if (rc == HttpStatus.SC_NO_CONTENT) return false; // there's no content there if (rc != HttpStatus.SC_OK) // this is farked! throw new TrackbackException("GET of " + url + " returned " + rc); // Get the new page attributes and save them off. newattrs = new PageAttributes(getter); m_page_cache.put(url, newattrs); // Get the Content-Type header and see if it's valid. Header hdr = getter.getResponseHeader("Content-Type"); if (hdr != null) s = hdr.getValue(); else s = "text/plain"; // necessary assumption ctype = new ContentType(s); if (!(ctype.getPrimaryType().equals("text"))) throw new TrackbackException("URL " + url + " does not point to a text-based resource"); // Load the resource in as byte data; we will determine the right character set for it later. rawdata = getter.getResponseBody(); get_resp = false; } // end try catch (IOException e) { // IO error getting the page throw new TrackbackException("I/O error retrieving " + url + ": " + e.getMessage(), e); } // end catch catch (javax.mail.internet.ParseException e) { // translate into TrackbackException throw new TrackbackException("invalid Content-Type received for URL " + url, e); } // end catch finally { // release the connection if possible try { // need to get the message body if (get_resp) getter.getResponseBody(); } // end try catch (IOException e) { // ignore these } // end catch getter.releaseConnection(); } // end finally // make a first guess at the charset from the HTTP header Content-Type String cset = ctype.getParameter("charset"); if (cset == null) cset = "US-ASCII"; String content = null; try { // interpret the content content = new String(rawdata, cset); } // end try catch (UnsupportedEncodingException e) { // fall back and try just using US-ASCII cset = null; try { // interpret the content content = new String(rawdata, "US-ASCII"); } // end try catch (UnsupportedEncodingException e2) { // can't happen logger.debug("WTF? US-ASCII should damn well be a supported character set!", e2); } // end catch } // end catch // Look for <META HTTP-EQUIV=...> tags in the content. Map http_attrs = extractHttpEquivTags(content); // Try to get a Content-Type attribute from there. s = (String) (http_attrs.get("CONTENT-TYPE")); String cset2 = null; if (s != null) { // look for the content type try { // parse into Content-Type ContentType c = new ContentType(s); if (c.getPrimaryType().equals("text")) cset2 = c.getParameter("charset"); } // end try catch (javax.mail.internet.ParseException e) { // can't get a second Content-Type logger.debug("parse of Content-Type from META tags failed", e); cset2 = null; } // end catch } // end if if ((cset == null) && (cset2 == null)) throw new TrackbackException("unable to determine character set for " + url); if ((cset2 != null) && ((cset == null) || !(cset.equalsIgnoreCase(cset2)))) { // reinterpret content in new character set try { // reinterpret content in new character set s = new String(rawdata, cset2); content = s; // the contents of the HTTP-EQUIV tags may have changed as a result http_attrs = extractHttpEquivTags(content); } // end try catch (UnsupportedEncodingException e) { // just use original character set if (cset == null) throw new TrackbackException("unable to determine character set for " + url); } // end catch } // end if newattrs.updateFromPage(http_attrs); // update the page attributes from the META tag data // Search the page content for RDF blocks. RE m = new RE(s_rdf_start, RE.MATCH_NORMAL); int pos = 0; while (m.match(content, pos)) { // look for the end of this RDF block RE m2 = new RE(getEndRecognizer(m.getParen(1)), RE.MATCH_NORMAL); if (m2.match(content, m.getParenEnd(0))) { // we now have a block to feed to the XML parser try { // run the block through the XML parser InputSource isrc = new InputSource( new StringReader(content.substring(m.getParenStart(0), m2.getParenEnd(0)))); Document doc = m_rdf_parser.parse(isrc); // examine topmost element, which should be rdf:RDF Element root = doc.getDocumentElement(); if (NS_RDF.equals(root.getNamespaceURI()) && (root.getLocalName() != null) && root.getLocalName().equals("RDF")) { // this is most definitely an rdf:RDF node...look for rdf:Description nodes under it NodeList nl = root.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { // check each node in the list Node n = nl.item(i); if ((n.getNodeType() == Node.ELEMENT_NODE) && NS_RDF.equals(n.getNamespaceURI()) && (n.getLocalName() != null) && n.getLocalName().equals("Description")) { // we've got an rdf:Description node...extract the attributes from it Element elt = (Element) n; try { // look for the item and trackback URLs URL item = null, trackback = null; s = elt.getAttributeNS(NS_DC, "identifier"); if ((s != null) && (s.length() > 0)) item = new URL(s); s = elt.getAttributeNS(NS_TRACKBACK, "ping"); if ((s != null) && (s.length() > 0)) trackback = new URL(s); if ((item != null) && (trackback != null)) { // create the item s = elt.getAttributeNS(NS_DC, "title"); m_item_cache.put(item, new MyTrackbackItem(item, trackback, s, newattrs)); } // end if } // end try catch (MalformedURLException e) { // this means skip this item logger.warn("URL parse failure", e); } // end catch } // end if } // end for } // end if } // end try catch (IOException e) { // disregard this block logger.warn("RDF block parse failure", e); } // end catch catch (SAXException e) { // disregard this block logger.warn("RDF block parse failure", e); } // end catch } // end if // else ignore this possible block pos = m.getParenEnd(0); } // end while return true; }
From source file:de.betterform.xml.xforms.model.Model.java
/** * @return/* w w w .j a v a 2 s . c o m*/ */ private List<Element> getAllInstanceElements() { List<Element> result = new ArrayList<Element>(); for (Node it = getElement().getFirstChild(); it != null; it = it.getNextSibling()) { if (it.getNodeType() != Node.ELEMENT_NODE) { continue; } Element el = (Element) it; if (NamespaceConstants.XFORMS_NS.equals(it.getNamespaceURI()) && XFormsConstants.INSTANCE.equals(el.getLocalName())) { result.add(el); } } return result; }