private void parse(final StreamTokenizer tokeniser, Reader in, final ContentHandler handler) throws IOException, ParseException, URISyntaxException, ParserException { assertToken(tokeniser, in, ':'); assertToken(tokeniser, in, StreamTokenizer.TT_WORD); final String name = tokeniser.sval; handler.startComponent(name); assertToken(tokeniser, in, StreamTokenizer.TT_EOL); propertyListParser.parse(tokeniser, in, handler); /* * // a special case for VTIMEZONE component which contains * // sub-components.. * if (Component.VTIMEZONE.equals(name)) { * parseComponentList(tokeniser, handler); * } * // VEVENT/VTODO components may optionally have embedded VALARM * // components.. * else if ((Component.VEVENT.equals(name) || Component.VTODO.equals(name)) * && Component.BEGIN.equals(tokeniser.sval)) { * parseComponentList(tokeniser, handler); * } */ assertToken(tokeniser, in, ':'); assertToken(tokeniser, in, name); assertToken(tokeniser, in, StreamTokenizer.TT_EOL); handler.endComponent(name); } }
handler.startCalendar(); handler.startProperty(Property.VERSION); try { handler.propertyValue(Version.VERSION_2_0.getValue()); } catch (URISyntaxException | ParseException | IOException e) { LOG.warn("", e); handler.endProperty(Property.VERSION); handler.endCalendar();
handler.parameter(paramName, paramValue.toString()); } catch (ClassCastException cce) { throw new ParserException("Error parsing parameter", getLineNumber(tokeniser, in), cce);
handler.startProperty(name); handler.propertyValue(value.toString()); } catch (ParseException e) { final ParseException eNew = new ParseException("[" + name + "] " handler.endProperty(name);
handler.startProperty(propName); handler.parameter(Parameter.VALUE, Value.DATE.getValue()); } catch (URISyntaxException e) { LOG.warn("", e); if (! StringUtils.isBlank(lang)) { try { handler.parameter(Parameter.LANGUAGE, lang); } catch (Exception e) { LOG.warn("", e); handler.propertyValue(value); } catch (URISyntaxException e) { throw new ParserException("Malformed URI value for element '" + className + "'", -1, e); handler.endProperty(propName);
private void processProperty(final Element el, final BuildState bs) throws ParserException { try { bs.getContentHandler().startProperty(el.getLocalName()); for (Element e: XmlUtil.getElements(el)) { if (XmlUtil.nodeMatches(e, XcalTags.parameters)) { for (Element par: XmlUtil.getElements(e)) { bs.getContentHandler().parameter(par.getLocalName(), XmlUtil.getElementContent(par)); } } if (!processValue(e, bs)) { throw new ParserException("Bad property " + el, 0); } } bs.getContentHandler().endProperty(el.getLocalName()); } catch (SAXException e) { throw new ParserException(e.getMessage(), 0, e); } catch (URISyntaxException e) { throw new ParserException(e.getMessage(), 0, e); } }
/** * Parses an iCalendar VCALENDAR from the specified stream tokeniser. * * @param tokeniser * @param in * @param handler * @throws IOException * @throws ParseException * @throws URISyntaxException * @throws ParserException */ private void parseCalendar(final StreamTokenizer tokeniser, Reader in, final ContentHandler handler) throws IOException, ParseException, URISyntaxException, ParserException { assertToken(tokeniser, in, ':'); assertToken(tokeniser, in, Calendar.VCALENDAR, true, false); assertToken(tokeniser, in, StreamTokenizer.TT_EOL); handler.startCalendar(); // parse calendar properties.. propertyListParser.parse(tokeniser, in, handler); // parse components.. componentListParser.parse(tokeniser, in, handler); // END:VCALENDAR // assertToken(tokeniser,Calendar.END); assertToken(tokeniser, in, ':'); assertToken(tokeniser, in, Calendar.VCALENDAR, true, false); handler.endCalendar(); } /**
private void processProperty(final JsonParser parser, final BuildState bs) throws ParserException { /* Each individual iCalendar property is represented in jCal by an array with three fixed elements, followed by at one or more additional elements, depending on if the property is a multi-value property as described in Section 3.1.2 of [RFC5545]. The array consists of the following fixed elements: 1. The name of the property as a string, but in lowercase. 2. An object containing the parameters as described in Section 3.5. 3. The type identifier string of the value, in lowercase. The remaining elements of the array are used for the value of the property. For single-value properties, the array MUST have exactly four elements, for multi-valued properties as described in Section 3.4.1.1 there can be any number of additional elements. array start should be current token */ currentArrayStart(parser); final String name = textField(parser); lastProperty = name; bs.getContentHandler().startProperty(name); processParameters(parser, bs); final boolean parseArrayEnd = processValue(parser, bs, textField(parser)); bs.getContentHandler().endProperty(name); if (parseArrayEnd) { arrayEnd(parser); } }
private void processVcalendar(final JsonParser parser, final BuildState bs) throws ParserException { bs.getContentHandler().startCalendar(); /* Properties first */ processProperties(parser, bs); /* Now components */ processCalcomps(parser, bs); }
private void propVal(final BuildState bs, final String val) throws Throwable { bs.getContentHandler().propertyValue(val); }
handler.startProperty(propName); handler.parameter(Parameter.VALUE, Value.DATE.getValue()); } catch (Exception e) { if (!StringUtils.isBlank(lang)) try { handler.parameter(Parameter.LANGUAGE, lang); } catch (Exception e) { handler.propertyValue(value); } catch (URISyntaxException e) { throw new ParserException("Malformed URI value for element '" + className + "'", -1, e); handler.endProperty(propName);
handler.startProperty(name); handler.propertyValue(value.toString()); handler.endProperty(name);
bs.getContentHandler().startProperty(name); bs.getContentHandler().parameter(parName, getParValue(e.getValue())); bs.getContentHandler().endProperty(name);
/** * Parses an iCalendar VCALENDAR from the specified stream tokeniser. * * @param tokeniser * @param in * @param handler * @throws IOException * @throws ParseException * @throws URISyntaxException * @throws ParserException */ private void parseCalendar(final StreamTokenizer tokeniser, Reader in, final ContentHandler handler) throws IOException, ParseException, URISyntaxException, ParserException { assertToken(tokeniser, in, ':'); assertToken(tokeniser, in, Calendar.VCALENDAR, true, false); assertToken(tokeniser, in, StreamTokenizer.TT_EOL); handler.startCalendar(); // parse calendar properties.. propertyListParser.parse(tokeniser, in, handler); // parse components.. componentListParser.parse(tokeniser, in, handler); // END:VCALENDAR // assertToken(tokeniser,Calendar.END); assertToken(tokeniser, in, ':'); assertToken(tokeniser, in, Calendar.VCALENDAR, true, false); handler.endCalendar(); } /**
private void processVcalendar(final VcalendarType vcal, final BuildState bs) throws Throwable { bs.getContentHandler().startCalendar(); processProperties(vcal.getProperties(), bs); processCalcomps(vcal, bs); }
bs.getContentHandler().propertyValue(sb.toString()); bs.getContentHandler().propertyValue(sb.toString()); bs.getContentHandler().propertyValue(sb.toString()); bs.getContentHandler().propertyValue(String.valueOf( booleanField(parser))); bs.getContentHandler().propertyValue( XcalUtil.getIcalUtcOffset(textField(parser))); bs.getContentHandler().propertyValue(res.toString()); bs.getContentHandler().propertyValue(String.valueOf(intField( parser))); bs.getContentHandler().propertyValue(String.valueOf(intField( parser))); type.equals("date-time") || type.equals("time")) { bs.getContentHandler().propertyValue( XcalUtil.getIcalFormatDateTime(textField(parser))); return true; bs.getContentHandler().propertyValue( XcalUtil.getIcalFormatTime(textField(parser))); return true;
handler.startCalendar(); handler.startProperty(Property.VERSION); try { handler.propertyValue(Version.VERSION_2_0.getValue()); } catch (URISyntaxException | ParseException | IOException e) { LOG.warn("", e); handler.endProperty(Property.VERSION); handler.endCalendar();
handler.startProperty(propName); handler.parameter(Parameter.VALUE, Value.DATE.getValue()); } catch (URISyntaxException e) { LOG.warn("Caught exception", e); if (!StringUtils.isBlank(lang)) try { handler.parameter(Parameter.LANGUAGE, lang); } catch (URISyntaxException e) { LOG.warn("Caught exception", e); handler.propertyValue(value); handler.endProperty(propName); } catch (URISyntaxException e) { throw new ParserException("Malformed URI value for element '" + className + "'", -1, e);
private void parse(final StreamTokenizer tokeniser, Reader in, final ContentHandler handler) throws IOException, ParseException, URISyntaxException, ParserException { assertToken(tokeniser, in, ':'); assertToken(tokeniser, in, StreamTokenizer.TT_WORD); final String name = tokeniser.sval; handler.startComponent(name); assertToken(tokeniser, in, StreamTokenizer.TT_EOL); propertyListParser.parse(tokeniser, in, handler); /* * // a special case for VTIMEZONE component which contains * // sub-components.. * if (Component.VTIMEZONE.equals(name)) { * parseComponentList(tokeniser, handler); * } * // VEVENT/VTODO components may optionally have embedded VALARM * // components.. * else if ((Component.VEVENT.equals(name) || Component.VTODO.equals(name)) * && Component.BEGIN.equals(tokeniser.sval)) { * parseComponentList(tokeniser, handler); * } */ assertToken(tokeniser, in, ':'); assertToken(tokeniser, in, name); assertToken(tokeniser, in, StreamTokenizer.TT_EOL); handler.endComponent(name); } }
handler.startProperty(name); handler.propertyValue(value.toString()); } catch (ParseException e) { final ParseException eNew = new ParseException("[" + name + "] " handler.endProperty(name);