Java Code Examples for org.xml.sax.ContentHandler#setDocumentLocator()
The following examples show how to use
org.xml.sax.ContentHandler#setDocumentLocator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractMessageImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Writes the whole envelope as SAX events. */ @Override public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException { String soapNsUri = soapVersion.nsUri; contentHandler.setDocumentLocator(NULL_LOCATOR); contentHandler.startDocument(); contentHandler.startPrefixMapping("S",soapNsUri); contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS); if(hasHeaders()) { contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(contentHandler,errorHandler); } contentHandler.endElement(soapNsUri,"Header","S:Header"); } // write the body contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS); writePayloadTo(contentHandler,errorHandler, true); contentHandler.endElement(soapNsUri,"Body","S:Body"); contentHandler.endElement(soapNsUri,"Envelope","S:Envelope"); }
Example 2
Source File: AbstractMessageImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Writes the whole envelope as SAX events. */ @Override public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException { String soapNsUri = soapVersion.nsUri; contentHandler.setDocumentLocator(NULL_LOCATOR); contentHandler.startDocument(); contentHandler.startPrefixMapping("S",soapNsUri); contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS); if(hasHeaders()) { contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(contentHandler,errorHandler); } contentHandler.endElement(soapNsUri,"Header","S:Header"); } // write the body contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS); writePayloadTo(contentHandler,errorHandler, true); contentHandler.endElement(soapNsUri,"Body","S:Body"); contentHandler.endElement(soapNsUri,"Envelope","S:Envelope"); }
Example 3
Source File: AbstractMessageImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Writes the whole envelope as SAX events. */ @Override public void writeTo( ContentHandler contentHandler, ErrorHandler errorHandler ) throws SAXException { String soapNsUri = soapVersion.nsUri; contentHandler.setDocumentLocator(NULL_LOCATOR); contentHandler.startDocument(); contentHandler.startPrefixMapping("S",soapNsUri); contentHandler.startElement(soapNsUri,"Envelope","S:Envelope",EMPTY_ATTS); if(hasHeaders()) { contentHandler.startElement(soapNsUri,"Header","S:Header",EMPTY_ATTS); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(contentHandler,errorHandler); } contentHandler.endElement(soapNsUri,"Header","S:Header"); } // write the body contentHandler.startElement(soapNsUri,"Body","S:Body",EMPTY_ATTS); writePayloadTo(contentHandler,errorHandler, true); contentHandler.endElement(soapNsUri,"Body","S:Body"); contentHandler.endElement(soapNsUri,"Envelope","S:Envelope"); }
Example 4
Source File: SAAJMessage.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException { String soapNsUri = soapVersion.nsUri; if (!parsedMessage) { DOMScanner ds = new DOMScanner(); ds.setContentHandler(contentHandler); ds.scan(sm.getSOAPPart()); } else { contentHandler.setDocumentLocator(NULL_LOCATOR); contentHandler.startDocument(); contentHandler.startPrefixMapping("S", soapNsUri); startPrefixMapping(contentHandler, envelopeAttrs,"S"); contentHandler.startElement(soapNsUri, "Envelope", "S:Envelope", getAttributes(envelopeAttrs)); if (hasHeaders()) { startPrefixMapping(contentHandler, headerAttrs,"S"); contentHandler.startElement(soapNsUri, "Header", "S:Header", getAttributes(headerAttrs)); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(contentHandler, errorHandler); } endPrefixMapping(contentHandler, headerAttrs,"S"); contentHandler.endElement(soapNsUri, "Header", "S:Header"); } startPrefixMapping(contentHandler, bodyAttrs,"S"); // write the body contentHandler.startElement(soapNsUri, "Body", "S:Body", getAttributes(bodyAttrs)); writePayloadTo(contentHandler, errorHandler, true); endPrefixMapping(contentHandler, bodyAttrs,"S"); contentHandler.endElement(soapNsUri, "Body", "S:Body"); endPrefixMapping(contentHandler, envelopeAttrs,"S"); contentHandler.endElement(soapNsUri, "Envelope", "S:Envelope"); } }
Example 5
Source File: ForkingFilter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Starts the event forking. */ public void startForking(String uri, String localName, String qName, Attributes atts, ContentHandler side) throws SAXException { if(this.side!=null) throw new IllegalStateException(); // can't fork to two handlers this.side = side; depth = 1; side.setDocumentLocator(loc); side.startDocument(); for( int i=0; i<namespaces.size(); i+=2 ) side.startPrefixMapping(namespaces.get(i),namespaces.get(i+1)); side.startElement(uri,localName,qName,atts); }
Example 6
Source File: SAAJMessage.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException { String soapNsUri = soapVersion.nsUri; if (!parsedMessage) { DOMScanner ds = new DOMScanner(); ds.setContentHandler(contentHandler); ds.scan(sm.getSOAPPart()); } else { contentHandler.setDocumentLocator(NULL_LOCATOR); contentHandler.startDocument(); contentHandler.startPrefixMapping("S", soapNsUri); startPrefixMapping(contentHandler, envelopeAttrs,"S"); contentHandler.startElement(soapNsUri, "Envelope", "S:Envelope", getAttributes(envelopeAttrs)); if (hasHeaders()) { startPrefixMapping(contentHandler, headerAttrs,"S"); contentHandler.startElement(soapNsUri, "Header", "S:Header", getAttributes(headerAttrs)); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(contentHandler, errorHandler); } endPrefixMapping(contentHandler, headerAttrs,"S"); contentHandler.endElement(soapNsUri, "Header", "S:Header"); } startPrefixMapping(contentHandler, bodyAttrs,"S"); // write the body contentHandler.startElement(soapNsUri, "Body", "S:Body", getAttributes(bodyAttrs)); writePayloadTo(contentHandler, errorHandler, true); endPrefixMapping(contentHandler, bodyAttrs,"S"); contentHandler.endElement(soapNsUri, "Body", "S:Body"); endPrefixMapping(contentHandler, envelopeAttrs,"S"); contentHandler.endElement(soapNsUri, "Envelope", "S:Envelope"); } }
Example 7
Source File: ForkingFilter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Starts the event forking. */ public void startForking(String uri, String localName, String qName, Attributes atts, ContentHandler side) throws SAXException { if(this.side!=null) throw new IllegalStateException(); // can't fork to two handlers this.side = side; depth = 1; side.setDocumentLocator(loc); side.startDocument(); for( int i=0; i<namespaces.size(); i+=2 ) side.startPrefixMapping(namespaces.get(i),namespaces.get(i+1)); side.startElement(uri,localName,qName,atts); }
Example 8
Source File: ForkingFilter.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Starts the event forking. */ public void startForking(String uri, String localName, String qName, Attributes atts, ContentHandler side) throws SAXException { if(this.side!=null) throw new IllegalStateException(); // can't fork to two handlers this.side = side; depth = 1; side.setDocumentLocator(loc); side.startDocument(); for( int i=0; i<namespaces.size(); i+=2 ) side.startPrefixMapping(namespaces.get(i),namespaces.get(i+1)); side.startElement(uri,localName,qName,atts); }
Example 9
Source File: SAAJMessage.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException { String soapNsUri = soapVersion.nsUri; if (!parsedMessage) { DOMScanner ds = new DOMScanner(); ds.setContentHandler(contentHandler); ds.scan(sm.getSOAPPart()); } else { contentHandler.setDocumentLocator(NULL_LOCATOR); contentHandler.startDocument(); contentHandler.startPrefixMapping("S", soapNsUri); startPrefixMapping(contentHandler, envelopeAttrs,"S"); contentHandler.startElement(soapNsUri, "Envelope", "S:Envelope", getAttributes(envelopeAttrs)); if (hasHeaders()) { startPrefixMapping(contentHandler, headerAttrs,"S"); contentHandler.startElement(soapNsUri, "Header", "S:Header", getAttributes(headerAttrs)); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(contentHandler, errorHandler); } endPrefixMapping(contentHandler, headerAttrs,"S"); contentHandler.endElement(soapNsUri, "Header", "S:Header"); } startPrefixMapping(contentHandler, bodyAttrs,"S"); // write the body contentHandler.startElement(soapNsUri, "Body", "S:Body", getAttributes(bodyAttrs)); writePayloadTo(contentHandler, errorHandler, true); endPrefixMapping(contentHandler, bodyAttrs,"S"); contentHandler.endElement(soapNsUri, "Body", "S:Body"); endPrefixMapping(contentHandler, envelopeAttrs,"S"); contentHandler.endElement(soapNsUri, "Envelope", "S:Envelope"); } }
Example 10
Source File: ForkContentHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public void setDocumentLocator(Locator locator) { ContentHandler[] arr$ = this.handlers; int len$ = arr$.length; for(int i$ = 0; i$ < len$; ++i$) { ContentHandler handler = arr$[i$]; handler.setDocumentLocator(locator); } }
Example 11
Source File: SAAJMessage.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void writeTo(ContentHandler contentHandler, ErrorHandler errorHandler) throws SAXException { String soapNsUri = soapVersion.nsUri; if (!parsedMessage) { DOMScanner ds = new DOMScanner(); ds.setContentHandler(contentHandler); ds.scan(sm.getSOAPPart()); } else { contentHandler.setDocumentLocator(NULL_LOCATOR); contentHandler.startDocument(); contentHandler.startPrefixMapping("S", soapNsUri); startPrefixMapping(contentHandler, envelopeAttrs,"S"); contentHandler.startElement(soapNsUri, "Envelope", "S:Envelope", getAttributes(envelopeAttrs)); if (hasHeaders()) { startPrefixMapping(contentHandler, headerAttrs,"S"); contentHandler.startElement(soapNsUri, "Header", "S:Header", getAttributes(headerAttrs)); MessageHeaders headers = getHeaders(); for (Header h : headers.asList()) { h.writeTo(contentHandler, errorHandler); } endPrefixMapping(contentHandler, headerAttrs,"S"); contentHandler.endElement(soapNsUri, "Header", "S:Header"); } startPrefixMapping(contentHandler, bodyAttrs,"S"); // write the body contentHandler.startElement(soapNsUri, "Body", "S:Body", getAttributes(bodyAttrs)); writePayloadTo(contentHandler, errorHandler, true); endPrefixMapping(contentHandler, bodyAttrs,"S"); contentHandler.endElement(soapNsUri, "Body", "S:Body"); endPrefixMapping(contentHandler, envelopeAttrs,"S"); contentHandler.endElement(soapNsUri, "Envelope", "S:Envelope"); } }
Example 12
Source File: ForkContentHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public void setDocumentLocator(Locator locator) { ContentHandler[] arr$ = this.handlers; int len$ = arr$.length; for(int i$ = 0; i$ < len$; ++i$) { ContentHandler handler = arr$[i$]; handler.setDocumentLocator(locator); } }
Example 13
Source File: ForkContentHandler.java From freehealth-connector with GNU Affero General Public License v3.0 | 5 votes |
public void setDocumentLocator(Locator locator) { ContentHandler[] arr$ = this.handlers; int len$ = arr$.length; for(int i$ = 0; i$ < len$; ++i$) { ContentHandler handler = arr$[i$]; handler.setDocumentLocator(locator); } }
Example 14
Source File: SAXOutput.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public SAXOutput(ContentHandler out) { this.out = out; out.setDocumentLocator(new LocatorImpl()); }
Example 15
Source File: SAXOutput.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public SAXOutput(ContentHandler out) { this.out = out; out.setDocumentLocator(new LocatorImpl()); }
Example 16
Source File: SAXOutput.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public SAXOutput(ContentHandler out) { this.out = out; out.setDocumentLocator(new LocatorImpl()); }
Example 17
Source File: XTMSnifferContentHandler.java From ontopia with Apache License 2.0 | 4 votes |
public void startElement_(String uri, String name, String qname, Attributes atts) throws SAXException { // The XTM 1.0 reader can handle XML files where the XTM 1.0 // content is wrapped in other XML content. We therefore need to // be able to pass by multiple elements before reaching the // topicMap element. ContentHandler outer_handler = null; if (XTMContentHandler.NS_XTM.equals(uri) || (uri.isEmpty() && "topicMap".equals(qname))) { // We are reading XTM 1.0. Update accordingly. handler1 = new XTMContentHandler(store_factory, base_address); handler1.setExternalReferenceHandler(reader.getExternalReferenceHandler()); handler1.register(parser); outer_handler = handler1; if (reader.getValidation()) { outer_handler = new XTMValidatingContentHandler(handler1); parser.setContentHandler(outer_handler); } // pass on events if (locator != null) outer_handler.setDocumentLocator(locator); Iterator it = entities.keySet().iterator(); while (it.hasNext()) { String ename = (String) it.next(); handler1.externalEntityDecl(ename, null, (String) entities.get(ename)); } outer_handler.startDocument(); for (int ix = 0; ix < stack_depth; ix++) // avoid EmptyStackException outer_handler.startElement(EMPTY_NAMESPACE, EMPTY_LOCALNAME, "fake-element", EMPTY_ATTS); outer_handler.startElement(uri, name, qname, atts); } else if (XTM2ContentHandler.NS_XTM2.equals(uri)) { // We are reading XTM 2.x. Update accordingly. handler2 = new XTM2ContentHandler(store_factory, base_address); parser.setContentHandler(handler2); outer_handler = handler2; if (reader.getValidation()) { outer_handler = new XTMValidatingContentHandler(handler2, XTMVersion.XTM_2_0); parser.setContentHandler(outer_handler); } if (locator != null) outer_handler.setDocumentLocator(locator); outer_handler.startDocument(); outer_handler.startElement(uri, name, qname, atts); } stack_depth++; }
Example 18
Source File: SAXOutput.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public SAXOutput(ContentHandler out) { this.out = out; out.setDocumentLocator(new LocatorImpl()); }
Example 19
Source File: SAXOutput.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public SAXOutput(ContentHandler out) { this.out = out; out.setDocumentLocator(new LocatorImpl()); }
Example 20
Source File: SAXOutput.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public SAXOutput(ContentHandler out) { this.out = out; out.setDocumentLocator(new LocatorImpl()); }