Hi Francesco,

I briefly inform you about situation:

>> 1) after loading your doc, you need wxXml2Document::GetDTD
>> 2) inside your wxXml2DTD you'll find the wxXml2EntityDecl nodes
>> 3) for each of those node you need to use the GetContent() function and if a
>> valid filename is returned load it using wxXml2Document
>> 4) parse your original tree and replace the wxXML2_ENTITY_REF_NODE
with the root
>> of the wxXml2Document loaded at step #3


After some trial and error trying to implement your "manual" proposed
solution, I have found that steps 1,2 and 3 are not necessary. I
modified the sample code to dump all the nodes. Then I discovered that
when you include an external entity ( &name; ) the XML doc tree
contains in its place an wxXML_ENTITY_REF_NODE, having an
wxXML_ENTITY_DECL child. And this last one contains all needed
information (GetSystemID contains the URL to load). So I think that
only step 4, done on the fly, as you process the main document, is
necessary.


This is the code I added to your sample, in ParseNode(), before the else:

    else if (node.GetType() == wxXML_ENTITY_REF_NODE)
    {
        toadd += wxString::Format(_T(", NodeType=%d, Name='%s'"),
node.GetType(), node.GetName());
    }
    else if (node.GetType() == wxXML_ENTITY_DECL)
    {
        wxXml2EntityDecl* pNode = (wxXml2EntityDecl*)&node;
        toadd += wxString::Format(_T(", NodeType=%d, Name='%s',
SystemID='%s'\n"),
                     node.GetType(), pNode->GetSystemID() );
    }


To be continued ...

Regards,
Cecilio

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
wxCode-users mailing list
wxCode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxcode-users

Reply via email to