domxml->dump_file formats

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

    #1

    domxml->dump_file formats

    Does anyone know how to specify the format for the domxml->dump_file method?

    I am at a loss; my document is being dumped as one great big long line,
    and I want to insert line breaks and spaces so that it is human readable.

    --Yan
  • petersprc

    #2
    Re: domxml->dump_fil e formats

    Hi,

    The third parameter specifies whether the output should be formatted
    neatly:

    $doc->dump_file('my. xml', false, true);
    >From the doc page
    (http://us3.php.net/manual/en/functio...ump-file.php):

    string DomDocument->dump_file ( string filename [, bool compressionmode
    [, bool format]] )

    Creates an XML document from the dom representation. This function
    usually is called after building a new dom document from scratch as in
    the example below. The format specifies whether the output should be
    neatly formatted, or not. The first parameter specifies the name of the
    filename and the second parameter, whether it should be compressed or
    not.

    CptDondo wrote:
    Does anyone know how to specify the format for the domxml->dump_file method?
    >
    I am at a loss; my document is being dumped as one great big long line,
    and I want to insert line breaks and spaces so that it is human readable.
    >
    --Yan

    Comment

    • CptDondo

      #3
      Re: domxml->dump_fil e formats

      CptDondo wrote:
      Does anyone know how to specify the format for the domxml->dump_file
      method?
      >
      I am at a loss; my document is being dumped as one great big long line,
      and I want to insert line breaks and spaces so that it is human readable.
      OK, more file xml file ops Q:

      When I open the file, I use:

      $dom = domxml_open_fil e("/tmp/test.conf",
      DOMXML_LOAD_PAR SING + //0
      DOMXML_LOAD_COM PLETE_ATTRS + //8
      DOMXML_LOAD_SUB STITUTE_ENTITIE S + //4
      DOMXML_LOAD_DON T_KEEP_BLANKS //16
      );

      But that keeps leading and trailing blanks on the entries. Is there a
      way to automagically trim leading and trailing whitespace?

      I am using PHP4.

      Thanks,

      --Yan

      Comment

      • CptDondo

        #4
        Re: domxml->dump_fil e formats

        petersprc wrote:
        Hi,
        >
        The third parameter specifies whether the output should be formatted
        neatly:
        >
        $doc->dump_file('my. xml', false, true);
        >
        OK, I guess I missed the 'bool' in the docs. I kept looking for a
        bitmask that would go in there.

        --Yan

        Comment

        Working...