本文整理汇总了Java中jdk.internal.org.xml.sax.InputSource.getPublicId方法的典型用法代码示例。如果您正苦于以下问题:Java InputSource.getPublicId方法的具体用法?Java InputSource.getPublicId怎么用?Java InputSource.getPublicId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.internal.org.xml.sax.InputSource
的用法示例。
在下文中一共展示了InputSource.getPublicId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setinp
import jdk.internal.org.xml.sax.InputSource; //导入方法依赖的package包/类
/**
* Sets up a new input source on the top of the input stack. Note, the first
* byte returned by the entity's byte stream has to be the first byte in the
* entity. However, the parser does not expect the byte order mask in both
* cases when encoding is provided by the input source.
*
* @param is A new input source to set up.
* @exception IOException If any IO errors occur.
* @exception Exception is parser specific exception form panic method.
*/
protected void setinp(InputSource is)
throws Exception {
Reader reader = null;
mChIdx = 0;
mChLen = 0;
mChars = mInp.chars;
mInp.src = null;
if (mPh < PH_DOC_START) {
mIsSAlone = false; // default [#2.9]
}
mIsSAloneSet = false;
if (is.getCharacterStream() != null) {
// Ignore encoding in the xml text decl.
reader = is.getCharacterStream();
xml(reader);
} else if (is.getByteStream() != null) {
String expenc;
if (is.getEncoding() != null) {
// Ignore encoding in the xml text decl.
expenc = is.getEncoding().toUpperCase();
if (expenc.equals("UTF-16")) {
reader = bom(is.getByteStream(), 'U'); // UTF-16 [#4.3.3]
} else {
reader = enc(expenc, is.getByteStream());
}
xml(reader);
} else {
// Get encoding from BOM or the xml text decl.
reader = bom(is.getByteStream(), ' ');
if (reader == null) {
// Encoding is defined by the xml text decl.
reader = enc("UTF-8", is.getByteStream());
expenc = xml(reader);
if (expenc.startsWith("UTF-16")) {
panic(FAULT); // UTF-16 must have BOM [#4.3.3]
}
reader = enc(expenc, is.getByteStream());
} else {
// Encoding is defined by the BOM.
xml(reader);
}
}
} else {
// There is no support for public/system identifiers.
panic(FAULT);
}
mInp.src = reader;
mInp.pubid = is.getPublicId();
mInp.sysid = is.getSystemId();
}
示例2: setinp
import jdk.internal.org.xml.sax.InputSource; //导入方法依赖的package包/类
/**
* Sets up a new input source on the top of the input stack. Note, the first
* byte returned by the entity's byte stream has to be the first byte in the
* entity. However, the parser does not expect the byte order mask in both
* cases when encoding is provided by the input source.
*
* @param is A new input source to set up.
* @exception IOException If any IO errors occur.
* @exception Exception is parser specific exception form panic method.
*/
protected void setinp(InputSource is)
throws Exception {
Reader reader = null;
mChIdx = 0;
mChLen = 0;
mChars = mInp.chars;
mInp.src = null;
if (mPh < PH_DOC_START) {
mIsSAlone = false; // default [#2.9]
}
mIsSAloneSet = false;
if (is.getCharacterStream() != null) {
// Ignore encoding in the xml text decl.
reader = is.getCharacterStream();
xml(reader);
} else if (is.getByteStream() != null) {
String expenc;
if (is.getEncoding() != null) {
// Ignore encoding in the xml text decl.
expenc = is.getEncoding().toUpperCase();
if (expenc.equals("UTF-16")) {
reader = bom(is.getByteStream(), 'U'); // UTF-16 [#4.3.3]
} else {
reader = enc(expenc, is.getByteStream());
}
xml(reader);
} else {
// Get encoding from BOM or the xml text decl.
reader = bom(is.getByteStream(), ' ');
/**
* [#4.3.3] requires BOM for UTF-16, however, it's not uncommon
* that it may be missing. A mature technique exists in Xerces
* to further check for possible UTF-16 encoding
*/
if (reader == null) {
reader = utf16(is.getByteStream());
}
if (reader == null) {
// Encoding is defined by the xml text decl.
reader = enc("UTF-8", is.getByteStream());
expenc = xml(reader);
if (!expenc.equals("UTF-8")) {
if (expenc.startsWith("UTF-16")) {
panic(FAULT); // UTF-16 must have BOM [#4.3.3]
}
reader = enc(expenc, is.getByteStream());
}
} else {
// Encoding is defined by the BOM.
xml(reader);
}
}
} else {
// There is no support for public/system identifiers.
panic(FAULT);
}
mInp.src = reader;
mInp.pubid = is.getPublicId();
mInp.sysid = is.getSystemId();
}