1
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setValidating(false);
DocumentBuilder builder;

try {

    builder = dbf.newDocumentBuilder();
    Document doc = builder.parse(file);
    Element root = doc.getDocumentElement();
    NodeList methodNodes = root.getChildNodes();
    for(int i=0; i<methodNodes.getLength();i++ )
        methodNodes.item(i).getNodeName();
    Node el = root.getFirstChild();                 
    while(el!=null) {   
//TextAreaNeed
        System.out.print(el.getTextContent());
        el = el.getNextSibling();
    }   

Как передать getTextContent() не в print, а в JTextArea, например?

1 ответ 1

1

Вызвать метод append существующего объекта JTextArea.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.