- if (ctx->node)
- {
- // VS: ctx->node == NULL happens if there is a comment before
- // the root element (e.g. wxDesigner's output). We ignore such
- // comments, no big deal...
- ctx->node->AddChild(new wxXmlNode(wxXML_COMMENT_NODE,
- wxT("comment"), CharToString(ctx->conv, data)));
- }
+ wxXmlNode *commentnode =
+ new wxXmlNode(wxXML_COMMENT_NODE,
+ wxS("comment"), CharToString(ctx->conv, data),
+ XML_GetCurrentLineNumber(ctx->parser));
+
+ ASSERT_LAST_CHILD_OK(ctx);
+ ctx->node->InsertChildAfter(commentnode, ctx->lastChild);
+ ctx->lastChild = commentnode;
+ ctx->lastAsText = NULL;
+}
+
+static void PIHnd(void *userData, const char *target, const char *data)
+{
+ wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
+
+ wxXmlNode *pinode =
+ new wxXmlNode(wxXML_PI_NODE, CharToString(ctx->conv, target),
+ CharToString(ctx->conv, data),
+ XML_GetCurrentLineNumber(ctx->parser));
+
+ ASSERT_LAST_CHILD_OK(ctx);
+ ctx->node->InsertChildAfter(pinode, ctx->lastChild);
+ ctx->lastChild = pinode;