Monday, February 20, 2012
LoadReportDefinition->Root element is missing!?
I try to load a RDL-File by code with the following statement:
rpvReport.ServerReport.LoadReportDefinition(strReader);
Unfortunaltely the following error occurs "Root element is missing"
(see more beneath).
I dont get the point as in my eyes the rdl (xml) files i tried are
well-formed.
Also when I upload them by the report manager they are created without
any problems.
Does anybody have a clue where the bug could be?
THX a lot for any help!!
Cheers
Marc
RDL-FILE:
---
<?xml version=3D"1.0" encoding=3D"utf-8"?>
<Report
xmlns=3D"http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdef= inition"
xmlns:rd=3D"http://schemas.microsoft.com/SQLServer/reporting/reportdesigner= ">
<PageWidth>7.5 in</PageWidth>
<ReportParameters>
</ReportParameters>
<LeftMargin>0.5 in</LeftMargin>
<RightMargin>0.5 in</RightMargin>
<TopMargin>0.5 in</TopMargin>
<BottomMargin>0.3 in</BottomMargin>
<PageHeader>
<Height>1 in</Height>
<ReportItems>
<Textbox Name=3D"Label13">
<Value>PAGE HEADER CONTROL</Value>
</Textbox>
</ReportItems>
</PageHeader>
<Body>
<ReportItems>
<Line Name=3D"BodyLine">
</Line>
</ReportItems>
<Height>1 in</Height>
<Style />
</Body>
<PageFooter>
<Height>0.17 in</Height>
<ReportItems>
<Textbox Name=3D"Label18">
<Value>PAGE FOOTER CONTROL</Value>
</Textbox>
</ReportItems>
</PageFooter>
</Report>
----
ERROR-MESSAGE:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 09.10.2006 18:37:19
Event time (UTC): 09.10.2006 16:37:19
Event ID: f84f56da10ee4e3991c3de6244b58009
Event sequence: 36
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: cab7894e-6-128048849773258592
Trust level: Full
Application Virtual Path: /
Application Path: C:\_workspace\RenoSF.Reporting\Controls\
Machine name: MTHIERRTCB2TR
Process information:
Process ID: 3600
Process name: WebDev.WebServer2.exe
Account name: DELTA_ZUG\mthierer
Exception information:
Exception type: ReportServerException
Exception message: Die Berichtsdefinition ist ung=FCltig. Details:
Root element is missing. (rsInvalidReportDefinition)
Request information:
Request URL: http://localhost:1831/default.aspx
Request path: /default.aspx
User host address: 127.0.0.1
User: DELTA_ZUG\mthierer
Is authenticated: True
Authentication Type: NTLM
Thread account name: DELTA_ZUG\mthierer
Thread information:
Thread ID: 4
Thread account name: DELTA_ZUG\mthierer
Is impersonating: False
Stack trace: at
Microsoft.Reporting.WebForms.ServerReport.LoadReportDefinition(TextReader
report)
at
RTC.SharePoint.RenoSF.Reporting.BasisReports.ReportFormControls.ReportViewe= r=2ELoadDefinition(List`1
list, String rdl) in
C:\_workspace\RenoSF.Reporting\Controls\ReportFormControls\ReportViewer.asc= x=2Ecs:line
90
at
RTC.SharePoint.RenoSF.Reporting.BasisReports.ReportFormControls.ReportViewe= r=2EBtnCreateReportClick(Object
sender, EventArgs e) in
C:\_workspace\RenoSF.Reporting\Controls\ReportFormControls\ReportViewer.asc= x=2Ecs:line
138
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaiseP= ostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)ReportingService2005 rs = new ReportingService2005();
byte[] b = rs.GetReportDefinition("/ReportServer/RolesReport");
MemoryStream strm = new MemoryStream(b);
XmlDocument doc = new XmlDocument();
doc.Load(strm);
// modify xml for ad-hoc report
MemoryStream strmOut = new MemoryStream();
doc.Save(strmOut);
strmOut.Position = 0; // must call this
this.rvReport.ProcessingMode =Microsoft.Reporting.WebForms.ProcessingMode.Remote;
this.rvReport.ServerReport.ReportServerUrl = new
Uri("http://localhost/ReportServer");
this.rvReport.ServerReport.ReportPath = "/ReportServer/RolesReport";
this.rvReport.ServerReport.LoadReportDefinition(strmOut);
System.Diagnostics.Debug.WriteLine(this.rvReport.ServerReport.GetExecutionId());
strm.Close();
strmOut.Close();
I think you lost " strmOut.Position = 0";
--sidney
"Marc" wrote:
> Hi all,
> I try to load a RDL-File by code with the following statement:
> rpvReport.ServerReport.LoadReportDefinition(strReader);
> Unfortunaltely the following error occurs "Root element is missing"
> (see more beneath).
> I dont get the point as in my eyes the rdl (xml) files i tried are
> well-formed.
> Also when I upload them by the report manager they are created without
> any problems.
> Does anybody have a clue where the bug could be?
> THX a lot for any help!!
> Cheers
> Marc
>
> RDL-FILE:
> ---
> <?xml version="1.0" encoding="utf-8"?>
> <Report
> xmlns="http://schemas.microsoft.com/sqlserver/reporting/2003/10/reportdefinition"
> xmlns:rd="">http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
> <PageWidth>7.5 in</PageWidth>
> <ReportParameters>
> </ReportParameters>
> <LeftMargin>0.5 in</LeftMargin>
> <RightMargin>0.5 in</RightMargin>
> <TopMargin>0.5 in</TopMargin>
> <BottomMargin>0.3 in</BottomMargin>
> <PageHeader>
> <Height>1 in</Height>
> <ReportItems>
> <Textbox Name="Label13">
> <Value>PAGE HEADER CONTROL</Value>
> </Textbox>
> </ReportItems>
> </PageHeader>
> <Body>
> <ReportItems>
> <Line Name="BodyLine">
> </Line>
> </ReportItems>
> <Height>1 in</Height>
> <Style />
> </Body>
> <PageFooter>
> <Height>0.17 in</Height>
> <ReportItems>
> <Textbox Name="Label18">
> <Value>PAGE FOOTER CONTROL</Value>
> </Textbox>
> </ReportItems>
> </PageFooter>
> </Report>
> ----
>
> ERROR-MESSAGE:
> Event code: 3005
> Event message: An unhandled exception has occurred.
> Event time: 09.10.2006 18:37:19
> Event time (UTC): 09.10.2006 16:37:19
> Event ID: f84f56da10ee4e3991c3de6244b58009
> Event sequence: 36
> Event occurrence: 1
> Event detail code: 0
> Application information:
> Application domain: cab7894e-6-128048849773258592
> Trust level: Full
> Application Virtual Path: /
> Application Path: C:\_workspace\RenoSF.Reporting\Controls\
> Machine name: MTHIERRTCB2TR
> Process information:
> Process ID: 3600
> Process name: WebDev.WebServer2.exe
> Account name: DELTA_ZUG\mthierer
> Exception information:
> Exception type: ReportServerException
> Exception message: Die Berichtsdefinition ist ungültig. Details:
> Root element is missing. (rsInvalidReportDefinition)
> Request information:
> Request URL: http://localhost:1831/default.aspx
> Request path: /default.aspx
> User host address: 127.0.0.1
> User: DELTA_ZUG\mthierer
> Is authenticated: True
> Authentication Type: NTLM
> Thread account name: DELTA_ZUG\mthierer
> Thread information:
> Thread ID: 4
> Thread account name: DELTA_ZUG\mthierer
> Is impersonating: False
> Stack trace: at
> Microsoft.Reporting.WebForms.ServerReport.LoadReportDefinition(TextReader
> report)
> at
> RTC.SharePoint.RenoSF.Reporting.BasisReports.ReportFormControls.ReportViewer.LoadDefinition(List`1
> list, String rdl) in
> C:\_workspace\RenoSF.Reporting\Controls\ReportFormControls\ReportViewer.ascx.cs:line
> 90
> at
> RTC.SharePoint.RenoSF.Reporting.BasisReports.ReportFormControls.ReportViewer.BtnCreateReportClick(Object
> sender, EventArgs e) in
> C:\_workspace\RenoSF.Reporting\Controls\ReportFormControls\ReportViewer.ascx.cs:line
> 138
> at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
> at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
> eventArgument)
> at
> System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
> eventArgument)
> at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
> sourceControl, String eventArgument)
> at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
> postData)
> at System.Web.UI.Page.ProcessRequestMain(Boolean
> includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
>
Loading XML to SLQ Server
For example just a single XML file..
thanks
Posted using Wimdows.net NntpNews Component -
Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching.
A previous post to the newsgroup:
"In SQL Server 2000 you have two main options - using the OPENXML technology
or using the SQLXML BulkLoad technology. Choosing between these two options
is largely a matter of personal choice in terms of what technologies you
feel most comfortable with. OPENXML is a technology that runs in the server
while and requires a reasonable level of familiarity with T-SQL. SQLXML
BulkLoad runs on the client and requires no T-SQL but you need to generate
an Annotated XSD to determine the mapping between the XML and the database.
One other thing to consider is the size of the data being loaded. OPENXML
loads the entire XML into memory on the server so if you are loading large
amounts of data you may want to go with a BulkLoad solution.
You can get more information on OPENXML in SQL BOL or online at
http://msdn.microsoft.com/library/de...oa-oz_5c89.asp
SQLXML documentation is at
http://msdn.microsoft.com/library/de...nch_SQLXML.asp
or you can check out http://www.sqlxml.org/ for some extra info on these
technologies."
I should also add that if you want to develop your application by using
..Net, you may want to use Dataset as well. Dataset has also a drawback of
loading all data into memory similar to OpenXml.
Bertan ARI
This posting is provided "AS IS" with no warranties, and confers no rights.
"SqlJunkies User" <User@.-NOSPAM-SqlJunkies.com> wrote in message
news:OKM$bJGoEHA.4068@.tk2msftngp13.phx.gbl...
> Whats the best way to load XML into SQL Server..
> For example just a single XML file..
> thanks
> --
> Posted using Wimdows.net NntpNews Component -
> Post Made from http://www.SqlJunkies.com/newsgroups Our newsgroup engine
supports Post Alerts, Ratings, and Searching.
loading xml into SQL 2000
I have some xml files that I want to load into SQL tables. I can use OPENXML and create the table fields and load the document just fine. BUT, is there a way to 1) call the location of the xml document rather than paste all the code and 2) have the table created for me? Below is a SQL example. LMK what you think.
Declare @.idoc int
Declare @.xmldoc varchar (8000)
set @.xmldoc = '
<?xml version="1.0" encoding="utf-8"?>
<ROOT>
<general>
<full_destination_name>London</full_destination_name>
<intro_mini>
London''s contrasts and cacophonies both infuriate and seduce.
</intro_mini>
<intro_short>
London - the grand resonance of its very name suggests history and might. Its opportunities for entertainment by day and night go on and on and on. It''s a city that exhilarates and intimidates, stimulates and irritates in equal measure, a grubby Monopoly board studded with stellar sights.
</intro_short>
<intro_medium>
It''s a cosmopolitan mix of Third and First Worlds, chauffeurs and beggars, the stubbornly traditional and the proudly avant-garde. But somehow - between ''er Majesty and Boy George, Damien Hirst and JMW Turner, Bow Bells and Big Ben - it all hangs together.
</intro_medium>
<intro_quote>
''When a man is tired of London, he is tired of life; for there is in London all that life can afford.'' - Samuel Johnson
</intro_quote>
<timezones>
<timezone>
<gmt_utc>0</gmt_utc>
<timezone_name>Greenwich Mean Time</timezone_name>
</timezone>
</timezones>
<daylight_savings_start>last Sunday in March</daylight_savings_start>
<daylight_savings_end>last Sunday in October</daylight_savings_end>
</general>
</ROOT>'
EXEC sp_xml_preparedocument @.idoc OUTPUT, @.xmldoc
INSERT INTO General
SELECT * FROM OPENXML(@.idoc, 'ROOT/general',3)
WITH General
EXEC master.dbo.sp_xml_removedocument @.idoc
actually, now I load the xml into MS Visual Studio and create the xsd from there. I then load it into a VB Script and successfully execute a DTS package. Question is, where is the table, data?
Here's the xsd file:
<?xml version="1.0" ?>
<xschema id="events" targetNamespace="http://tempuri.org/events.xsd" xmlns:mstns="http://tempuri.org/events.xsd"
xmlns="http://tempuri.org/events.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urnchemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="events" msdata:IsDataSet="true" msdata:EnforceConstraints="False">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="event">
<xs:complexType>
<xsequence>
<xs:element name="event_name" type="xstring" minOccurs="0" />
<xs:element name="event_from_date" type="xstring" minOccurs="0" />
<xs:element name="event_type" nillable="true" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xsimpleContent msdata:ColumnName="event_type_Text" msdata:Ordinal="1">
<xs:extension base="xstring">
<xs:attribute name="node_id" form="unqualified" type="xstring" />
</xs:extension>
</xsimpleContent>
</xs:complexType>
</xs:element>
</xsequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xschema>
and here's the VB Script:
'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
Function Main()
Main = DTSTaskExecResult_Success
Dim objXBulkLoad
Set objXBulkLoad = CreateObject("SQLXMLBulkLoad.SQLXMLBulkLoad")
objXBulkLoad.ConnectionString = "PROVIDER=SQLOLEDB.1;SERVER=SQL-DEV;UID=;PWD=;DATABASE=SQLDBA;"
objXBulkLoad.KeepIdentity = False
'Optional Settings
objXBulkLoad.ErrorLogFile = "c:\temp\NWError.LOG"
objXBulkLoad.TempFilePath = "c:\temp"
'Executing the bulk-load
objXBulkLoad.Execute "C:\TEMP\xml\test_xml\events.xsd", "C:\TEMP\xml\test_xml\events.xml"
Main = DTSTaskExecResult_Success
End Function
shouldn't there now be an events and events and event_type table present?
loading xml file with sp_xml_preparedocument
sp_xml_preparedocument.
In SQL Server 2000: Yes, if you read the file in an ADO/OLEDB program and
pass the content to a stored proc.
In SQL Server 2005: Yes, use OpenROWSET(BULK)
Best regards
Michael
"ed" <anonymous@.discussions.microsoft.com> wrote in message
news:990d01c433c3$ffe2f600$a101280a@.phx.gbl...
> is it possible to load a file containing xml data with
> sp_xml_preparedocument.
Loading XML data using DTS.
document.
Everything works fine except that of the date field. For instance, I have defined it as
<ReceivedDate>2004-03-29</ReceivedDate>
However, once it is loaded into the temporary table it is saved as
<ReceivedDate>2004-29-03</ReceivedDate>
I think I am missing something. Please help.
Thanks,
MZeeshan
I'm new at XML, but what I've played with so far, SQL does not create a
root element for your xml file. It looks like it's using the first
record's properties/child elements to name your table?
Robert
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!
|||Well... I ve created a table myself for getting the parsed data. I am getting that through SQL server provided T-SQL utility OPENXML. That is working fine. However, there is some problem in transformation.
|||This is unrelated to the DTS question.
You can add a root element using the root node property of ADO/OLEDB/URL
queries, use an explicit mode query to add it or (only available in the
upcoming SQL Server 2005) use the ROOT directive on a FOR XML clause.
Best regards
Michael
"Robert Taylor" <anonymous@.devdex.com> wrote in message
news:ejkj$lpQEHA.1440@.TK2MSFTNGP10.phx.gbl...
> I'm new at XML, but what I've played with so far, SQL does not create a
> root element for your xml file. It looks like it's using the first
> record's properties/child elements to name your table?
> Robert
>
> *** Sent via Developersdex http://www.codecomments.com ***
> Don't just participate in USENET...get rewarded for it!