XML Format help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Damodhar

    #1

    XML Format help

    I want to determinate if a xml is well-format and valid before export
    it to
    database.

    how can i find if the xml feed is well formated one??
  • Dikkie Dik

    #2
    Re: XML Format help

    Damodhar wrote:
    I want to determinate if a xml is well-format and valid before export
    it to
    database.
    >
    how can i find if the xml feed is well formated one??
    If you have the XML in a file, use an XML parser or editor with such a
    parser. For instance, "XML Copy Editor" (see
    http://xml-copy-editor.sourceforge.net/).

    Best regards.

    Comment

    • Jeff North

      #3
      Re: XML Format help

      On Wed, 2 Apr 2008 17:59:32 -0700 (PDT), in comp.lang.php Damodhar
      <damu.be@gmail. com>
      <f7fcd25d-b8d4-4584-9758-80b02a85c8f7@s8 g2000prg.google groups.com>
      wrote:
      >| I want to determinate if a xml is well-format and valid before export
      >| it to
      >| database.
      >|
      >| how can i find if the xml feed is well formated one??
      Open the xml file with your web browser (IE or Firefox).
      -- -------------------------------------------------------------
      jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
      -- -------------------------------------------------------------

      Comment

      • George Maicovschi

        #4
        Re: XML Format help

        If it's an automatic task then just try this:

        libxml_internal _errors(true);
        $parsed_xml=sim plexml_load_str ing($xml) //or
        simplexml_load_ file($path) if the xml is in a file
        if ($parsed_xml)
        //xml is valid, do your thing
        else
        //xml not valid

        Comment

        Working...