How to serialize correct XML headers

All,
I am trying to generate the following header when serializing a class
to XML

<FpML
 version="4-0"
 xsi:type="TradeAffirmation"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.fpml.org/2003/FpML-4-0
fpml-main-4-0.xsd"
 xmlns="http://www.fpml.org/2003/FpML-4-0">
</FpML>

The class is currently declared as:
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.fpml.org/2003/FpML-4-0"),
_
 System.Xml.Serialization.XmlRootAttribute([DataType]:="TradeAffirmation")>
 _
Public Class FpML
End Class


This generates the following:
<FpML xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</FpML>

I am unsure how to get my code to generate the header correctly. Any
ideas?

Many thanks
Paul



----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
0
1/5/2004 5:57:20 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
331 Views

Similar Articles

[PageSpeed] 34

PMNorris,
This class should get you the header you're looking for:

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.fpml.org
/2003/FpML-4-0")> _
Public Class FpML
        <XmlAttributeAttribute()> _
        Public version As String = "4.0"

<XmlAttributeAttribute([Namespace]:="http://www.w3.org/2001/XMLSchema-instan
ce")> _
        Public schemaLocation As String =
"http://www.fpml.org/2003/FpML-4-0fpml-main-4-0.xsd"

<XmlAttributeAttribute([Namespace]:="http://www.w3.org/2001/XMLSchema-instan
ce")> _
        Public type As String = "TradeAffirmation"
End Class

To add the default namespace declaration, you need to pass the name of the
default namespace to the constructor of the XmlSerializer like this:
Dim ser As New XmlSerializer(GetType(FpML),
"http://www.fpml.org/2003/FpML-4-0")

-- 
HTH
Christoph Schittko [MVP, XmlInsider]
Software Architect, .NET Mentor

"PMNorris" <paul.norris@uk.nomura-dot-com.no-spam.invalid> wrote in message
news:3ff9a580$1_2@127.0.0.1...
> All,
> I am trying to generate the following header when serializing a class
> to XML
>
> <FpML
>  version="4-0"
>  xsi:type="TradeAffirmation"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xsi:schemaLocation="http://www.fpml.org/2003/FpML-4-0
> fpml-main-4-0.xsd"
>  xmlns="http://www.fpml.org/2003/FpML-4-0">
> </FpML>
>
> The class is currently declared as:
>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.fpml.org
/2003/FpML-4-0"),
> _
>
System.Xml.Serialization.XmlRootAttribute([DataType]:="TradeAffirmation")>
>  _
> Public Class FpML
> End Class
>
>
> This generates the following:
> <FpML xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> </FpML>
>
> I am unsure how to get my code to generate the header correctly. Any
> ideas?
>
> Many thanks
> Paul
>
>
>
> ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet
News==----
> http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000
Newsgroups
> ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption
=---


0
1/7/2004 4:18:05 AM
Reply:

Similar Artilces:

Sort Xml using XpathExpression Addsort() #2
hi, i have a xml file <root> <Type /> <Description /> <Category /> <employee > <id>3</id> </employee> <employee> <id>1</id> </employee> <employee> <id>5</id> </employee> </root> and i want output xml as <root> <Type /> <Description /> <Category /> <employee > <id>1</id> </employee> <employee> <id>3</id> </employee> <employee> <id>5</id> </employee> </root> that is i want updated xml to ret...

Price from database does not showup correctly in POS
When I try to ring up items in the POS the sale price of some items does not showup correctly in POS. It shows a totally different sale price which is sometimes less or sometimes more than the sale price in the database. I always bachup my database and also refresh the Sql server but the problem continues. Does anybody has a solution to this. Regards, Nitin Try reindexing the DB in SO Administrator - Database/Reindex Other than that, can you provide more details? Have you set up customers with Discount Percentages or Price Levels? -- Glenn Adams Tiber Creek Consulting http://www.t...

change horizontal header position in excel
Anyone know how to change the horizontal position of the HEADER or FOOTER in EXCEL???? I would greatly appreciate any help. Thank you for your time. pico Wrote: > Anyone know how to change the horizontal position of the HEADER o > FOOTER in > EXCEL???? I would greatly appreciate any help. Thank you for your time. Pico, Can't you go into View/Header-Footer and use the "Left-Center-Right" catagories? You could use spaces in front of your data to move back an forth. Dav -- Piranh ----------------------------------------------------------------------- Piranha's Profi...

Write XML File to Web Server File Problems
Hello All, I am about to go mad because of the wonderful error messages that don't provide enough detail. Below is the code I am trying to use to take an updated dataset and write it back to a file on a web server.... ' Create WebClient Dim oClient As New WebClient oClient.Credentials = CredentialCache.DefaultCredentials 'Create Output Stream Dim oStream As Stream = oClient.OpenWrite(sFileUrl, "PUT") ' Create the StreamWriter Dim oXMLTextWriter = New System.Xml.XmlTextWriter(oStream, System.Text.Encodin...

Strange issue with OWA not displaying correctly.
Hi, Working on a Exchange 2003 sp1 server. When OWA is launched and the credentials are entered, the next screen looks almost like a "FTP" site! Any ideas where to start looking? Thanks Do you have the Directory Browsing option selected on the default web site (and hence the Exchange virtual directories under it)? -- Neil Hobson Exchange MVP For Exchange news, links, and tips, check: http://www.msexchangeblog.com "Pete" <Pete@discussions.microsoft.com> wrote in message news:EEF3DF67-9793-4896-9FAC-158100D1F322@microsoft.com... > Hi, > Working on a Exc...

[ANN] Mvp.Xml library v2.0 released
I'm glad to announce release 2.0 of the Mvp.Xml library. This is first Mvp.Xml release for .NET 2.0. Download it at http://www.mvpxml.org Mvp.Xml project is developed by Microsoft MVPs in XML technologies and XML Web Services worldwide. It is aimed at supplementing .NET framework XML processing functionality available through the System.Xml namespace and related namespaces such as System.Web.Services. Mvp.Xml project currently provides .NET implementations of EXSLT, XML Base, XInclude, XPointer as well as a unique set of utility classes such as XmlSerializerCache, IndexingXPathNavi...

Display Report Header/Footer
Can somebody please give me the telephone number of the smartass MS VP who came up with the bright idea for the Ribbon so that I can call her and have her tell me how to display the Report Header & Footer in a report? Obviously, I must be an idiot because I can't figure out how to do it with this simplied, intuitive, help-ya out m***** fu***** ribbon. Oh stupid me, its under 'ARRANGE'. How idiotic of me to think that it'd under 'DESIGN' since I'm 'designing' a report as opposed to 'arrangeing' a report. "microsoft"...

2003 Outlook email only downloads headers, not the full message
When I attempt to open an email I receive " This is a message header. The full item has not been downloaded." At INBOX, ALT CTRL-S >SEND/RECEIVE GROUP>All Accounts>EDIT >displays an option to display headers only or the entire message including the attachment. In the grayed out area, I can see that a dot in the display headers only section. Due to the gray out I cannot chooose the alternate selection. How can I access the alternate choice? Which mail account type are you using? -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft O...

"could not fetch new headers " ERROR
i get the error " could not fetch new headers in the inbox of IMA server.The operation was cancelled ", while using my outlook 2000 o win98se mach. config: smtp/imap thro internet mail a/c option pl try to provide solutions to it. the error message pops up say every 5 min whenever outlook is on. thnks n regards gir ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com aggiridharan <aggiridharan.149yy0@outlookforum.com> wrote: > i get the error " coul...

Use this corrective patch for Microsoft Internet Explorer
--dehdrxlteiunzwt Content-Type: multipart/related; boundary="tjlpwlnqb"; type="multipart/alternative" --tjlpwlnqb Content-Type: multipart/alternative; boundary="trnphlnmjqdylgrvi" --trnphlnmjqdylgrvi Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Client this is the latest version of security update, the "December 2003, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to help maintain the security of your computer f...

OWA Premium Client Not Displaying Correctly
Hello, I wonder whether anyone has seen this problem before because i would really appreciate any help on this one please. I have six Exchange 2003 servers in my organisation and there are two Exchange servers in three sites. Four of the Exchange servers are running Windows Server 2003 and Exchange Server 2003 [With Exchange SP1]. The front-end server is running Windows Server 2003 SP1 and Exchange Server 2003 SP2. Users with mailboxes on those four Back-End Exchange servers do not have any problems using OWA. The two Exchange servers on my site are using Windows Server 2003 SP1 with Exc...

Apply Headers and Footers
Is there a way to apply a header and a footer to each worksheet without typing it in for each worksheet Try grouping the sheets. rightclick on any tab and choose "select all sheets" then apply your header/footer then rightclick on any tab and choose "ungroup sheets" Pa Maher wrote: > > Is there a way to apply a header and a footer to each worksheet without > typing it in for each worksheet -- Dave Peterson ...

Long Run Times Importing XML Files
When importing a large number of XML files (typically 10,000+) using a predefined schema, EXCEL 2007spends CPU-hours doing God-only-knows-what before it actually starts to read the XML files from disk. (This occurs on Intel-based systems running Q9650's at 3GHz.) Win/XP's Task Manager shows not a single I/O read nor write operation going on for the several hours after you click on OK in the XML file selection dialog. Once it actually starts importing the data (ref. "Importing" message in status bar) the operation proceeds very quickly to completion. Any ideas what it'...

serialization question #2
Hello, I have such question. I want to create SDI application to work with matix. I have a data that stored in the file in the form of the matrix: 1 2 3 4 5 6 7 8 9 0 1 2 or something like this one. The nambers of colonms and rows may vary. How can I read this file (serialize) and store each number in CArray for example? Thank you very much in advance Igor igor tarasov wrote: > Hello, > I have such question. I want to create SDI application to work with matix. I > have a data that stored in the file in the form of the matrix: > 1 2 3 4 > 5 6 7 8 > 9 0 1 2 > or someth...

SBS 2k3, Exchange 2k3 SP2, IMF SCL header not added.
I've read that a Spam Confidence Level indicator should be added to the headers of incoming mail. When viewing the Internet headers of mail I can't find the SCL score, on either normal mail, or mail that has be re-routed to users junk mail folders. I don't delete/block/archive any mail, just let it through. (Current settings are #1 SCL >9 allow through, #2 SCL >4 re-route) Do I need to activate this option somewhere? If it makes any difference, incoming mail is passed through an e-mail proxy first... Cheers, Box - SCL is not inserted in message headers, it's...

How to prevent line breaks in XML file?
I am creating XML from SQL2000 using a vb.net page, then posting it to a remote server as a string. The remote server requires that the xml contain no line breaks, but there are some ntext fields in the database that contain long text with line breaks. How do I get rid of the line breaks? Can I do this with the XmlTextWriter, or do I need to handle each affected field seperately before handing it to the XmlTextWriter? Thanks Leslie les wrote: > How do I get rid of the line breaks? Can I do this with the > XmlTextWriter, or do I need to handle each affected field seperately > bef...

Accessing Headers?
Is there anyway programatically to access the Internet Headers of an email message when they come in? (See below for exmaple) I would like a script / rule to process on the domainkeys=fail (bad syntax) since I seem to be getting a lot of blank email with that... Thanks Peter Ferris X-Apparently-To: p.ferris@rogers.com via 206.190.37.193; Sun, 18 Jun 2006 10:43:39 -0700 X-YahooFilteredBulk: 200.112.133.3 X-Originating-IP: [200.112.133.3] Authentication-Results: mta109.rog.mail.scd.yahoo.com domainkeys=fail (bad syntax) Received: from 200.112.133.3 (HELO guidanceny.com) (200.112.133.3) ...

Transform fixed length text to xml
can i transform fixed length text to xml using XSL do i have to first load the text to xml and do the transformation? is there any other way to do it? ...

xml edit #2
I am trying to edit an xml receipt in notepad..whenever I try to save I can't save as a xml file ..it wants to save as a text file..How can I save as a xml file? -- billr You can just change the extension manually after you save it. Example - File saves as "report.txt" Rename it to "report.xml" and that's all there is to it. Billr, Try doing a Ctrl+S to save it. It should save it as the name it opened. Are you using a Notepad replacement program? Help | About | should say "Microsoft Notepad" -- * Get Secure! - www.microsoft.com/security Yo...

XML without formatting
Excel 2000 provides a nice way to edit XML. However, the problem is that is adds all of this Microsoft formatting stuff (kind of like it does with html). I can open an XML document in Excel make no changes and save it, and the resulting file will be unreadable by the application it came from. I've tried this with 2 different apps. Is there any way to save an XML document in Excel without all of the Microsoft formatting? i would reccomend using the latest version for XML XML is a disease; but so is XLS so I think that maybe it would be a good match ...

formatting xml document dynamically
Hello All, I have an asp.net search application that brings up a datagrid of results, with one of the fields being a hyperlink to an XML document, of which there are thousands. By clicking this link, the browser loads the XML document in its raw form. My question is, how do I use some of these formatting techniques (XSL etc) to format this XML the way I want to, after the link is clicked on? A nudge in the right direction would be appreciated, as I can't seem to find any example of what I am doing. Thanks Miki HI Miki, You should be able to use the XslTransform class. Below is an ex...

how to turn off email header with excel workbook
Working with Excel spreadsheet and somehow the spreadsheet gets imbedded (?) into an email message waiting to be sent. How do I turn this off of get it back to being just a spreadsheet? I'm using off 2003 with Business Contact Manager. ...

Change Header of mail in outlook
Hello, Excuse for my very bad englis. I want to change the header of mail for grouping the mail in my outllook windows Somme mail are "Patric DES_DUB@xxx.com" another mails are "Patric DES DUB@xxx.com", another "DES DUB Patric@xxx.com" or "DES_DUB Patric@xxx.com" but it'a same personne. When Oulook group the mail by the sender, it finds four sender but it's the same. Ths is why, i want make some programm to change in a email objet the sender to have the same. Thank's ...

reading an xml file problem
Hi I have an app that uses xpath to read an xml document. The problem is a 70meg file uses 1.5 gig of memory. What I really need is to read only chunks of the file at a given time and cannot afford the overhead of reading in 1.5 gig of memory. A simplified example would be an xml file of 100 rows that I wanted to return random chunks of records without reading in all 100 rows each time. I would have a row number and a set number of rows to return. Any help to solve this would be great. Robin adhag wrote: > I have an app that uses xpath to read an xml document. The problem ...

want header stay stay when scrolling
I am battling to get the heading of the page to stay when previewing site design, how do I freeze the header or top pics You'd need to use frames, Pub doesn't "do" frames...except for iframes. ps... frames are bad news, you shouldn't use them unless you are prepared to deal with problems they can cause. "Mark" <Mark@discussions.microsoft.com> wrote in message news:1A34CB04-C8D3-4FCA-97DB-7E16E6EB7623@microsoft.com... |I am battling to get the heading of the page to stay when previewing site | design, how do I freeze the header or top pics Rob, ...