comparison src/goodjava/xml/XmlParser.java @ 1723:0246add03d11

dont allow empty xml
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 10 Aug 2022 14:21:15 -0600
parents 35f3bfd4f51d
children a8c685a894b4
comparison
equal deleted inserted replaced
1722:7d2ab44f7a59 1723:0246add03d11
31 spaces(); 31 spaces();
32 XmlElement element = element(); 32 XmlElement element = element();
33 spaces(); 33 spaces();
34 if( !parser.endOfInput() ) 34 if( !parser.endOfInput() )
35 throw exception("unexpected text"); 35 throw exception("unexpected text");
36 if( element==null )
37 throw exception("empty document not allowed");
36 return element; 38 return element;
37 } 39 }
38 40
39 private void prolog() throws ParseException { 41 private void prolog() throws ParseException {
40 if( !parser.match("<?xml") ) 42 if( !parser.match("<?xml") )