Refine search
receiver.startPrefixMapping( "", a.getValue() ); } else { String localName = a.getLocalName(); receiver.startPrefixMapping( localName, a.getValue() ); String qname = e.getTagName(); if(local==null) local = qname; receiver.startElement( uri, local, qname, atts );
public void endStartTag() throws SAXException { NamespaceContextImpl.Element ns = nsContext.getCurrent(); if(ns!=null) { int sz = ns.count(); for( int i=0; i<sz; i++ ) { String p = ns.getPrefix(i); String uri = ns.getNsUri(i); if(uri.length()==0 && ns.getBase()==1) continue; // no point in defining xmlns='' on the root out.startPrefixMapping(p,uri); } } out.startElement(elementNsUri,elementLocalName,elementQName,atts); }
/** * Writes the angle bracket if the element open tag is not finished. * * @throws SAXException If thrown by the content handler */ private void deNude() throws SAXException { if (this.isNude) { indent(); Element elt = peekElement(); // report the prefix mapping if (elt.mappings != null) { for (int i = 0; i < elt.mappings.size(); i++) { PrefixMapping pm = elt.mappings.get(i); this.handler.startPrefixMapping(pm.prefix, pm.uri); } } this.handler.startElement(elt.uri, elt.name, getQName(elt.uri, elt.name), this.attributes); this.attributes = new AttributesImpl(); if (this.indent && elt.hasChildren) { newLine(); } this.isNude = false; } }
@Test public void marshalSAXResult() throws Exception { ContentHandler contentHandler = mock(ContentHandler.class); SAXResult result = new SAXResult(contentHandler); marshaller.marshal(flights, result); InOrder ordered = inOrder(contentHandler); ordered.verify(contentHandler).setDocumentLocator(isA(Locator.class)); ordered.verify(contentHandler).startDocument(); ordered.verify(contentHandler).startPrefixMapping("", "http://samples.springframework.org/flight"); ordered.verify(contentHandler).startElement(eq("http://samples.springframework.org/flight"), eq("flights"), eq("flights"), isA(Attributes.class)); ordered.verify(contentHandler).startElement(eq("http://samples.springframework.org/flight"), eq("flight"), eq("flight"), isA(Attributes.class)); ordered.verify(contentHandler).startElement(eq("http://samples.springframework.org/flight"), eq("number"), eq("number"), isA(Attributes.class)); ordered.verify(contentHandler).characters(isA(char[].class), eq(0), eq(2)); ordered.verify(contentHandler).endElement("http://samples.springframework.org/flight", "number", "number"); ordered.verify(contentHandler).endElement("http://samples.springframework.org/flight", "flight", "flight"); ordered.verify(contentHandler).endElement("http://samples.springframework.org/flight", "flights", "flights"); ordered.verify(contentHandler).endPrefixMapping(""); ordered.verify(contentHandler).endDocument(); }
if (contentHandler != null) { attAdapter.setAttributeList(qAtts); contentHandler.startElement("", "", qName.intern(), attAdapter); contentHandler.startPrefixMapping(prefix, value); contentHandler.startElement(name[0], name[1], name[2], atts);
if (prefix==null) prefix=""; this.m_contentHandler.startPrefixMapping(prefix,uri); prefix = attrName.substring(colon + 1); this.m_contentHandler.startPrefixMapping(prefix, attr.getNodeValue()); String uri = attr.getNamespaceURI(); if (uri != null) this.m_contentHandler.startPrefixMapping(prefix,uri); if(null == ns) ns = ""; this.m_contentHandler.startElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName(),
if (prefix==null) prefix=""; this.m_contentHandler.startPrefixMapping(prefix,uri); prefix = attrName.substring(colon + 1); this.m_contentHandler.startPrefixMapping(prefix, attr.getNodeValue()); String uri = attr.getNamespaceURI(); if (uri != null) this.m_contentHandler.startPrefixMapping(prefix,uri); if(null == ns) ns = ""; this.m_contentHandler.startElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName(),
? "" : attrName.substring(index + 1); this.m_contentHandler.startPrefixMapping(prefix, attr.getNodeValue()); if(null == ns) ns = ""; this.m_contentHandler.startElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName(),
? "" : attrName.substring(index + 1); this.m_contentHandler.startPrefixMapping(prefix, attr.getNodeValue()); if(null == ns) ns = ""; this.m_contentHandler.startElement(ns, m_dh.getLocalNameOfNode(node), node.getNodeName(),
handler.startPrefixMapping(W3C_XML_SCHEMA_INSTANCE_PREFIX, W3C_XML_SCHEMA_INSTANCE_NS_URI); addAttribute(atts, W3C_XML_SCHEMA_INSTANCE_PREFIX, W3C_XML_SCHEMA_INSTANCE_ATTRIBUTE_SCHEMA_LOCATION, handler.startPrefixMapping(XmlConstants.DEFAULT_PREFIX, version.getNamespace()); addAttribute(atts, VERSION, this.version.getVersion()); handler.startElement("", CLIENT_CACHE, CLIENT_CACHE, atts); } else { handler.startElement("", CACHE, CACHE, atts);
this.m_contentHandler.startPrefixMapping(prefix, dtm.getNodeValue(nsn)); this.m_contentHandler.startElement(ns, m_dtm.getLocalName(node), m_dtm.getNodeName(node),
this.m_contentHandler.startPrefixMapping(prefix, dtm.getNodeValue(nsn)); this.m_contentHandler.startElement(ns, m_dtm.getLocalName(node), m_dtm.getNodeName(node),
receiver.startPrefixMapping( "", a.getValue() ); } else { String localName = a.getLocalName(); receiver.startPrefixMapping( localName, a.getValue() ); String qname = e.getTagName(); if(local==null) local = qname; receiver.startElement( uri, local, qname, atts );
public void endStartTag() throws SAXException { NamespaceContextImpl.Element ns = nsContext.getCurrent(); if(ns!=null) { int sz = ns.count(); for( int i=0; i<sz; i++ ) { String p = ns.getPrefix(i); String uri = ns.getNsUri(i); if(uri.length()==0 && ns.getBase()==1) continue; // no point in defining xmlns='' on the root out.startPrefixMapping(p,uri); } } out.startElement(elementNsUri,elementLocalName,elementQName,atts); }
@Override public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException { handler.startDocument(); handler.startPrefixMapping("", XHTML); handler.startElement(XHTML, "html", "html", EMPTY_ATTRIBUTES); handler.startElement(XHTML, "head", "head", EMPTY_ATTRIBUTES); handler.startElement(XHTML, "title", "head", EMPTY_ATTRIBUTES); handler.characters(TITLE, 0, TITLE.length); handler.endElement(XHTML, "title", "head"); handler.endElement(XHTML, "head", "head"); handler.startElement(XHTML, "body", "body", EMPTY_ATTRIBUTES); char[] body = new char[charsToWrite]; for (int i = 0; i < charsToWrite; i++) { body[i] = 'a'; } handler.characters(body, 0, body.length); handler.endElement(XHTML, "body", "body"); handler.endElement(XHTML, "html", "html"); handler.endDocument(); } }
public void fireSaxStartElement(ContentHandler h, Attributes attrs) throws SAXException { if (h != null) { // First; any ns declarations? int nsCount = mElementStack.getCurrentNsCount(); for (int i = 0; i < nsCount; ++i) { String prefix = mElementStack.getLocalNsPrefix(i); String uri = mElementStack.getLocalNsURI(i); h.startPrefixMapping((prefix == null) ? "" : prefix, uri); } // Then start-elem event itself: String uri = mElementStack.getNsURI(); // Sax requires "" (not null) for ns uris... h.startElement((uri == null) ? "" : uri, mElementStack.getLocalName(), getPrefixedName(), attrs); } }
handler.endDocument(); } else if (type == ContentHandlerProxy.START_PREFIX_MAPPING) { handler.startPrefixMapping(readString(input), readString(input)); } else if (type == ContentHandlerProxy.END_PREFIX_MAPPING) { handler.endPrefixMapping(readString(input)); handler.startElement(uri, localName, qName, atts); } else if (type == ContentHandlerProxy.END_ELEMENT) { String uri = readString(input);
/** * Private method generating startElement event for the aggregated parts * and the root element */ private void startElem(Element element) throws SAXException { final String qname = (element.prefix.equals("")) ? element.name : element.prefix + ':' + element.name; if (!element.namespace.equals("")) { this.contentHandler.startPrefixMapping(element.prefix, element.namespace); } this.contentHandler.startElement(element.namespace, element.name, qname, XMLUtils.EMPTY_ATTRIBUTES); }
public void writeTo(ContentHandler h, ErrorHandler errorHandler) throws SAXException { String nsUri = av.nsUri; String ln = av.faultDetailTag.getLocalPart(); h.startPrefixMapping("",nsUri); h.startElement(nsUri,ln,ln,EMPTY_ATTS); h.startElement(nsUri,wrapper,wrapper,EMPTY_ATTS); h.characters(problemValue.toCharArray(),0,problemValue.length()); h.endElement(nsUri,wrapper,wrapper); h.endElement(nsUri,ln,ln); } }
handler.startPrefixMapping((String) saxEvent.getParm(0), (String) saxEvent.getParm(1)); handler.startElement((String) saxEvent.getParm(0), (String) saxEvent.getParm(1), (String) saxEvent .getParm(2), attributes);