public static void streamNullDocument(ContentHandler contentHandler) throws SAXException { contentHandler.startDocument(); contentHandler.startPrefixMapping(XMLConstants.XSI_PREFIX, XMLConstants.XSI_URI); final AttributesImpl attributes = new AttributesImpl(); attributes.addAttribute(XMLConstants.XSI_URI, "nil", "xsi:nil", "CDATA", "true"); contentHandler.startElement("", "null", "null", attributes); contentHandler.endElement("", "null", "null"); contentHandler.endPrefixMapping(XMLConstants.XSI_PREFIX); contentHandler.endDocument(); }
/** * This will invoke the <code>endElement</code> callback in the <code>ContentHandler</code>. * * @param element <code>Element</code> used in callbacks. */ private void endElement(Element element) throws JDOMException { String namespaceURI = element.getNamespaceURI(); String localName = element.getName(); String rawName = element.getQualifiedName(); try { contentHandler.endElement(namespaceURI, localName, rawName); } catch (SAXException se) { throw new JDOMException("Exception in endElement", se); } }