2 * Copyright (C) 2007 Benjamin Otte <otte@gnome.org>
3 * 2007 Pekka Lampila <pekka.lampila@iki.fi>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301 USA
21 #ifndef _SWFDEC_XML_H_
22 #define _SWFDEC_XML_H_
24 #include <swfdec/swfdec_as_object.h>
25 #include <swfdec/swfdec_types.h>
26 #include <swfdec/swfdec_script.h>
27 #include <swfdec/swfdec_xml_node.h>
31 typedef struct _SwfdecXml SwfdecXml
;
32 typedef struct _SwfdecXmlClass SwfdecXmlClass
;
34 #define SWFDEC_TYPE_XML (swfdec_xml_get_type())
35 #define SWFDEC_IS_XML(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_XML))
36 #define SWFDEC_IS_XML_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_XML))
37 #define SWFDEC_XML(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_XML, SwfdecXml))
38 #define SWFDEC_XML_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_XML, SwfdecXmlClass))
39 #define SWFDEC_XML_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_XML, SwfdecXmlClass))
42 XML_PARSE_STATUS_OK
= 0,
43 XML_PARSE_STATUS_CDATA_NOT_TERMINATED
= -2,
44 XML_PARSE_STATUS_XMLDECL_NOT_TERMINATED
= -3,
45 XML_PARSE_STATUS_DOCTYPEDECL_NOT_TERMINATED
= -4,
46 XML_PARSE_STATUS_COMMENT_NOT_TERMINATED
= -5,
47 XML_PARSE_STATUS_ELEMENT_MALFORMED
= -6,
48 XML_PARSE_STATUS_OUT_OF_MEMORY
= -7,
49 XML_PARSE_STATUS_ATTRIBUTE_NOT_TERMINATED
= -8,
50 XML_PARSE_STATUS_TAG_NOT_CLOSED
= -9, // FIXME are the two correct?
51 XML_PARSE_STATUS_TAG_MISMATCH
= -10
52 } SwfdecXmlParseStatus
;
55 SwfdecXmlNode xml_node
;
57 gboolean ignore_white
;
60 const char *doc_type_decl
;
62 SwfdecAsValue content_type
;
66 struct _SwfdecXmlClass
{
67 SwfdecXmlNodeClass xml_node_class
;
70 GType
swfdec_xml_get_type (void);
72 char * swfdec_xml_escape (const char * orginal
);
73 char * swfdec_xml_escape_len (const char * orginal
,
75 char * swfdec_xml_unescape (SwfdecAsContext
* cx
,
76 const char * orginal
);
77 char * swfdec_xml_unescape_len (SwfdecAsContext
* cx
,
80 gboolean unescape_nbsp
);
82 SwfdecXml
* swfdec_xml_new (SwfdecAsContext
* context
,
84 gboolean ignore_white
);
85 SwfdecXml
* swfdec_xml_new_no_properties (SwfdecAsContext
* context
,
87 gboolean ignore_white
);