Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
Collections:
Other Resources:
JDK 17 java.xml.jmod - XML Module
JDK 17 java.xml.jmod is the JMOD file for JDK 17 XML (eXtensible Markup Language) module.
JDK 17 XML module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\java.xml.jmod.
JDK 17 XML module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 XML module source code files are stored in \fyicenter\jdk-17.0.5\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/xpath/internal/jaxp/XPathResultImpl.java
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.org.apache.xpath.internal.jaxp;
import com.sun.org.apache.xpath.internal.objects.XObject;
import java.util.Objects;
import javax.xml.transform.TransformerException;
import javax.xml.xpath.XPathNodes;
import javax.xml.xpath.XPathEvaluationResult;
import javax.xml.xpath.XPathEvaluationResult.XPathResultType;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.traversal.NodeIterator;
/**
* This is the implementation of XPathEvaluationResult that represents the
* result of the evaluation of an XPath expression within the context of a
* particular node.
*/
class XPathResultImpl<T> implements XPathEvaluationResult<T> {
XObject resultObject;
int resultType;
Class<T> type;
XPathResultType mapToType;
NodeList nodeList = null;
int currentIndex;
Node currentNode;
boolean boolValue = false;
Node node = null;
double numValue;
String strValue;
/**
* Construct an XPathEvaluationResult object.
*
* @param resultObject internal XPath result object
* @param type class type
* @throws TransformerException if there is an error reading the XPath
* result.
*/
public XPathResultImpl(XObject resultObject, Class<T> type)
throws TransformerException {
this.resultObject = resultObject;
resultType = resultObject.getType();
this.type = type;
getResult(resultObject);
}
/**
* Return the result type as an enum specified by {@code XPathResultType}
* @return the result type
*/
@Override
public XPathResultType type() {
return mapToType;
}
/**
* Returns the value of the result as the type <T> specified for the class.
*
* @return The value of the result.
*/
@Override
public T value() {
Objects.requireNonNull(type);
try {
return getValue(resultObject, type);
} catch (TransformerException ex) {
throw new RuntimeException(ex);
}
}
/**
* Read the XObject and set values in accordance with the result type
* @param resultObject internal XPath result object
* @throws TransformerException if there is an error reading the XPath
* result.
*/
private void getResult(XObject resultObject) throws TransformerException {
switch (resultType) {
case XObject.CLASS_BOOLEAN:
boolValue = resultObject.bool();
mapToType = XPathResultType.BOOLEAN;
break;
case XObject.CLASS_NUMBER:
numValue = resultObject.num();
mapToType = XPathResultType.NUMBER;
break;
case XObject.CLASS_STRING:
strValue = resultObject.str();
mapToType = XPathResultType.STRING;
break;
case XObject.CLASS_NODESET:
mapToType = XPathResultType.NODESET;
nodeList = resultObject.nodelist();
break;
case XObject.CLASS_RTREEFRAG: //NODE
mapToType = XPathResultType.NODE;
NodeIterator ni = resultObject.nodeset();
//Return the first node, or null
node = ni.nextNode();
break;
}
}
/**
* Read the internal result object and return the value in accordance with
* the type specified.
*
* @param <T> The expected class type.
* @param resultObject internal XPath result object
* @param type the class type
* @return The value of the result, null in case of unexpected type.
* @throws TransformerException if there is an error reading the XPath
* result.
*/
static <T> T getValue(XObject resultObject, Class<T> type) throws TransformerException {
Objects.requireNonNull(type);
if (type.isAssignableFrom(XPathEvaluationResult.class)) {
return type.cast(new XPathResultImpl<T>(resultObject, type));
}
int resultType = classToInternalType(type);
switch (resultType) {
case XObject.CLASS_BOOLEAN:
return type.cast(resultObject.bool());
case XObject.CLASS_NUMBER:
if (Double.class.isAssignableFrom(type)) {
return type.cast(resultObject.num());
} else if (Integer.class.isAssignableFrom(type)) {
return type.cast((int)resultObject.num());
} else if (Long.class.isAssignableFrom(type)) {
return type.cast((long)resultObject.num());
}
/*
This is to suppress warnings. By the current specification,
among numeric types, only Double, Integer and Long are supported.
*/
break;
case XObject.CLASS_STRING:
return type.cast(resultObject.str());
case XObject.CLASS_NODESET:
XPathNodes nodeSet = new XPathNodesImpl(resultObject.nodelist(),
Node.class);
return type.cast(nodeSet);
case XObject.CLASS_RTREEFRAG: //NODE
NodeIterator ni = resultObject.nodeset();
//Return the first node, or null
try {
return type.cast(ni.nextNode());
} catch (RuntimeException e) {
throw new TransformerException(e.getMessage(), e.getCause());
}
}
return null;
}
/**
* Map the specified class type to the internal result type
*
* @param <T> The expected class type.
* @param type the class type
* @return the internal XObject type.
*/
static <T> int classToInternalType(Class<T> type) {
if (type.isAssignableFrom(Boolean.class)) {
return XObject.CLASS_BOOLEAN;
} else if (Number.class.isAssignableFrom(type)) {
return XObject.CLASS_NUMBER;
} else if (type.isAssignableFrom(String.class)) {
return XObject.CLASS_STRING;
} else if (type.isAssignableFrom(XPathNodes.class)) {
return XObject.CLASS_NODESET;
} else if (type.isAssignableFrom(Node.class)) {
return XObject.CLASS_RTREEFRAG;
}
return XObject.CLASS_NULL;
}
}
⏎ com/sun/org/apache/xpath/internal/jaxp/XPathResultImpl.java
Or download all of them as a single archive file:
File name: java.xml-17.0.5-src.zip File size: 5047495 bytes Release date: 2022-09-13 Download
⇒ JDK 17 java.xml.crypto.jmod - XML Crypto Module
2023-07-17, ≈284🔥, 1💬
Popular Posts:
What Is ojdbc7.jar for Oracle 12c R1? ojdbc7.jar for Oracle 12c R1 is the JAR files of ojdbc.jar, JD...
JRE 8 rt.jar is the JAR file for JRE 8 RT (Runtime) libraries. JRE (Java Runtime) 8 is the runtime e...
GJT (Giant Java Tree) implementation of XML Pull Parser. JAR File Size and Download Location: File n...
Apache Log4j IOStreams is a Log4j API extension that provides numerous classes from java.io that can...
Snappy-Java is a Java port of the "snappy", a fast C++ compresser/decompresser developed by Google. ...