本文整理汇总了Java中javax.xml.transform.sax.SAXSource.setSystemId方法的典型用法代码示例。如果您正苦于以下问题:Java SAXSource.setSystemId方法的具体用法?Java SAXSource.setSystemId怎么用?Java SAXSource.setSystemId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.transform.sax.SAXSource
的用法示例。
在下文中一共展示了SAXSource.setSystemId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDataValidator
import javax.xml.transform.sax.SAXSource; //导入方法依赖的package包/类
@DataProvider(name = "data_ValidatorA")
public Object[][] getDataValidator() {
DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
SAXSource ss = new SAXSource(new InputSource(xml_val_test));
ss.setSystemId(xml_val_test_id);
StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
StreamSource source = new StreamSource(new File(xml_val_test));
return new Object[][]{
// use catalog
{true, false, true, ds, null, null, xml_catalog, null},
{false, true, true, ds, null, null, null, xml_catalog},
{true, false, true, ss, null, null, xml_catalog, null},
{false, true, true, ss, null, null, null, xml_catalog},
{true, false, true, stax, null, null, xml_catalog, xml_catalog},
{false, true, true, stax1, null, null, xml_catalog, xml_catalog},
{true, false, true, source, null, null, xml_catalog, null},
{false, true, true, source, null, null, null, xml_catalog},
};
}
示例2: getDataValidator
import javax.xml.transform.sax.SAXSource; //导入方法依赖的package包/类
@DataProvider(name = "data_ValidatorC")
public Object[][] getDataValidator() {
DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
SAXSource ss = new SAXSource(new InputSource(xml_val_test));
ss.setSystemId(xml_val_test_id);
StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
StreamSource source = new StreamSource(new File(xml_val_test));
return new Object[][]{
// use catalog
{false, false, true, ds, null, null, xml_bogus_catalog, null},
{false, false, true, ds, null, null, null, xml_bogus_catalog},
{false, false, true, ss, null, null, xml_bogus_catalog, null},
{false, false, true, ss, null, null, null, xml_bogus_catalog},
{false, false, true, stax, null, null, xml_bogus_catalog, null},
{false, false, true, stax1, null, null, null, xml_bogus_catalog},
{false, false, true, source, null, null, xml_bogus_catalog, null},
{false, false, true, source, null, null, null, xml_bogus_catalog},
};
}
示例3: supportLSResourceResolver1
import javax.xml.transform.sax.SAXSource; //导入方法依赖的package包/类
@DataProvider(name = "supportLSResourceResolver1")
public Object[][] supportLSResourceResolver1() throws Exception {
URI catalogFile = getClass().getResource("CatalogSupport.xml").toURI();
URI catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").toURI();
/*
* val_test.xml has a reference to system.dtd and val_test.xsd
*/
SAXSource ss = new SAXSource(new InputSource(xml_val_test));
ss.setSystemId(xml_val_test_id);
return new Object[][]{
{catalogFile, ss},
{catalogFileUri, ss},
};
}
示例4: supportURIResolver
import javax.xml.transform.sax.SAXSource; //导入方法依赖的package包/类
@DataProvider(name = "supportURIResolver")
public Object[][] supportURIResolver() throws Exception {
URI catalogFile = getClass().getResource("CatalogSupport.xml").toURI();
URI catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").toURI();
SAXSource xslSource = new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString()));
/*
* val_test.xml has a reference to system.dtd and val_test.xsd
*/
SAXSource ss = new SAXSource(new InputSource(xml_val_test));
ss.setSystemId(xml_val_test_id);
return new Object[][]{
{catalogFile, new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString())),
new StreamSource(new File(xml_doc)), "Resolved by a catalog"},
{catalogFileUri, new SAXSource(new InputSource(new StringReader(xsl_include))),
new StreamSource(new StringReader(xml_xsl)), null},
};
}
示例5: getDataValidator
import javax.xml.transform.sax.SAXSource; //导入方法依赖的package包/类
@DataProvider(name = "data_ValidatorC")
public Object[][] getDataValidator() {
DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, true, true, xml_catalog);
SAXSource ss = new SAXSource(new InputSource(xml_val_test));
ss.setSystemId(xml_val_test_id);
StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
StreamSource source = new StreamSource(new File(xml_val_test));
return new Object[][]{
// use catalog
{false, false, true, ds, null, null, xml_catalog, null},
{false, false, true, ds, null, null, null, xml_catalog},
{false, false, true, ss, null, null, xml_catalog, null},
{false, false, true, ss, null, null, null, xml_catalog},
{false, false, true, stax, null, null, xml_catalog, null},
{false, false, true, stax1, null, null, null, xml_catalog},
{false, false, true, source, null, null, xml_catalog, null},
{false, false, true, source, null, null, null, xml_catalog},
};
}
示例6: transform
import javax.xml.transform.sax.SAXSource; //导入方法依赖的package包/类
void transform(TransformerFactory factory) throws TransformerConfigurationException, TransformerException {
SAXSource xslSource = new SAXSource(new InputSource(xslFile));
xslSource.setSystemId(xslFileId);
Transformer transformer = factory.newTransformer(xslSource);
StringWriter stringResult = new StringWriter();
Result result = new StreamResult(stringResult);
transformer.transform(new SAXSource(new InputSource(xmlFile)), result);
}
示例7: getDataValidator
import javax.xml.transform.sax.SAXSource; //导入方法依赖的package包/类
@DataProvider(name = "data_ValidatorC")
public Object[][] getDataValidator() {
DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
SAXSource ss = new SAXSource(new InputSource(xml_val_test));
ss.setSystemId(xml_val_test_id);
StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
StreamSource source = new StreamSource(new File(xml_val_test));
return new Object[][]{
// use catalog disabled through factory
{true, false, false, ds, null, null, xml_catalog, null},
{true, false, false, ds, null, null, null, xml_catalog},
{true, false, false, ss, null, null, xml_catalog, null},
{true, false, false, ss, null, null, null, xml_catalog},
{true, false, false, stax, null, null, xml_catalog, null},
{true, false, false, stax1, null, null, null, xml_catalog},
{true, false, false, source, null, null, xml_catalog, null},
{true, false, false, source, null, null, null, xml_catalog},
// use catalog disabled through validatory
{false, true, false, ds, null, null, xml_catalog, null},
{false, true, false, ds, null, null, null, xml_catalog},
{false, true, false, ss, null, null, xml_catalog, null},
{false, true, false, ss, null, null, null, xml_catalog},
{false, true, false, stax, null, null, xml_catalog, null},
{false, true, false, stax1, null, null, null, xml_catalog},
{false, true, false, source, null, null, xml_catalog, null},
{false, true, false, source, null, null, null, xml_catalog},
};
}
示例8: getDataValidator
import javax.xml.transform.sax.SAXSource; //导入方法依赖的package包/类
@DataProvider(name = "data_ValidatorA")
public Object[][] getDataValidator() {
DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
SAXSource ss = new SAXSource(new InputSource(xml_val_test));
ss.setSystemId(xml_val_test_id);
StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
StreamSource source = new StreamSource(new File(xml_val_test));
String[] systemIds = {"system.dtd", "val_test.xsd"};
XmlInput[] returnValues = {new XmlInput(null, dtd_system, null), new XmlInput(null, xsd_val_test, null)};
LSResourceResolver resolver = new SourceResolver(null, systemIds, returnValues);
StAXSource stax2 = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
return new Object[][]{
// use catalog
{false, false, true, ds, null, null, xml_catalog, null},
{false, false, true, ds, null, null, null, xml_catalog},
{false, false, true, ss, null, null, xml_catalog, null},
{false, false, true, ss, null, null, null, xml_catalog},
{false, false, true, stax, null, null, xml_catalog, null},
{false, false, true, stax1, null, null, null, xml_catalog},
{false, false, true, source, null, null, xml_catalog, null},
{false, false, true, source, null, null, null, xml_catalog},
// use resolver
{false, false, true, ds, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
{false, false, true, ss, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
{false, false, true, stax2, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
{false, false, true, source, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog}
};
}
示例9: getDataValidator
import javax.xml.transform.sax.SAXSource; //导入方法依赖的package包/类
@DataProvider(name = "data_ValidatorC")
public Object[][] getDataValidator() {
DOMSource ds = getDOMSource(xml_val_test, xml_val_test_id, false, true, null);
SAXSource ss = new SAXSource(new InputSource(xml_val_test));
ss.setSystemId(xml_val_test_id);
StAXSource stax = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
StAXSource stax1 = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
StreamSource source = new StreamSource(new File(xml_val_test));
String[] systemIds = {"system.dtd", "val_test.xsd"};
XmlInput[] returnValues = {new XmlInput(null, dtd_system, null), new XmlInput(null, xsd_val_test, null)};
LSResourceResolver resolver = new SourceResolver(null, systemIds, returnValues);
StAXSource stax2 = getStaxSource(xml_val_test, xml_val_test_id, false, true, xml_catalog);
return new Object[][]{
// use catalog
{false, false, true, ds, null, null, null, null},
{false, false, true, ds, null, null, null, null},
{false, false, true, ss, null, null, null, null},
{false, false, true, ss, null, null, null, null},
{false, false, true, stax, null, null, null, null},
{false, false, true, stax1, null, null, null, null},
{false, false, true, source, null, null, null, null},
{false, false, true, source, null, null, null, null},
// use resolver
{false, false, true, ds, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
{false, false, true, ss, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
{false, false, true, stax2, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog},
{false, false, true, source, resolver, resolver, xml_bogus_catalog, xml_bogus_catalog}
};
}
示例10: source2inputsource03
import javax.xml.transform.sax.SAXSource; //导入方法依赖的package包/类
/**
* This test case tries to get InputSource from SAXSource using
* sourceToInputSource method. This will also check if the systemId
* remained the same. This is a positive test case.
*
* @throws IOException reading file error.
*/
@Test
public void source2inputsource03() throws IOException {
String SYSTEM_ID = "file:///" + XML_DIR;
try (FileInputStream fis = new FileInputStream(TEST_FILE)) {
SAXSource saxSource =
new SAXSource(new InputSource(fis));
saxSource.setSystemId(SYSTEM_ID);
assertEquals(SAXSource.sourceToInputSource(saxSource).getSystemId(),
SYSTEM_ID);
}
}