Search in sources :

Example 6 with XmlReader

use of com.xenoage.utils.xml.XmlReader in project Zong by Xenoage.

the class CompressedFileInput method readRootFilePath.

@NonNull
private String readRootFilePath(XmlReader containerReader) throws IOException {
    XmlReader r = containerReader;
    // root element
    r.openNextChildElement();
    while (r.openNextChildElement()) {
        if (r.getElementName().equals("rootfiles")) {
            // rootfiles element
            while (r.openNextChildElement()) {
                if (r.getElementName().equals("rootfile")) {
                    // rootfile element
                    String fullPath = r.getAttribute("full-path");
                    if (fullPath == null)
                        throw new IOException("full-path of rootfile not found");
                    return fullPath;
                }
                r.closeElement();
            }
        }
        r.closeElement();
    }
    throw new IOException("rootfile not found");
}
Also used : XmlReader(com.xenoage.utils.xml.XmlReader) IOException(java.io.IOException) NonNull(com.xenoage.utils.annotations.NonNull)

Aggregations

XmlReader (com.xenoage.utils.xml.XmlReader)6 IOException (java.io.IOException)3 XmlException (com.xenoage.utils.xml.XmlException)2 MusicXMLDocument (com.xenoage.zong.musicxml.MusicXMLDocument)2 MaybeNull (com.xenoage.utils.annotations.MaybeNull)1 NonNull (com.xenoage.utils.annotations.NonNull)1 InvalidFormatException (com.xenoage.utils.exceptions.InvalidFormatException)1 BufferedInputStream (com.xenoage.utils.io.BufferedInputStream)1 JseXmlReader (com.xenoage.utils.jse.xml.JseXmlReader)1 JseXmlWriter (com.xenoage.utils.jse.xml.JseXmlWriter)1 XmlDataException (com.xenoage.utils.xml.XmlDataException)1 ChordWidthsReader.readChordWidths (com.xenoage.zong.io.musiclayout.ChordWidthsReader.readChordWidths)1 SpacingsReader.readSpacings (com.xenoage.zong.io.musiclayout.SpacingsReader.readSpacings)1 ChordWidths (com.xenoage.zong.musiclayout.settings.ChordWidths)1 LayoutSettings (com.xenoage.zong.musiclayout.settings.LayoutSettings)1 Spacings (com.xenoage.zong.musiclayout.settings.Spacings)1 MxlScorePartwise (com.xenoage.zong.musicxml.types.MxlScorePartwise)1 PathSymbol (com.xenoage.zong.symbols.PathSymbol)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1