Ejemplo n.º 1
0
 public void endElement(String nm, String ln, String qn) throws SAXException {
   if (stack.empty()) throw new SAXException("Ill-formed XML elements: " + qn);
   Union v = stack.pop();
   if (!((MR_string) ((Tuple) v.value()).get(0)).get().equals(qn))
     throw new SAXException("Unmatched tags in XML element: " + qn);
   children = (Bag) ((Tuple) stack.peek().value()).get(2);
   children.add(v);
 }
Ejemplo n.º 2
0
 public void startElement(String nm, String ln, String qn, Attributes as) throws SAXException {
   children = new Bag();
   Bag attributes = new Bag();
   for (int i = 0; i < as.getLength(); i++)
     attributes.add(new Tuple(new MR_string(as.getQName(i)), new MR_string(as.getValue(i))));
   Tuple t = new Tuple(3);
   t.set(0, new MR_string(qn));
   t.set(1, attributes);
   t.set(2, children);
   stack.push(new Union((byte) 0, t));
 }
Ejemplo n.º 3
0
 public void characters(char[] text, int start, int length) throws SAXException {
   String s = new String(text, start, length);
   if (s.startsWith("{{") && s.endsWith("}}"))
     children.add(new MR_variable(Integer.parseInt(s.substring(2, s.length() - 2))));
   else children.add(new Union((byte) 1, new MR_string(s)));
 }