@Override public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName);
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); Element newEl = getInstance().getMetadata().createElementNS(uri, qName); for (int i = 0; i < attributes.getLength(); i++) { newEl.setAttributeNS( attributes.getURI(i), attributes.getQName(i), attributes.getValue(i) ); } current.appendChild(newEl); current = newEl; }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName);
@Override public void startElement(String uri, String localName, String qName, final Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); Map.Entry[] attributeMap = new Map.Entry[attributes.getLength()]; for (int i = 0; i < attributeMap.length; i++) { attributeMap[i] = new AbstractMap.SimpleEntry<>( attributes.getLocalName(i), attributes.getValue(i) ); } try { EventedValue esv = createValue(localName, attributeMap); if (esv != null) getInstance().getValues().add(esv); } catch (Exception ex) { // Don't exit, just log a warning log.warning("Error reading event XML, ignoring value: " + Exceptions.unwrap(ex)); } }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); if (!DIDLContent.NAMESPACE_URI.equals(uri)) return; if (localName.equals("container")) { Container container = createContainer(attributes); getInstance().addContainer(container); createContainerHandler(container, this); } else if (localName.equals("item")) { Item item = createItem(attributes); getInstance().addItem(item); createItemHandler(item, this); } else if (localName.equals("desc")) { DescMeta desc = createDescMeta(attributes); getInstance().addDescMetadata(desc); createDescMetaHandler(desc, this); } }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); Element newEl = getInstance().getMetadata().createElementNS(uri, qName); for (int i = 0; i < attributes.getLength(); i++) { newEl.setAttributeNS( attributes.getURI(i), attributes.getQName(i), attributes.getValue(i) ); } current.appendChild(newEl); current = newEl; }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); if (CONSTANTS.InstanceID.equals(localName)) { String valAttr = attributes.getValue(CONSTANTS.val.name()); if (valAttr != null) { InstanceID instanceID = new InstanceID(new UnsignedIntegerFourBytes(valAttr)); getInstance().getInstanceIDs().add(instanceID); new InstanceIDHandler(instanceID, this); } } } }
@Override public DescMeta<Document> getInstance() { return super.getInstance(); }
public Handler(I instance, Handler parent) { this(instance, parent.getParser(), parent); }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName); ELEMENT el = ELEMENT.valueOrNullOf(localName); if (el == null) return; endElement(el); }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); ELEMENT el = ELEMENT.valueOrNullOf(localName); if (el == null) return; startElement(el, attributes); }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); ELEMENT el = ELEMENT.valueOrNullOf(localName); if (el == null) return; startElement(el, attributes); }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName); if (isLastElement(uri, localName, qName)) return; // Ignore whitespace if (getCharacters().length() > 0 && !getCharacters().matches("[\\t\\n\\x0B\\f\\r\\s]+")) current.appendChild(getInstance().getMetadata().createTextNode(getCharacters())); current = (Element) current.getParentNode(); // Reset this so we can continue parsing child nodes with this handler characters = new StringBuilder(); attributes = null; }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName); getInstance().setValue(getCharacters()); }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName); ELEMENT el = ELEMENT.valueOrNullOf(localName); if (el == null) return; endElement(el); }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (isLastElement(uri, localName, qName)) { log.finer(getClass().getSimpleName() + ": last element, switching to parent: " + localName); switchToParent(); return; } log.finer(getClass().getSimpleName() + " ending: " + localName); }
@Override public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName);
@Override public void startElement(String uri, String localName, String qName, final Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); Map.Entry[] attributeMap = new Map.Entry[attributes.getLength()]; for (int i = 0; i < attributeMap.length; i++) { attributeMap[i] = new AbstractMap.SimpleEntry<String, String>( attributes.getLocalName(i), attributes.getValue(i) ); } try { EventedValue esv = createValue(localName, attributeMap); if (esv != null) getInstance().getValues().add(esv); } catch (Exception ex) { // Don't exit, just log a warning log.warning("Error reading event XML, ignoring value: " + Exceptions.unwrap(ex)); } }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); if (!DIDLContent.NAMESPACE_URI.equals(uri)) return; if (localName.equals("container")) { Container container = createContainer(attributes); getInstance().addContainer(container); createContainerHandler(container, this); } else if (localName.equals("item")) { Item item = createItem(attributes); getInstance().addItem(item); createItemHandler(item, this); } else if (localName.equals("desc")) { DescMeta desc = createDescMeta(attributes); getInstance().addDescMetadata(desc); createDescMetaHandler(desc, this); } }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { super.startElement(uri, localName, qName, attributes); if (CONSTANTS.InstanceID.equals(localName)) { String valAttr = attributes.getValue(CONSTANTS.val.name()); if (valAttr != null) { InstanceID instanceID = new InstanceID(new UnsignedIntegerFourBytes(valAttr)); getInstance().getInstanceIDs().add(instanceID); new InstanceIDHandler(instanceID, this); } } } }