4 This file is part of KIllustrator.
5 Copyright (C) 1998 Kai-Uwe Sattler (kus@iti.cs.uni-magdeburg.de)
7 modified for kvoctrain by Ewald Arnold kvoctrain@ewald-arnold.dein April ยด99
13 #include "XmlElement.h"
14 #include "XmlTokenizer.h"
19 * The XMLReader class supports reading elements from a XML stream.
21 * @short A class for reading XML elements from a stream.
22 * @author Kai-Uwe Sattler (kus@iti.cs.uni-magdeburg.de), modifications: Ewald Arnold (kvoctrain@ewald-arnold.de)
28 * Construct a XmlReader instance for the given input stream.
30 * @param is The open input stream.
32 XmlReader (KOXML_ISTREAM
& is
);
40 * Check the input stream for a valid XML header.
41 * A header should look like
43 * <?xml version="1.0"?>
44 * <!doctype dtype system dtd>
46 * where @p dtype and @p dtd are simple strings.
48 * @return @p true if the header conforms to XML, otherwise
54 * Return the document type.
56 * @return The name of the document type.
58 const KOXML_STRING
& doctype () const;
61 * Return the name of the document type definition.
63 * @return The name of the DTD.
65 const KOXML_STRING
& dtd () const;
68 * Read a XML element from the stream. If the content is plain text
69 * (no tag), an element with the pseudo ID @p #PCDATA is returned
70 * and the text is available via method getText.
74 * @param elem The XML element which is initialized by the method.
75 * @return @p true for successful reading.
77 bool readElement (XmlElement
& elem
);
80 * Read plain text from the stream.
82 * @return The text as a string.
84 const KOXML_STRING
& getText ();
87 * Returns current line number
89 * @return The current line number
91 inline int lineNumber() { return tokenizer
.lineNumber(); }
94 bool parseEndElement (XmlElement
& elem
);
95 bool parseElement (const KOXML_STRING
& id
, XmlElement
& elem
);
96 bool readAttributes (std::list
<XmlAttribute
>& attrib_list
);
99 XmlTokenizer tokenizer
;
100 KOXML_STRING s_dtype
,