Click here to Skip to main content
15,443,430 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: I am looking for a dynamic HTML5 wysiwyg editor to replace Dreamweaver? Pin
DavidMills0224-Dec-20 0:41
MemberDavidMills0224-Dec-20 0:41 
AnswerRe: I am looking for a dynamic HTML5 wysiwyg editor to replace Dreamweaver? Pin
Slacker00723-Dec-20 0:45
professionalSlacker00723-Dec-20 0:45 
GeneralRe: I am looking for a dynamic HTML5 wysiwyg editor to replace Dreamweaver? Pin
Chris C-B23-Dec-20 1:11
MemberChris C-B23-Dec-20 1:11 
GeneralRe: I am looking for a dynamic HTML5 wysiwyg editor to replace Dreamweaver? Pin
Slacker00723-Dec-20 1:12
professionalSlacker00723-Dec-20 1:12 
GeneralRe: I am looking for a dynamic HTML5 wysiwyg editor to replace Dreamweaver? Pin
DavidMills0224-Dec-20 0:32
MemberDavidMills0224-Dec-20 0:32 
QuestionWho here knows what a pull parser or pull parsing is? Pin
honey the codewitch22-Dec-20 16:56
mvahoney the codewitch22-Dec-20 16:56 
AnswerRe: Who here knows what a pull parser or pull parsing is? Pin
RickZeeland22-Dec-20 19:33
mveRickZeeland22-Dec-20 19:33 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
honey the codewitch22-Dec-20 20:55
mvahoney the codewitch22-Dec-20 20:55 
Thanks. I'm just trying to determine if it might be worth an article of its own since I've implemented so many of them.

They basically work like this: (example for JSON)

C++
// open the file
if (!fileLC.open("./data.json")) {
    printf("Json file not found\r\n");
    return;
}
JsonReader jsonReader(fileLC);
long long int nodes = 0; // we don't count the initial node
milliseconds start = duration_cast< milliseconds >(system_clock::now().time_since_epoch());
// pull parsers return portions of the parse which you retrieve
// by calling their parse/read method in a loop.
bool done = false;
while (!done && jsonReader.read())
{
    ++nodes;
    // what kind of JSON element are we on?
    switch (jsonReader.nodeType())
    {
    case JsonReader::Value: // we're on a scalar value
        printf("Value ");
        switch (jsonReader.valueType())
        {                        // what type of value?
        case JsonReader::String: // a string!
            printf("String: ");
            printf("%s\r\n", jsonReader.value()); // print it
            break;
        case JsonReader::Real:                                 // a number!
            printf("Real: %f\r\n", jsonReader.realValue()); // print it
            break;
        case JsonReader::Integer:                                 // a number!
            printf("Integer: %lli\r\n", jsonReader.integerValue()); // print it
            break;
        case JsonReader::Boolean: // a boolean!
            printf("Boolean: %s\r\n", jsonReader.booleanValue() ? "true" : "false");
            break;
        case JsonReader::Null: // a null!
            printf("Null: (null)\r\n");
            break;
        default:
            printf("Undefined!\r\n");
            break;
        }
        break;
    case JsonReader::Field: // this is a field
        printf("Field %s\r\n", jsonReader.value());
        break;
    case JsonReader::Object: // an object start {
        printf("Object (Start)\r\n");
        break;
    case JsonReader::EndObject: // an object end }
        printf("Object (End)\r\n");
        break;
    case JsonReader::Array: // an array start [
        printf("Array (Start)\r\n");
        break;
    case JsonReader::EndArray: // an array end ]
        printf("Array (End)\r\n");
        break;
    case JsonReader::Error: // a bad thing
        // maybe we ran out of memory, or the document was poorly formed
        printf("Error: (%d) %s\r\n", jsonReader.lastError(), jsonReader.value());
        done=true;
        break;
    }
}
milliseconds end = duration_cast<milliseconds>(system_clock::now().time_since_epoch());
printf("Scanned %lli nodes and %llu characters in %d milliseconds using %d bytes of LexContext\r\n",nodes,fileLC.position()+1,(int)(end.count()-start.count()),(int)fileLC.used());
fileLC.close();


Sorry for the long code. As you can see they are not at all easy to use but they are easier than a SAX XML parser.

Some advanced ones (like my recent offerings Shucks | :-\ ) support querying and data extraction to make it easier. In the case of mine it's also more efficient to query than it is to stupidly read() through the whole file like the above. But the above is a standard pull parse.
Real programmers use butterflies

AnswerRe: Who here knows what a pull parser or pull parsing is? Pin
OriginalGriff22-Dec-20 20:16
mveOriginalGriff22-Dec-20 20:16 
AnswerRe: Who here knows what a pull parser or pull parsing is? Pin
Randor 22-Dec-20 20:39
professional Randor 22-Dec-20 20:39 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
honey the codewitch22-Dec-20 20:41
mvahoney the codewitch22-Dec-20 20:41 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
Randor 22-Dec-20 21:01
professional Randor 22-Dec-20 21:01 
AnswerRe: Who here knows what a pull parser or pull parsing is? Pin
Keith Barrow22-Dec-20 23:02
professionalKeith Barrow22-Dec-20 23:02 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
honey the codewitch23-Dec-20 1:09
mvahoney the codewitch23-Dec-20 1:09 
AnswerRe: Who here knows what a pull parser or pull parsing is? Pin
Jörgen Andersson23-Dec-20 0:42
professionalJörgen Andersson23-Dec-20 0:42 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
honey the codewitch23-Dec-20 1:08
mvahoney the codewitch23-Dec-20 1:08 
AnswerRe: Who here knows what a pull parser or pull parsing is? Pin
PIEBALDconsult24-Dec-20 5:42
professionalPIEBALDconsult24-Dec-20 5:42 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
honey the codewitch24-Dec-20 9:50
mvahoney the codewitch24-Dec-20 9:50 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
PIEBALDconsult24-Dec-20 10:23
professionalPIEBALDconsult24-Dec-20 10:23 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
honey the codewitch24-Dec-20 10:54
mvahoney the codewitch24-Dec-20 10:54 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
PIEBALDconsult24-Dec-20 11:32
professionalPIEBALDconsult24-Dec-20 11:32 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
honey the codewitch24-Dec-20 11:45
mvahoney the codewitch24-Dec-20 11:45 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
PIEBALDconsult24-Dec-20 13:17
professionalPIEBALDconsult24-Dec-20 13:17 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
honey the codewitch24-Dec-20 13:24
mvahoney the codewitch24-Dec-20 13:24 
GeneralRe: Who here knows what a pull parser or pull parsing is? Pin
PIEBALDconsult24-Dec-20 14:23
professionalPIEBALDconsult24-Dec-20 14:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Straw Poll

What topics would you like to learn more about?
Contributed by Marc Clifton.
  Results   379 votes