Hi,
I have the following code that creates an XML file.
AdoCn = New SqlConnection(DSN)
AdoCn.Open()
SQLAdap = New SqlDataAdapter(SQL, AdoCn)
SQLAdap.Fill(DataS, WebServiceID)
SQLAdap.Dispose()
DataS.WriteXml(XMLPath)
This outputs the following XML file:
<?xml version="1.0" standalone="yes" ?>
- <datareader>
- <_x0031_088>
<UserName>uname</UserName>
<Password>pwd</Password>
<Event_ID>43687</Event_ID>
<Spirit_ID>17219</Spirit_ID>
<EstablishmentFullName>Gravesend Grammar School</EstablishmentFullName>
<Postcode>DA12 2PR</Postcode>
<Type_ID>10</Type_ID>
<Sub_Type>A: Active</Sub_Type>
<UserName1>Jason Gould</UserName1>
<StartDate>30/Aug/2004 00:00:00</StartDate>
<Due_Date>01/Sep/2004 00:00:00</Due_Date>
<Priority>1</Priority>
<Status>A</Status>
<Event_Name>TEST</Event_Name>
<ActionUser>Jason Gould</ActionUser>
<ActionDate>01/Sep/2004 00:00:00</ActionDate>
<MarketingAuditId>27494</MarketingAuditId>
</_x0031_088>
- <_x0031_088>
<UserName>uname</UserName>
<Password>pwd</Password>
<Event_ID>43687</Event_ID>
<Spirit_ID>17219</Spirit_ID>
<EstablishmentFullName>Gravesend Grammar School</EstablishmentFullName>
<Postcode>DA12 2PR</Postcode>
<Type_ID>10</Type_ID>
<Sub_Type>A: Active</Sub_Type>
<UserName1>Jason Gould</UserName1>
<StartDate>30/Aug/2004 00:00:00</StartDate>
<Due_Date>01/Sep/2004 00:00:00</Due_Date>
<Priority>1</Priority>
<Status>A</Status>
<Event_Name>TEST</Event_Name>
<ActionUser>Barbara Spork</ActionUser>
<Narrative>wrfewgwr</Narrative>
<ActionDate>30/Aug/2004 11:31:26</ActionDate>
<MarketingAuditId>27495</MarketingAuditId>
</_x0031_088>
</datareader>
However I want the output to look like this
<?xml version="1.0" standalone="yes" ?>
- <datareader xmlns="- <_x0031_088>
<UserName>uname</UserName>
<Password>pwd</Password>
<Event_ID>43687</Event_ID>
<Spirit_ID>17219</Spirit_ID>
<EstablishmentFullName>Gravesend Grammar School</EstablishmentFullName>
<Postcode>DA12 2PR</Postcode>
<Type_ID>10</Type_ID>
<Sub_Type>A: Active</Sub_Type>
<UserName1>Jason Gould</UserName1>
<StartDate>30/Aug/2004 00:00:00</StartDate>
<Due_Date>01/Sep/2004 00:00:00</Due_Date>
<Priority>1</Priority>
<Status>A</Status>
<Event_Name>TEST</Event_Name>
<ActionUser>Jason Gould</ActionUser>
<ActionDate>01/Sep/2004 00:00:00</ActionDate>
<MarketingAuditId>27494</MarketingAuditId>
</_x0031_088>
- <_x0031_088>
<UserName>uname</UserName>
<Password>pwd</Password>
<Event_ID>43687</Event_ID>
<Spirit_ID>17219</Spirit_ID>
<EstablishmentFullName>Gravesend Grammar School</EstablishmentFullName>
<Postcode>DA12 2PR</Postcode>
<Type_ID>10</Type_ID>
<Sub_Type>A: Active</Sub_Type>
<UserName1>Jason Gould</UserName1>
<StartDate>30/Aug/2004 00:00:00</StartDate>
<Due_Date>01/Sep/2004 00:00:00</Due_Date>
<Priority>1</Priority>
<Status>A</Status>
<Event_Name>TEST</Event_Name>
<ActionUser>Barbara Spork</ActionUser>
<Narrative>wrfewgwr</Narrative>
<ActionDate>30/Aug/2004 11:31:26</ActionDate>
<MarketingAuditId>27495</MarketingAuditId>
</_x0031_088>
</datareader>
Note: I have added the namespace xmlns=" at the top by the datareader opening tag.
I have had a search around but can't find anything obvious.
thanks
I have the following code that creates an XML file.
AdoCn = New SqlConnection(DSN)
AdoCn.Open()
SQLAdap = New SqlDataAdapter(SQL, AdoCn)
SQLAdap.Fill(DataS, WebServiceID)
SQLAdap.Dispose()
DataS.WriteXml(XMLPath)
This outputs the following XML file:
<?xml version="1.0" standalone="yes" ?>
- <datareader>
- <_x0031_088>
<UserName>uname</UserName>
<Password>pwd</Password>
<Event_ID>43687</Event_ID>
<Spirit_ID>17219</Spirit_ID>
<EstablishmentFullName>Gravesend Grammar School</EstablishmentFullName>
<Postcode>DA12 2PR</Postcode>
<Type_ID>10</Type_ID>
<Sub_Type>A: Active</Sub_Type>
<UserName1>Jason Gould</UserName1>
<StartDate>30/Aug/2004 00:00:00</StartDate>
<Due_Date>01/Sep/2004 00:00:00</Due_Date>
<Priority>1</Priority>
<Status>A</Status>
<Event_Name>TEST</Event_Name>
<ActionUser>Jason Gould</ActionUser>
<ActionDate>01/Sep/2004 00:00:00</ActionDate>
<MarketingAuditId>27494</MarketingAuditId>
</_x0031_088>
- <_x0031_088>
<UserName>uname</UserName>
<Password>pwd</Password>
<Event_ID>43687</Event_ID>
<Spirit_ID>17219</Spirit_ID>
<EstablishmentFullName>Gravesend Grammar School</EstablishmentFullName>
<Postcode>DA12 2PR</Postcode>
<Type_ID>10</Type_ID>
<Sub_Type>A: Active</Sub_Type>
<UserName1>Jason Gould</UserName1>
<StartDate>30/Aug/2004 00:00:00</StartDate>
<Due_Date>01/Sep/2004 00:00:00</Due_Date>
<Priority>1</Priority>
<Status>A</Status>
<Event_Name>TEST</Event_Name>
<ActionUser>Barbara Spork</ActionUser>
<Narrative>wrfewgwr</Narrative>
<ActionDate>30/Aug/2004 11:31:26</ActionDate>
<MarketingAuditId>27495</MarketingAuditId>
</_x0031_088>
</datareader>
However I want the output to look like this
<?xml version="1.0" standalone="yes" ?>
- <datareader xmlns="- <_x0031_088>
<UserName>uname</UserName>
<Password>pwd</Password>
<Event_ID>43687</Event_ID>
<Spirit_ID>17219</Spirit_ID>
<EstablishmentFullName>Gravesend Grammar School</EstablishmentFullName>
<Postcode>DA12 2PR</Postcode>
<Type_ID>10</Type_ID>
<Sub_Type>A: Active</Sub_Type>
<UserName1>Jason Gould</UserName1>
<StartDate>30/Aug/2004 00:00:00</StartDate>
<Due_Date>01/Sep/2004 00:00:00</Due_Date>
<Priority>1</Priority>
<Status>A</Status>
<Event_Name>TEST</Event_Name>
<ActionUser>Jason Gould</ActionUser>
<ActionDate>01/Sep/2004 00:00:00</ActionDate>
<MarketingAuditId>27494</MarketingAuditId>
</_x0031_088>
- <_x0031_088>
<UserName>uname</UserName>
<Password>pwd</Password>
<Event_ID>43687</Event_ID>
<Spirit_ID>17219</Spirit_ID>
<EstablishmentFullName>Gravesend Grammar School</EstablishmentFullName>
<Postcode>DA12 2PR</Postcode>
<Type_ID>10</Type_ID>
<Sub_Type>A: Active</Sub_Type>
<UserName1>Jason Gould</UserName1>
<StartDate>30/Aug/2004 00:00:00</StartDate>
<Due_Date>01/Sep/2004 00:00:00</Due_Date>
<Priority>1</Priority>
<Status>A</Status>
<Event_Name>TEST</Event_Name>
<ActionUser>Barbara Spork</ActionUser>
<Narrative>wrfewgwr</Narrative>
<ActionDate>30/Aug/2004 11:31:26</ActionDate>
<MarketingAuditId>27495</MarketingAuditId>
</_x0031_088>
</datareader>
Note: I have added the namespace xmlns=" at the top by the datareader opening tag.
I have had a search around but can't find anything obvious.
thanks