Help using sp_xml_preparedocument

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

    Help using sp_xml_preparedocument

    Hi all,

    We are using a VB component to create and save an XML document on our
    local LAN.

    We want to load this straight into a DB Table using a query based on
    OPENXML. Trouble is, the sp_xml_prepared ocument command always throws an
    error.

    Here is some code:
    [color=blue][color=green][color=darkred]
    >>>> CODE >>>>[/color][/color][/color]
    DECLARE @idoc int
    DECLARE @doc varchar(1000)

    EXEC sp_xml_prepared ocument @idoc OUTPUT, @doc
    <<<< END OF CODE <<<<

    where @doc is the filename of our file on the LAN to be opened, and
    @idoc is the handle to be created.

    the error is:
    XML parsing error: Invalid at the top level of the document.

    Here is some of the XML Document saved on the LAN that should be opened
    by sp_xml_prepared ocument and prepared.

    <?xml version="1.0" encoding="UTF-8" ?>
    <xdata created_by="OSA " created_at="Thu Nov 13 11:33:33 EST 2003">
    <rows row_count="1000 ">
    <row>
    <COL1>714761905 </COL1>
    <COL2>714761905 </COL2>
    <COL3>714761905 </COL3>
    </row>
    </xdata>

    Any advice or tips whould be very helpful...

    thanks

    Phil



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
  • Dan Guzman

    #2
    Re: Help using sp_xml_prepared ocument

    The xml doc you posted is not well-formed; it is mussing the </rows> end
    tag. In any case, the @doc parameter specifies the actual xml text, not
    the path a file containing xml.

    --
    Hope this helps.

    Dan Guzman
    SQL Server MVP

    -----------------------
    SQL FAQ links (courtesy Neil Pike):




    -----------------------

    "no spam" <anonymous@devd ex.com> wrote in message
    news:3fb4f782$0 $198$75868355@n ews.frii.net...[color=blue]
    > Hi all,
    >
    > We are using a VB component to create and save an XML document on our
    > local LAN.
    >
    > We want to load this straight into a DB Table using a query based on
    > OPENXML. Trouble is, the sp_xml_prepared ocument command always throws[/color]
    an[color=blue]
    > error.
    >
    > Here is some code:
    >[color=green][color=darkred]
    > >>>> CODE >>>>[/color][/color]
    > DECLARE @idoc int
    > DECLARE @doc varchar(1000)
    >
    > EXEC sp_xml_prepared ocument @idoc OUTPUT, @doc
    > <<<< END OF CODE <<<<
    >
    > where @doc is the filename of our file on the LAN to be opened, and
    > @idoc is the handle to be created.
    >
    > the error is:
    > XML parsing error: Invalid at the top level of the document.
    >
    > Here is some of the XML Document saved on the LAN that should be[/color]
    opened[color=blue]
    > by sp_xml_prepared ocument and prepared.
    >
    > <?xml version="1.0" encoding="UTF-8" ?>
    > <xdata created_by="OSA " created_at="Thu Nov 13 11:33:33 EST 2003">
    > <rows row_count="1000 ">
    > <row>
    > <COL1>714761905 </COL1>
    > <COL2>714761905 </COL2>
    > <COL3>714761905 </COL3>
    > </row>
    > </xdata>
    >
    > Any advice or tips whould be very helpful...
    >
    > thanks
    >
    > Phil
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it![/color]


    Comment

    Working...