1 /*
2 Copyright (C) 2005-2007 Feeling Software Inc.
3 Portions of the code are:
4 Copyright (C) 2005-2007 Sony Computer Entertainment America
5
6 MIT License: http://www.opensource.org/licenses/mit-license.php
7 */
8 /*
9 Based on the FS Import classes:
10 Copyright (C) 2005-2006 Feeling Software Inc
11 Copyright (C) 2005-2006 Autodesk Media Entertainment
12 MIT License: http://www.opensource.org/licenses/mit-license.php
13 */
14
15 #ifndef _FU_XML_PARSER_H_
16 #define _FU_XML_PARSER_H_
17
18 #ifdef HAS_LIBXML
19
20 typedef fm::pvector<struct _xmlNode> xmlNodeList; /**< A dynamically-sized array of XML nodes. */
21
22 namespace FUXmlParser
23 {
24 // Parse an XML compatable string for the std representation
25 FCOLLADA_EXPORT fm::string XmlToString(const char* s);
26 #ifdef UNICODE
27 FCOLLADA_EXPORT fstring XmlToString(const fchar* s);
28 #endif // UNICODE
29
30 // Retrieve specific child nodes
31 FCOLLADA_EXPORT xmlNode* FindChildByType(xmlNode* parent, const char* type);
32 FCOLLADA_EXPORT xmlNode* FindChildByName(xmlNode* parent, const char* name);
33 FCOLLADA_EXPORT void FindChildrenByType(xmlNode* parent, const char* type, xmlNodeList& nodes);
34 FCOLLADA_EXPORT xmlNode* FindChildByProperty(xmlNode* parent, const char* prop, const char* val);
35 FCOLLADA_EXPORT xmlNode* FindNodeInListByProperty(xmlNodeList list, const char* property, const char* prop);
36
37 // Retrieve node property and content
38 FCOLLADA_EXPORT bool HasNodeProperty(xmlNode* node, const char* property);
39 FCOLLADA_EXPORT fm::string ReadNodeProperty(xmlNode* node, const char* property);
40 FCOLLADA_EXPORT FUCrc32::crc32 ReadNodePropertyCRC(xmlNode* node, const char* property);
41 FCOLLADA_EXPORT const char* ReadNodeContentDirect(xmlNode* node);
42 FCOLLADA_EXPORT fm::string ReadNodeContentFull(xmlNode* node);
43 };
44
IsEquivalent(const xmlChar * sz1,const char * sz2)45 inline bool IsEquivalent(const xmlChar* sz1, const char* sz2) { return IsEquivalent((const char*) sz1, sz2); }
46
47 #endif // HAS_LIBXML
48
49 #endif //_FU_XML_PARSER_H_
50