Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 11 java.xml.jmod - XML Module
JDK 11 java.xml.jmod is the JMOD file for JDK 11 XML (eXtensible Markup Language) module.
JDK 11 XML module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\java.xml.jmod.
JDK 11 XML module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 XML module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\java.xml.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ com/sun/org/apache/xalan/internal/xsltc/trax/SAX2StAXEventWriter.java
/* * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package com.sun.org.apache.xalan.internal.xsltc.trax; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.xml.stream.XMLEventFactory; import javax.xml.stream.XMLEventWriter; import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.*; import org.xml.sax.Attributes; import org.xml.sax.SAXException; import org.xml.sax.ext.Locator2; /** * @author Sunitha Reddy */ public class SAX2StAXEventWriter extends SAX2StAXBaseWriter { private XMLEventWriter writer; private XMLEventFactory eventFactory; private List<Collection<Namespace>> namespaceStack = new ArrayList<>(); private boolean needToCallStartDocument = false; public SAX2StAXEventWriter() { eventFactory = XMLEventFactory.newInstance(); } public SAX2StAXEventWriter(XMLEventWriter writer) { this.writer = writer; eventFactory = XMLEventFactory.newInstance(); } public SAX2StAXEventWriter(XMLEventWriter writer, XMLEventFactory factory) { this.writer = writer; if (factory != null) { this.eventFactory = factory; } else { eventFactory = XMLEventFactory.newInstance(); } } public XMLEventWriter getEventWriter() { return writer; } public void setEventWriter(XMLEventWriter writer) { this.writer = writer; } public XMLEventFactory getEventFactory() { return eventFactory; } public void setEventFactory(XMLEventFactory factory) { this.eventFactory = factory; } public void startDocument() throws SAXException { super.startDocument(); namespaceStack.clear(); eventFactory.setLocation(getCurrentLocation()); // Encoding and version info will be available only after startElement // is called for first time. So, defer START_DOCUMENT event of StAX till // that point of time. needToCallStartDocument = true; } private void writeStartDocument() throws SAXException { try { if (docLocator == null) writer.add(eventFactory.createStartDocument()); else { try{ writer.add(eventFactory.createStartDocument(((Locator2)docLocator).getEncoding(),((Locator2)docLocator).getXMLVersion())); } catch(ClassCastException e){ writer.add(eventFactory.createStartDocument()); } } } catch (XMLStreamException e) { throw new SAXException(e); } needToCallStartDocument = false; } public void endDocument() throws SAXException { eventFactory.setLocation(getCurrentLocation()); try { writer.add(eventFactory.createEndDocument()); } catch (XMLStreamException e) { throw new SAXException(e); } super.endDocument(); // clear the namespaces namespaceStack.clear(); } @SuppressWarnings({"rawtypes", "unchecked"}) public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (needToCallStartDocument) { writeStartDocument(); } // set document location eventFactory.setLocation(getCurrentLocation()); // create attribute and namespace events Collection[] events = {null, null}; createStartEvents(attributes, events); namespaceStack.add(events[0]); try { String[] qname = {null, null}; parseQName(qName, qname); writer.add(eventFactory.createStartElement(qname[0], uri, qname[1], events[1].iterator(), events[0].iterator())); } catch (XMLStreamException e) { throw new SAXException(e); } finally { super.startElement(uri, localName, qName, attributes); } } public void endElement(String uri, String localName, String qName) throws SAXException { super.endElement(uri, localName, qName); eventFactory.setLocation(getCurrentLocation()); // parse name String[] qname = {null, null}; parseQName(qName, qname); // get namespaces Collection<Namespace> nsList = namespaceStack.remove(namespaceStack.size() - 1); Iterator<Namespace> nsIter = nsList.iterator(); try { writer.add(eventFactory.createEndElement(qname[0], uri, qname[1], nsIter)); } catch (XMLStreamException e) { throw new SAXException(e); } } public void comment(char[] ch, int start, int length) throws SAXException { if (needToCallStartDocument) { // Drat. We were trying to postpone this until the first element so that we could get // the locator, but we can't output a comment before the start document, so we're just // going to have to do without the locator if it hasn't been set yet. writeStartDocument(); } super.comment(ch, start, length); eventFactory.setLocation(getCurrentLocation()); try { writer.add(eventFactory.createComment(new String(ch, start, length))); } catch (XMLStreamException e) { throw new SAXException(e); } } public void characters(char[] ch, int start, int length) throws SAXException { super.characters(ch, start, length); try { if (!isCDATA) { eventFactory.setLocation(getCurrentLocation()); writer.add(eventFactory.createCharacters(new String(ch, start, length))); } } catch (XMLStreamException e) { throw new SAXException(e); } } public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { super.ignorableWhitespace(ch, start, length); characters(ch, start, length); } public void processingInstruction(String target, String data) throws SAXException { if (needToCallStartDocument) { // Drat. We were trying to postpone this until the first element so that we could get // the locator, but we can't output a PI before the start document, so we're just // going to have to do without the locator if it hasn't been set yet. writeStartDocument(); } super.processingInstruction(target, data); try { writer.add(eventFactory.createProcessingInstruction(target, data)); } catch (XMLStreamException e) { throw new SAXException(e); } } public void endCDATA() throws SAXException { eventFactory.setLocation(getCurrentLocation()); try { writer.add(eventFactory.createCData(CDATABuffer.toString())); } catch (XMLStreamException e) { throw new SAXException(e); } super.endCDATA(); } @SuppressWarnings({"rawtypes", "unchecked"}) protected void createStartEvents(Attributes attributes, Collection<Attribute>[] events) { Map<String, Attribute> nsMap = null; List<Attribute> attrs = null; // create namespaces if (namespaces != null) { final int nDecls = namespaces.size(); for (int i = 0; i < nDecls; i++) { final String prefix = namespaces.get(i++); String uri = namespaces.get(i); Namespace ns = createNamespace(prefix, uri); if (nsMap == null) { nsMap = new HashMap<>(); } nsMap.put(prefix, ns); } } // create attributes String[] qname = {null, null}; for (int i = 0, s = attributes.getLength(); i < s; i++) { parseQName(attributes.getQName(i), qname); String attrPrefix = qname[0]; String attrLocal = qname[1]; String attrQName = attributes.getQName(i); String attrValue = attributes.getValue(i); String attrURI = attributes.getURI(i); if ("xmlns".equals(attrQName) || "xmlns".equals(attrPrefix)) { // namespace declaration disguised as an attribute. If the // namespace has already been declared, skip it, otherwise // write it as an namespace if (nsMap == null) { nsMap = new HashMap<>(); } if (!nsMap.containsKey(attrLocal)) { Namespace ns = createNamespace(attrLocal, attrValue); nsMap.put(attrLocal, ns); } } else { Attribute attribute; if (attrPrefix.length() > 0) { attribute = eventFactory.createAttribute(attrPrefix, attrURI, attrLocal, attrValue); } else { attribute = eventFactory.createAttribute(attrLocal, attrValue); } if (attrs == null) { attrs = new ArrayList<>(); } attrs.add(attribute); } } events[0] = (nsMap == null ? Collections.EMPTY_LIST : nsMap.values()); events[1] = (attrs == null ? Collections.EMPTY_LIST : attrs); } protected Namespace createNamespace(String prefix, String uri) { if (prefix == null || prefix.length() == 0) { return eventFactory.createNamespace(uri); } else { return eventFactory.createNamespace(prefix, uri); } } }
⏎ com/sun/org/apache/xalan/internal/xsltc/trax/SAX2StAXEventWriter.java
Or download all of them as a single archive file:
File name: java.xml-11.0.1-src.zip File size: 4876106 bytes Release date: 2018-11-04 Download
⇒ JDK 11 java.xml.crypto.jmod - XML Crypto Module
2020-08-25, 174730👍, 0💬
Popular Posts:
JDK 11 jdk.localedata.jmod is the JMOD file for JDK 11 Localedata module. JDK 11 Locale Data module ...
iText is an ideal library for developers looking to enhance web- and other applications with dynamic...
How to download and install JDK (Java Development Kit) 7? If you want to write Java applications, yo...
Apache Ant is a Java-based build tool. In theory, it is kind of like make, without make's wrinkles. ...
JDK 11 jdk.jlink.jmod is the JMOD file for JDK 11 JLink tool, which can be invoked by the "jlink" co...