From ole2mail at mail.com Mon Oct 18 13:00:03 2021 From: ole2mail at mail.com (Oleg Kokorin) Date: Mon Oct 18 13:10:31 2021 Subject: [studxml-users] parser fails to find next_expect as well as attribute Message-ID: hello all the library has been tested version libstudxml-1.0.1 as well as latest from the https://git.codesynthesis.com/libstudxml/libstudxml.git the problem is, while parsing attached XML file using call next_expect (all types of content has been tested with the same exception failure): xml::parser p (metaStream, "metadataFinder"); p.next_expect (xml::parser::start_element, "tt", xml::content::mixed); as well as using call attribute xml::parser p (metaStream, "metadataFinder"); p.next_expect (xml::parser::start_element); std::cerr << p.line () << ':' << p.column () << ": start " << p.name () << " attributes: " << p.attribute("xml:lang") << std::endl; in both cases exception is happening for the unable to find element or attribute. however the example loop is working and is returning "tt" as the first and "head" as second. for (xml::parser::event_type e: p) { switch (e) { default: std::cerr << p.line () << ':' << p.column () << ": start " << p.name () << std::endl; break; } } thanks Oleg -------------- next part -------------- A non-text attachment was scrubbed... Name: textStubXML.xml Type: application/xml Size: 18088 bytes Desc: not available Url : https://codesynthesis.com/pipermail/studxml-users/attachments/20211018/6e50afaf/textStubXML.xml From boris at codesynthesis.com Tue Oct 19 09:55:07 2021 From: boris at codesynthesis.com (Boris Kolpackov) Date: Tue Oct 19 09:53:11 2021 Subject: [studxml-users] parser fails to find next_expect as well as attribute In-Reply-To: References: Message-ID: Oleg Kokorin writes: > the problem is, while parsing attached XML file > > using call > next_expect (all types of content has been tested with the same > exception failure): > > xml::parser p (metaStream, "metadataFinder"); > p.next_expect (xml::parser::start_element, "tt", > xml::content::mixed); > > > as well as using call > attribute > > xml::parser p (metaStream, "metadataFinder"); > p.next_expect (xml::parser::start_element); > std::cerr << p.line () << ':' << p.column () << ": start " > << p.name () << " attributes: " > << p.attribute("xml:lang") << std::endl; Can you provide a minimal but complete example that I can use to parse the attached XML and that reproduces the problem you are seeing? From boris at codesynthesis.com Thu Oct 21 05:59:38 2021 From: boris at codesynthesis.com (Boris Kolpackov) Date: Thu Oct 21 05:57:43 2021 Subject: [studxml-users] parser fails to find next_expect as well as attribute In-Reply-To: References: Message-ID: Oleg Kokorin writes: > xml::parser p (metaStream, "metadataFinder"); > p.next_expect (xml::parser::start_element, "tt", xml::content::mixed); Your tt element is in the http://www.w3.org/ns/ttml namespace: > While your next_expect() call above expects an unqualified element. Try this: p.next_expect (xml::parser::start_element, "http://www.w3.org/ns/ttml", "tt", xml::content::mixed);