|
|
Comments and Discussions
|
|
 |

|
I have adapated the following code:
pjharren wrote: The following code will write from a memory mapped xml file to a disk file:
xml_node defNode = xml->document().first_element_by_name(_T("DopplerDefinitions"));
wofstream xmlout("C:\\temp\\foobar.xml", ios_base::out);
defNode.outer_xml(xmlout);
xmlout.close();
using iostream, but I get the following compiler error:
"error C2440: 'type cast' : cannot convert from 'class ofstream' to 'class std::basic_ostream'
The target type has no constructors"
Any help would be appreciated. Thanks
|
|
|
|

|
I get errors when I attempt to compile using VC6 with UNICODE. I searched this forum but cannot resolve the problem. The errors are:
C:\DOCUMENTS AND SETTINGS\PATRICK HARREN\MY DOCUMENTS\VISUAL STUDIO PROJECTS\PugXMLMFC\pugxml.h(1921) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'unsigned short *' (or there is no acceptable conversion)
C:\DOCUMENTS AND SETTINGS\PATRICK HARREN\MY DOCUMENTS\VISUAL STUDIO PROJECTS\PugXMLMFC\pugxml.h(1990) : error C2664: 'bool __thiscall pug::xml_attribute::value(const unsigned short *)' : cannot convert parameter 1 from 'const char *' to 'const unsig
ned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\DOCUMENTS AND SETTINGS\PATRICK HARREN\MY DOCUMENTS\VISUAL STUDIO PROJECTS\PugXMLMFC\pugxml.h(2032) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'const unsigned short *' (or there is no acceptable conver
sion)
C:\DOCUMENTS AND SETTINGS\PATRICK HARREN\MY DOCUMENTS\VISUAL STUDIO PROJECTS\PugXMLMFC\pugxml.h(3131) : error C2440: 'default argument' : cannot convert from 'unsigned short [2]' to 'const class std::basic_string,c
lass std::allocator > &'
Reason: cannot convert from 'unsigned short [2]' to 'const class std::basic_string,class std::allocator >'
No constructor could take the source type, or constructor overload resolution was ambiguous
C:\DOCUMENTS AND SETTINGS\PATRICK HARREN\MY DOCUMENTS\VISUAL STUDIO PROJECTS\PugXMLMFC\pugxml.h(3131) : error C2548: 'first_element_by_path' : missing default parameter for parameter 2
All assistance will be much appreciated.
Thanks,
Pat Harren
pjharren@sbcglobal.net
|
|
|
|

|
Hi there.
I'am exploring this pugXML and I'm very impressed by the job done.
I have a very simple question about attributes:
I would like to delete an attribute named "ID" on every single element (if this attribute is present of course) of my XML file but I don't understand how to use
"attribute_iterator attributes_erase(attribute_iterator where)".
Could anyone help me ?
In advance, thanks
Michel
|
|
|
|

|
I really love PugXML, it's fast and exactly what I need.
But (the magic word!) I am confused.
<up>
<va>
<e name="basic"/>
</va>
<package id="1">
<name>Basic</name>
</package>
</up>
First I search for xml_node node = xml->document().first_element_by_attribute("package", "id", m_selection);
So I get the child with name "name" (and others if there would be some).
Why the heck does this child not have value Basic now? I realized that I have to use child(0) from this child, but I am still confused that PCDATA is again a child itself and not the value of this first child. Since attribute-values have to be retrieved through attribute("foo") there would have been no problem to use value for the child itself...
Anyhow, as I said I love PugXML, if there would be a STL-style-updated documentation for it. Without something like this looks unusual.
Greetings,
Roland
|
|
|
|

|
Yes I agree that this is quite confusing. From memory there are cases where the PCDATA/CDATA isn't at child[0] which is why I added xml_node::child_value(), xml_node::find_child() etc. This also explains why the PCDATA/CDATA can't be the nodes value.
It is possible that refactoring the code could improve areas like this, but I've just learnt to live with it.
Neville Franks, Author of Surfulater www.surfulater.com "Save what you Surf" and ED for Windows www.getsoft.com
|
|
|
|

|
Is the MFC version (CPugXMLBranch and all...) is still available somewhere or with somebody. Please dont ask me to convert it myself, neither ask me why I need it anyways...;P
Yogesh
|
|
|
|

|
Perhaps this has been talked a lot but I can not stop my self from writing this.
One of the reasons of XML is connecting platforms, apps through text encoded messages, to achieve this you need compliance. Implementing a fully (95%-98%) compliant XML parser is really hard. Usually an average Dev can get to 80% pretty quickly and the experienced can get to %90. The rest is all egde cases and getting them right requires extensive testing suites to ensure compat between different platforms. I know this by experience. There are quite a few xml parser implementations out there. Users are usually best served when the xml parser implementations are recognized by the W3C Recommendations. Other implementations can not go any further than academic studies as the cost of them making interop with the rest of the world sky rockets as dev's are trying to achieve %95 compat.
|
|
|
|

|
On a new xml_node object, setting the value to "" caused an access violation.
Changed the following lines of strcopyinsitu:
size_t l = (*dest) ? _tcslen(*dest) : 0; //How long is destination?
if(l >= _tcslen(src)) //Destination is large enough, so just copy.
{
_tcscpy(*dest,src); //Copy.
return TRUE; //Success.
}
To read:
size_t l = (*dest) ? _tcslen(*dest) : 0; //How long is destination?
if(l >= _tcslen(src) && l > 0) //Destination is large enough, so just copy.
{
_tcscpy(*dest,src); //Copy.
return TRUE; //Success.
}
-- modified at 17:35 Monday 29th August, 2005
|
|
|
|

|
We just stepped into the same issue. Our fix was slightly different. Instead of:
if (l >= _tcslen(src) && l > 0)
we did:
if (l >= _tcslen(src) && *dest)
I think both solutions may work. Basically, you want to protect from writing into a NULL pointer and get into the 'else' part of the 'if' statement.
-Paul
BTW, we converted this thing to compile using gcc under Linux (embedded BusyBox for XScale/ARM). It took a little doing but it seems to work fine. Most of the changes were Unicode (_T, _tcs...) related and one problem with a method's abiguity. If anybody needs this, sent me a note.
|
|
|
|

|
Hi, Paul,
We are currently involved in a project that needs parse very large xml file under linux. If you could send me the pugxml converted to compile using gcc under linux, I would greatly apprecicate it.
My email: ffengliping@gmail.com
Thanks,
LiPing
LiPing Feng
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
Discussion of techniques for fast, robust, light-weight XML parsing.
| Type | Article |
| Licence | |
| First Posted | 11 Jan 2003 |
| Views | 693,300 |
| Bookmarked | 277 times |
|
|