ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

xmlParseXMLDecl: : an XML parser context

parse an XML declaration header

[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'

Definition at line 10071 of file parser.c.

Referenced by xmlParseDocument(), and xmlParseExtParsedEnt().

                                       {
    xmlChar *version;

    /*
     * This value for standalone indicates that the document has an
     * XML declaration but it does not have a standalone attribute.
     * It will be overwritten later if a standalone attribute is found.
     */
    ctxt->input->standalone = -2;

    /*
     * We know that '<?xml' is here.
     */
    SKIP(5);

    if (!IS_BLANK_CH(RAW)) {
    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED,
                   "Blank needed after '<?xml'\n");
    }
    SKIP_BLANKS;

    /*
     * We must have the VersionInfo here.
     */
    version = xmlParseVersionInfo(ctxt);
    if (version == NULL) {
    xmlFatalErr(ctxt, XML_ERR_VERSION_MISSING, NULL);
    } else {
    if (!xmlStrEqual(version, (const xmlChar *) XML_DEFAULT_VERSION)) {
        /*
         * Changed here for XML-1.0 5th edition
         */
        if (ctxt->options & XML_PARSE_OLD10) {
        xmlFatalErrMsgStr(ctxt, XML_ERR_UNKNOWN_VERSION,
                      "Unsupported version '%s'\n",
                      version);
        } else {
            if ((version[0] == '1') && ((version[1] == '.'))) {
            xmlWarningMsg(ctxt, XML_WAR_UNKNOWN_VERSION,
                          "Unsupported version '%s'\n",
                  version, NULL);
        } else {
            xmlFatalErrMsgStr(ctxt, XML_ERR_UNKNOWN_VERSION,
                      "Unsupported version '%s'\n",
                      version);
        }
        }
    }
    if (ctxt->version != NULL)
        xmlFree((void *) ctxt->version);
    ctxt->version = version;
    }

    /*
     * We may have the encoding declaration
     */
    if (!IS_BLANK_CH(RAW)) {
        if ((RAW == '?') && (NXT(1) == '>')) {
        SKIP(2);
        return;
    }
    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, "Blank needed here\n");
    }
    xmlParseEncodingDecl(ctxt);
    if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
    /*
     * The XML REC instructs us to stop parsing right here
     */
        return;
    }

    /*
     * We may have the standalone status.
     */
    if ((ctxt->input->encoding != NULL) && (!IS_BLANK_CH(RAW))) {
        if ((RAW == '?') && (NXT(1) == '>')) {
        SKIP(2);
        return;
    }
    xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, "Blank needed here\n");
    }

    /*
     * We can grow the input buffer freely at that point
     */
    GROW;

    SKIP_BLANKS;
    ctxt->input->standalone = xmlParseSDDecl(ctxt);

    SKIP_BLANKS;
    if ((RAW == '?') && (NXT(1) == '>')) {
        SKIP(2);
    } else if (RAW == '>') {
        /* Deprecated old WD ... */
    xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
    NEXT;
    } else {
    xmlFatalErr(ctxt, XML_ERR_XMLDECL_NOT_FINISHED, NULL);
    MOVETO_ENDTAG(CUR_PTR);
    NEXT;
    }
}

Generated on Fri May 25 2012 04:41:32 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.