本文整理汇总了Java中org.xml.sax.SAXException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java SAXException.printStackTrace方法的具体用法?Java SAXException.printStackTrace怎么用?Java SAXException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xml.sax.SAXException
的用法示例。
在下文中一共展示了SAXException.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ParserContext
import org.xml.sax.SAXException; //导入方法依赖的package包/类
public ParserContext( XSOMParser owner, XMLParser parser ) {
this.owner = owner;
this.parser = parser;
try {
parse(new InputSource(ParserContext.class.getResource("datatypes.xsd").toExternalForm()));
SchemaImpl xs = (SchemaImpl)
schemaSet.getSchema("http://www.w3.org/2001/XMLSchema");
xs.addSimpleType(schemaSet.anySimpleType,true);
xs.addComplexType(schemaSet.anyType,true);
} catch( SAXException e ) {
// this must be a bug of XSOM
if(e.getException()!=null)
e.getException().printStackTrace();
else
e.printStackTrace();
throw new InternalError();
}
}
示例2: load
import org.xml.sax.SAXException; //导入方法依赖的package包/类
public Node load(String xmlfile) {
Document doc = null;
try{
DOMParser parser = new DOMParser();
parser.reset();
parser.parse(xmlfile);
doc = parser.getDocument();
}
catch (IOException ioe)
{ioe.printStackTrace();}
catch (SAXException saxe)
{saxe.printStackTrace();}
return doc;
}
示例3: writeChangeState
import org.xml.sax.SAXException; //导入方法依赖的package包/类
@Override
public void writeChangeState(String state)
{
try
{
AttributesImpl attributes = new AttributesImpl();
attributes.addAttribute(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "state", "state", "String", state);
attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "date", "date", "dateTime", ISO8601DateFormat.format(new Date()));
writer.startElement(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, TransferDestinationReportModel.LOCALNAME_TRANSFER_STATE, PREFIX + ":" + TransferDestinationReportModel.LOCALNAME_TRANSFER_STATE, attributes);
writer.endElement(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, TransferDestinationReportModel.LOCALNAME_TRANSFER_STATE, PREFIX + ":" + TransferDestinationReportModel.LOCALNAME_TRANSFER_STATE);
}
catch (SAXException se)
{
// TODO Auto-generated catch block
se.printStackTrace();
}
}
示例4: writeCreated
import org.xml.sax.SAXException; //导入方法依赖的package包/类
@Override
public void writeCreated(NodeRef sourceNodeRef, NodeRef newNode, NodeRef newParentNodeRef, String newPath)
{
try
{
AttributesImpl attributes = new AttributesImpl();
attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "date", "date", "dateTime", ISO8601DateFormat.format(new Date()));
attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "sourceNodeRef", "sourceNodeRef", "string", sourceNodeRef.toString());
attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "destinationNodeRef", "destinationNodeRef", "string", newNode.toString());
attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "parentNodeRef", "parentNodeRef", "string", newParentNodeRef.toString());
writer.startElement(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, TransferDestinationReportModel.LOCALNAME_TRANSFER_CREATED, PREFIX + ":" + TransferDestinationReportModel.LOCALNAME_TRANSFER_CREATED, attributes);
writeDestinationPath(newPath);
writer.endElement(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, TransferDestinationReportModel.LOCALNAME_TRANSFER_CREATED, PREFIX + ":" + TransferDestinationReportModel.LOCALNAME_TRANSFER_CREATED);
}
catch (SAXException se)
{
// TODO Auto-generated catch block
se.printStackTrace();
}
}
示例5: writeDeleted
import org.xml.sax.SAXException; //导入方法依赖的package包/类
@Override
public void writeDeleted(NodeRef sourceNodeRef, NodeRef deletedNode, String oldPath)
{
try
{
AttributesImpl attributes = new AttributesImpl();
attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "date", "date", "dateTime", ISO8601DateFormat.format(new Date()));
attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "sourceNodeRef", "sourceNodeRef", "string", sourceNodeRef.toString());
attributes.addAttribute(TransferReportModel.TRANSFER_REPORT_MODEL_1_0_URI, "destinationNodeRef", "destinationNodeRef", "string", deletedNode.toString());
writer.startElement(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, TransferDestinationReportModel.LOCALNAME_TRANSFER_DELETED, PREFIX + ":" + TransferDestinationReportModel.LOCALNAME_TRANSFER_DELETED, attributes);
writeDestinationPath(oldPath);
writer.endElement(TransferDestinationReportModel.TRANSFER_REPORT_MODEL_1_0_URI, TransferDestinationReportModel.LOCALNAME_TRANSFER_DELETED, PREFIX + ":" + TransferDestinationReportModel.LOCALNAME_TRANSFER_DELETED);
}
catch (SAXException se)
{
// TODO Auto-generated catch block
se.printStackTrace();
}
}
示例6: startElement
import org.xml.sax.SAXException; //导入方法依赖的package包/类
private void startElement(String qName) {
try {
th.startElement("", "", qName, attrs);
} catch (SAXException e) {
e.printStackTrace();
}
}
示例7: parseCartList
import org.xml.sax.SAXException; //导入方法依赖的package包/类
private void parseCartList(String xml){
cartList = new ArrayList<String>();
//get the factory
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
domCL = db.parse(new InputSource(new StringReader(xml)));
domCL.getDocumentElement().normalize();
NodeList nList = domCL.getElementsByTagName("item");
for (int temp = 0; temp < nList.getLength(); temp++) {
Node nNode = nList.item(temp);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;
//put cart items in list
String accum = ""+eElement.getElementsByTagName("type").item(0).getTextContent() + " / " +
eElement.getElementsByTagName("make").item(0).getTextContent() + " / " +
eElement.getElementsByTagName("model").item(0).getTextContent()+ " / " +
eElement.getElementsByTagName("price").item(0).getTextContent();
cartList.add(accum);
}
}
//catch total price and item returned from server
totalPrice=domCL.getElementsByTagName("totalcost").item(0).getTextContent();
totalItem=domCL.getElementsByTagName("totalitem").item(0).getTextContent();
}catch(ParserConfigurationException pce) { pce.printStackTrace();
}catch(SAXException se) { se.printStackTrace();
}catch(IOException ioe) { ioe.printStackTrace();
}catch (Exception e){ e.printStackTrace();
}
}
示例8: test
import org.xml.sax.SAXException; //导入方法依赖的package包/类
@Test
public void test() {
try {
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(new StreamSource(Bug7014246Test.class.getResourceAsStream("Bug7014246.xsd")));
Assert.fail("STATUS:Failed.The negative testcase unexpectedly passed.");
} catch (SAXException e) {
e.printStackTrace();
}
}
示例9: parseUserActionResponse
import org.xml.sax.SAXException; //导入方法依赖的package包/类
private void parseUserActionResponse(String xml){
messageList = new ArrayList<String>();
//get the factory
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
domARB = db.parse(new InputSource(new StringReader(xml)));
domARB.getDocumentElement().normalize();
NodeList nList = domARB.getElementsByTagName("messagetouser");
messageList.clear();
//put all message from server in a list
for (int temp = 0; temp < nList.getLength(); temp++) {
Node nNode = nList.item(temp);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;
messageList.add(eElement.getTextContent());
}
}
//catch total items returned from server
totalItem=domARB.getElementsByTagName("totalitem").item(0).getTextContent();
}catch(ParserConfigurationException pce) { pce.printStackTrace();
}catch(SAXException se) { se.printStackTrace();
}catch(IOException ioe) { ioe.printStackTrace();
}catch (Exception e){ e.printStackTrace();
}
}
示例10: testAttributeCaching
import org.xml.sax.SAXException; //导入方法依赖的package包/类
@Test
public void testAttributeCaching() {
File xmlFile = new File(getClass().getResource("Bug6879614.xml").getFile());
DocumentBuilderFactory _documentBuilderFactory = DocumentBuilderFactory.newInstance();
_documentBuilderFactory.setValidating(false);
_documentBuilderFactory.setIgnoringComments(true);
_documentBuilderFactory.setIgnoringElementContentWhitespace(true);
_documentBuilderFactory.setCoalescing(true);
_documentBuilderFactory.setExpandEntityReferences(true);
_documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder _documentBuilder = null;
try {
_documentBuilder = _documentBuilderFactory.newDocumentBuilder();
} catch (ParserConfigurationException pce) {
pce.printStackTrace();
}
Document xmlDoc = null;
try {
xmlDoc = _documentBuilder.parse(xmlFile);
if (xmlDoc == null) {
System.out.println("Hello!!!, there is a problem here");
} else {
System.out.println("Good, the parsing went through fine.");
}
} catch (SAXException se) {
se.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
示例11: parseSchema
import org.xml.sax.SAXException; //导入方法依赖的package包/类
public void parseSchema(InputSource source) {
checkAbsoluteness(source.getSystemId());
try {
forest.parse(source,true);
} catch (SAXException e) {
// parsers are required to report an error to ErrorHandler,
// so we should never see this error.
e.printStackTrace();
}
}
示例12: skippedEntity
import org.xml.sax.SAXException; //导入方法依赖的package包/类
public void skippedEntity(String name) {
try {
System.out.println("skippedEntity() is invoked for : " + name);
new XMLReaderAdapter().skippedEntity(name);
} catch (SAXException e) {
e.printStackTrace();
}
}
示例13: parse
import org.xml.sax.SAXException; //导入方法依赖的package包/类
public Danmakus parse() {
if (this.mDataSource != null) {
AndroidFileSource source = this.mDataSource;
try {
XMLReader xmlReader = XMLReaderFactory.createXMLReader();
XmlContentHandler contentHandler = new XmlContentHandler();
xmlReader.setContentHandler(contentHandler);
xmlReader.parse(new InputSource(source.data()));
return contentHandler.getResult();
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
}
}
return null;
}
示例14: testInstance
import org.xml.sax.SAXException; //导入方法依赖的package包/类
@Test
public void testInstance() throws ParserConfigurationException, SAXException, IOException {
System.out.println(Bug6963468Test.class.getResource("Bug6963468.xsd").getPath());
File schemaFile = new File(Bug6963468Test.class.getResource("Bug6963468.xsd").getPath());
SAXParser parser = createParser(schemaFile);
try {
parser.parse(Bug6963468Test.class.getResource("Bug6963468.xml").getPath(), new DefaultHandler());
} catch (SAXException e) {
e.printStackTrace();
Assert.fail("Fatal Error: " + strException(e));
}
}
示例15: endElement
import org.xml.sax.SAXException; //导入方法依赖的package包/类
private void endElement(String qName) {
try {
th.endElement("", "", qName);
} catch (SAXException e) {
e.printStackTrace();
}
}