Android Domparser question.

Asked 1 years ago, Updated 1 years ago, 63 views

I'm going to use dom parser I just called you like the picture, but there's an error. I don't know what's wrong and what I'm going to do ㅠ<

dom android parser

2022-09-21 17:30

2 Answers

Exception handling is required. Create a constructor and initialize it.

...
import javax.xml.parsers.ParserConfigurationException;

public class WordDatas {
  private DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  private DocumentBuilder db;

  public WordDatas() {
    try {
      db = dbf.newDocumentBuilder();
    } } catch(ParserConfigurationException e) {
      // If an error occurs when initializing Dom Parser
    }
  }
}


2022-09-21 17:30

I'm leaving it just in case you don't know.

First, think about what the error message means and try alt + enter in the red line.

I recommend you to work on correcting errors as below.

You can choose the appropriate method you think of from the ones you recommended.


2022-09-21 17:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.