8 Replies Latest reply on Oct 4, 2016 7:21 AM by VectorP

    malformed config.xml help

    adiv26020695

      HI, I am new to Phonegap. I've created a simple app which uses iframe element.

      When I build with this:

       

      config.xml:

      <plugin name="com.phonegap.plugins.pushplugin" source="pgb" />

      Everything goes fine, but the iframe doesn't work.

       

      But when I change to:

       

      <plugin name="com.phonegap.plugins.pushplugin" source="pgb" />

      <allow-navigation href="*" />

      it doesn't even compile with an "malformed config.xml" error!

       

      Pls help.

       

      Thanks in adv,

      Adam.

        • 1. Re: malformed config.xml help
          VectorP Level 4

          1. You should not use the old, deprecated plugins from the pgb repo. Use the latest versions of the plugins from npm, instead. Be aware that they are named differently, though.

          See the Configuration/Plugins section of the PGB Docs.

           

          2. If you have a message of malformed config.xml, the lines you posted will probably not be the problem. Use an online XML validator to check your xml for well-formedness. The W3C Validator will do nicely.

          • 2. Re: malformed config.xml help
            adiv26020695 Level 1

            Ok, thanks, but could you be more specific...

            I got the https://validator.w3.org/check but don't really know how to correct it, i'm new to this.

            Just want to get the iframe get to work, that's it.

            Thanks in adv. for reply.

            • 3. Re: malformed config.xml help
              adiv26020695 Level 1

              ok, tried to change to:

               

              <?xml version="1.0"?>

              <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

              <plugin name="com.phonegap.plugins.pushplugin" source="pgb" />

              <allow-navigation href="*">

              but without luck :-(

              • 4. Re: malformed config.xml help
                VectorP Level 4

                Just want to get the iframe get to work, that's it.

                That's not the next step. First, you've got to see that your config consists of valid xml. Until you write valid xml, you can't build your app.

                 

                What errors did the Validator supply?

                (You just need to correct those errors)

                • 5. Re: malformed config.xml help
                  adiv26020695 Level 1

                  Ok, sorry for late reply, the two lines is all i have in config.xml:

                   

                  <plugin name="com.phonegap.plugins.pushplugin" source="pgb" />

                  <allow-navigation href="*" />

                  When I paste and submit it to the validator I've got the following errors:

                   

                  ==================================  START  ==================================

                   

                  Notes and Potential Issues

                  The following notes and warnings highlight missing or conflicting information which caused the validator to perform some guesswork prior to validation, or other things affecting the output below. If the guess or fallback is incorrect, it could make validation results entirely incoherent. It is highly recommended to check these potential issues, and, if necessary, fix them and re-validate the document.

                   

                  Warning Unable to Determine Parse Mode!

                   

                  The validator can process documents either as XML (for document types such as XHTML, SVG, etc.) or SGML (for HTML 4.01 and prior versions). For this document, the information available was not sufficient to determine the parsing mode unambiguously, because:

                   

                  • in Direct Input mode, no MIME Media Type is served to the validator
                  • No known Document Type could be detected
                  • No XML declaration (e.g<?xml version="1.0"?>) could be found at the beginning of the document.
                  • No XML namespace (e.g<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">) could be found at the root of the document.

                  As a default, the validator is falling back to SGML mode.

                   

                  Warning No DOCTYPE found, and unknown root element. Aborting validation.

                   

                  The DOCTYPE Declaration was not recognized or is missing. This probably means that the Formal Public Identifier contains a spelling error, or that the Declaration is not using correct syntax, or that your document is not using a DOCTYPE Declaration.

                  Without a DOCTYPE Declaration it is not possible to check the validity of your document. Since the document does not start with the root <html> element, automatic fallback to an HTML document type was not performed, and most of the validation process was aborted: only basic markup syntax was checked.

                  Learn how to add a doctype to your document from our FAQ, or use the validator's Document Type option to validate your document against a specific Document Type.

                   

                  Info No Character encoding declared at document level

                   

                  No character encoding information was found within the document, either in an HTML meta element or an XML declaration. It is often recommended to declare the character encoding in the document itself, especially if there is a chance that the document will be read from or saved to disk, CD, etc.

                  See this tutorial on character encoding for techniques and explanations.

                   

                  Info Using Direct Input mode: UTF-8 character encoding assumed

                   

                  Unlike the “by URI” and “by File Upload” modes, the “Direct Input” mode of the validator provides validated content in the form of characters pasted or typed in the validator's form field. This will automatically make the data UTF-8, and therefore the validator does not need to determine the character encoding of your document, and will ignore any charset information specified.

                  If you notice a discrepancy in detected character encoding between the “Direct Input” mode and other validator modes, this is likely to be the reason. It is neither a bug in the validator, nor in your document.

                   

                  Validation Output: 1 Error 

                   

                  Error  Line 1, Column 1: no document type declaration; will parse without validation

                  <plugin name="com.phonegap.plugins.pushplugin" source="pgb" />

                  The document type could not be determined, because the document had no correct DOCTYPE declaration. The document does not look like HTML, therefore automatic fallback could not be performed, and the document was only checked against basic markup syntax.

                  Learn how to add a doctype to your document from our FAQ, or use the validator's Document Type option to validate your document against a specific Document Type.

                   

                  Warning  Line 1, Column 61: NET-enabling start-tag requires SHORTTAG YES

                   

                  <plugin name="com.phonegap.plugins.pushplugin" source="pgb" />

                   

                  For the current document, the validator interprets strings like <FOO /> according to legacy rules that break the expectations of most authors and thus cause confusing warnings and error messages from the validator. This interpretation is triggered by HTML 4 documents or other SGML-based HTML documents. To avoid the messages, simply remove the "/" character in such contexts. NB: If you expect <FOO /> to be interpreted as an XML-compatible "self-closing" tag, then you need to use XHTML or HTML5.

                  This warning and related errors may also be caused by an unquoted attribute value containing one or more "/". Example: <a href=http://w3c.org>W3C</a>. In such cases, the solution is to put quotation marks around the value.

                   

                  Warning  Line 2, Column 28: NET-enabling start-tag requires SHORTTAG YES

                   

                  <allow-navigation href="*" />

                  For the current document, the validator interprets strings like <FOO /> according to legacy rules that break the expectations of most authors and thus cause confusing warnings and error messages from the validator. This interpretation is triggered by HTML 4 documents or other SGML-based HTML documents. To avoid the messages, simply remove the "/" character in such contexts. NB: If you expect <FOO /> to be interpreted as an XML-compatible "self-closing" tag, then you need to use XHTML or HTML5.

                  This warning and related errors may also be caused by an unquoted attribute value containing one or more "/". Example: <a href=http://w3c.org>W3C</a>. In such cases, the solution is to put quotation marks around the value.

                   

                  ==================================  END  ==================================

                   

                  Ok, now I have no idea how to correct these two lines!

                  Pls help me.

                  Thanks in adv,

                  Adam.

                  • 6. Re: malformed config.xml help
                    VectorP Level 4

                    You can't just have those two lines in your config. It doesn't validate as well-formed xml.

                     

                    If you are new to XML in general, you'd need to read up on it with some basic documentation.

                    Then read about Configuring in the PGB Docs.

                     

                    (Sorry, but you are doing so much wrong that I can't explain how to do it properly without repeating such full documents on the issue - and that wouldn't be what this forum is intended for)

                    • 7. Re: malformed config.xml help
                      adiv26020695 Level 1

                      I've got:

                       

                      <?xml version="1.0" encoding="UTF-8"?>

                      <!-- config.xml reference: https://build.phonegap.com/docs/config-xml -->

                      <widget xmlns     = "http://www.w3.org/ns/widgets"

                              xmlns:gap = "http://phonegap.com/ns/1.0"

                      >

                      <access origin="*"/>

                      <plugin name="com.phonegap.plugins.pushplugin" source="pgb" />

                      </widget>

                      <allow-navigation href="*" />

                      and still got the "malformed config.xml" error :-(

                       

                      But whenever I remove the line:

                      <allow-navigation href="*" />

                      the build is successful!

                       

                      But i need this line - just don't know where and how to put it...

                       

                      Thanks in adv

                      • 8. Re: malformed config.xml help
                        VectorP Level 4

                        The widget element is your xml's root. All other elements must be siblings of that root element, or within an element tree under that root.

                        Your allow-navigation element is outside the xml's root, which makes the config invalid.

                         

                        BTW:

                        - don't use ancient plugins from the deprecated pgb repo. Only use the latest versions of the plugins from npm. Be aware that they are named differently, though.

                        - you can't have no icons and no splashes, especially when building for iOS. You should include them

                        Also use the splashscreen plugin from npm.

                        - you can't have whitelisting rules without the whitelist plugin from npm. Include it.

                        - you need to add required attributes and siblings to your widget element, like an app bundle id, a name and a desription for your app.