Mistři v programování na #hovnokod

Java #4594

Zacly nejak nahodne padat importy dat do databaze z XML souboru. STAX parser. Co na tom muze byt spatne ? Ze od nejake vyssi verze Javy neni garantovano, ze textovy element musi byt ve vystupu parseru prave jeden, i kdyz v XML vstupnim souboru vidite pouze jen jeden. Vice info zde: https://stackoverflow.com/questions/39997538/stax-not-returning-all-characters-in-a-string Mozne reseni zde: http://helpdesk.objects.com.au/java/stop-stax-breaking-character-event

 while (stream.hasNext()) {
            eventType = stream.next();

            if (eventType == XMLStreamConstants.START_ELEMENT) {
                if (!"".equals(actualAttribute)) {
                    String actualName = stream.getLocalName();
                    actualValue = readElement(actualAttribute, actualName, stream);
                    result.addAttribute(actualAttribute, actualValue);
                    actualAttribute = "";
                    actualValue = null;
                } else {                    
                    actualAttribute = stream.getLocalName();
                }
            } else if (eventType == XMLStreamConstants.CHARACTERS && !"".equals(actualAttribute)) {
                actualValue = stream.getText();
            } else if (eventType == XMLStreamConstants.END_ELEMENT) {
                if (stream.getLocalName().equals(readingItem)) {
                    return result;
                } else {
                    if (actualAttribute.equals(stream.getLocalName())) {
                        result.addAttribute(actualAttribute, actualValue);
                        actualAttribute = "";
                        actualValue = null;
                    }
                }
            }
     }

Anonymous,