XML Header

Hi,

I have some XML doc loaded in a C# Web Service.
XmlDocument doc = new XmlDocument();
doc.LoadXml(myDoc);

Code Missing to manipulate header (I would like to replace or manupulate all
these XXXXX):
<mso-XXXXXX productversion="XXXXXX">
<mso-application progid="XXXXX"?>

doc.Save(myNewDoc);

Any idea on how to access and manipulate data within the doc header?

Thanks

vbdev


0
8/20/2004 9:42:33 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
537 Views

Similar Articles

[PageSpeed] 38


vb6dev2003 wrote:

> I have some XML doc loaded in a C# Web Service.
> XmlDocument doc = new XmlDocument();
> doc.LoadXml(myDoc);
> 
> Code Missing to manipulate header (I would like to replace or manupulate all
> these XXXXX):
> <mso-XXXXXX productversion="XXXXXX">

This simply looks like an element's start tag where the element name is 
mso-XXXXXX and where the attribute named productversion has the value 
XXXXXX so if you wanted to change the attribute value you could simply use
  element.SetAttribute("productversion", "new value")
but to change an element's name you need to create a new element with 
the new name and replace the old element with the new one.

> <mso-application progid="XXXXX"?>

Are you having processing-instructions in your XML? But that should look 
like
   <?mso-application progid="XXXXX"?>
If you have such a processing instruction it is modelled as an 
XmlProcessingInstruction instance where you can change the Data property 
as in

     XmlDocument xmlDocument = new XmlDocument();
     xmlDocument.Load(@"test2004082101.xml");
     Console.WriteLine(xmlDocument.OuterXml);
     foreach (XmlNode node in xmlDocument.ChildNodes) {
       if (node.NodeType == XmlNodeType.ProcessingInstruction) {
         XmlProcessingInstruction pi = node as XmlProcessingInstruction;
         pi.Data = "name1=\"value 1\" name2=\"value 2\"";
       }
     }
     Console.WriteLine(xmlDocument.OuterXml);

that would change the progid="XXXXX" part.

The name/target of the processing instruction cannot be changed, there 
you would need to create a new one with a new name and replace the old 
instruction node with the new one.


-- 

	Martin Honnen
	http://JavaScript.FAQTs.com/
0
mahotrash (1778)
8/21/2004 12:42:02 PM
Reply:

Similar Artilces:

XML Header
Hi, I have some XML doc loaded in a C# Web Service. XmlDocument doc = new XmlDocument(); doc.LoadXml(myDoc); Code Missing to manipulate header (I would like to replace or manupulate all these XXXXX): <mso-XXXXXX productversion="XXXXXX"> <mso-application progid="XXXXX"?> doc.Save(myNewDoc); Any idea on how to access and manipulate data within the doc header? Thanks vbdev vb6dev2003 wrote: > I have some XML doc loaded in a C# Web Service. > XmlDocument doc = new XmlDocument(); > doc.LoadXml(myDoc); > > Code Missing to manipulate header ...

Read XHTML into XML
Hi all, I need to read/parse XHTML aspx pages and look for certain tokens and content. How can I use a XmlTextReader for this? If not, any other ideas? Thanks in advance, JA Reyes. Jose Antonio Reyes wrote: > I need to read/parse XHTML aspx pages and look for certain tokens and > content. How can I use a XmlTextReader for this? If not, any other ideas? If the pages are well-formed XHTML then it is possible to use XmlReader (in .NET 2.0/3.0) or XmlTextReader (in .NET 1.x) to parse the XHTML documents. You can also use the other XML APIs .NET provides so using XPathNavigator and/o...

ListCtrl header right click
I want to bring up a context menu when the user clicks on the grey headers across the top of the columns in my CListCtrl class. What event do I have to use to catch a right click on a CListCtrl's header. I have tried OnNcRButtonDown in the list control, but it isn't hit, so something else must be catching the right click event. If I have to subclass the header control and catch the click in my specialised class, then how do I use my own class rather than the CListCtrl's normal class as it's creation is automatic? Thanks for any tips. "GT" <ContactGT_rem...

How to invoke the xml editor?
I installed vs2005 on a new xp pro machine, and installed everything except C++. When I click on a file with a ".xml" extension it is opened with IE. When I click file/Edit with XML Editor, it opens it with Notepad. If I click File/Open With and select XML Editor, it opens it with IE. So, where is the xml editor? Can it be invoked from withing VS? Where? Bill * billsahiker@yahoo.com wrote in microsoft.public.dotnet.xml: >I installed vs2005 on a new xp pro machine, and installed everything >except C++. When I click on a file with a ".xml" extension it is >opened ...

Excel header/footer cell reference
In Excel is it possible to put a cell referenc in a header or footer? Paddy With the use of VBA, yes. Sub CellInFooter() With ActiveSheet .PageSetup.CenterFooter = .Range("A1").text End With End Sub Gord Dibben Excel MVP On Thu, 15 Dec 2005 21:08:03 -0800, "Paddy" <Paddy@discussions.microsoft.com> wrote: >In Excel is it possible to put a cell referenc in a header or footer? Via code? Yes. You can use the workbook_beforeprint event to modify the header. Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) With Me.Workshe...

Header/Wrap Text
I wondered if you could help me with a few things in Excel: Is it possible to put a header on the first two pages of a 3-page spreadsheet? Also I have "wrap text" setting in all my cells, but in one cell -- it only prints two-thirds of the text no matter how big an area I make for it. I have retyped the remaining text several times and the Wrap Text box is checked. Do you know why that would happen? Is there some sort of limit as to how many characters you can have in a field? Thanks so much for your help. Pat Hi 1. For a header change within one change you'll need...

show XML schema and values
I have an XML document that looks like the following: <record> <Field1>value1</Field1> <Field2>value2</Field2> <Field3>value3</Field3> </record> What I'm aiming to do is to show the data in a report as in the following example: record: Field1 value1 Field2 value2 Field3 value3 The "Field1-3"-elements can have any name, so I'm trying to get a table that has in one result column the element name, and in the second colum...

Offline synch using XML web-services
This is a bit long-winded. Can somebody read thru these 2 use cases, and tell me if it is feasible ? :- Use Case : Replication before Offline Synch Scenario 1 : Oracle Server , MSDE client 1. User clicks on 'Go Offline'. System creates a MSDE SQL database in laptop (client), gets the schemas of the tables in Oracle, creates corresponding tables in client's MSDE SQL (mapping Oracle datatypes to SQL datatypes). 2. Offline replication program reads in the tables of the server into a typed datasets, converts the typed datasets into XML, and stores the XML in the client. (XML serial...

Retriving column header for non empty cells in a row
Hello, I have worksheet like one below No Att1 Att2 Att3 Att4 Att5 A 1 1 1 B 1 1 1 1 C 1 1 D 1 1 E 1 1 1 F 1 1 1 1 I want to know a formula that will return column header for second non empty cell in a row. fo ex. for A formula should return Att3 Also if you can tell about how to modify formula so as that it will return column header for nth non empty cell in row. Thanks and Regards SushiL ...

XML Serialization ... how to truncate <?xml...
While xml serializing object how can I truncate <?xml ...?> this line alone? I need to send the serialized xml data to a web method ... since SOAP already have <?xml tag there was some confusion Any help would be greatly appreciated Thank you Regards Raj Raj wrote: > While xml serializing object how can I truncate <?xml ...?> this line alone? Serialize to an XmlWriter created with XmlWriterSettings where you set OmitXmlDeclaration to true. -- Martin Honnen --- MVP XML http://msmvps.com/blogs/martin_honnen/ ...

String to xml document
Hi there, I was hoping someone can help me with a little problem I can't seem to find any answers to. I've got a form wich will be posted. On receiving the post I would like to parse a formvar to a xml document. The contents of this formvar (string) will be a valid xhtml document. Can someone give me a startertip (or more :-)) on how to achieve this? tnx in advance, James van der Veen Sjeems wrote: > I was hoping someone can help me with a little problem I can't seem to find > any answers to. > > I've got a form wich will be posted. On receiving the p...

Beginner of XML
I am a beginner of XML. I want to group some files together with a xml file. (it includes a text file, and an image file and a video file) Can someone show me some guidelines? Please help. ...

In which header file is VK_OEM_PLUS defined?
In MSDN, it says that VK_OEM_PLUS is a defined key (constant? ). But I can't find the the header file in which VK_OEM_PLUS is defined. "Fei Xu, or Flying Xu" <FeiXuorFlyingXu@discussions.microsoft.com> wrote in message news:BA1B6413-96DF-44BA-A1B6-A972DFC50F91@microsoft.com... > In MSDN, it says that VK_OEM_PLUS is a defined key (constant? ). > But I can't find the the header file in which VK_OEM_PLUS is defined. Based on my PSDK install, it appears in 'WinUser.h'. -- Jeff Partch [VC++ MVP] ...

Example eConnect XML documents
MSDN says the following: Installing eConnect schema When you include the schemas component of the eConnect install, the installer places schema files in a schemas folder on your computer. The following schema resources are available: The install places the .xsd schema files in the directory c:\Program Files\Microsoft Great Plains\eConnect9\XML Schema\Incoming XSD Individual Schemas. The files in the directory contain the schema for each eConnect XML document. The install places a file named eConnect.xsd that contains the schema definition for all eConnect XML documents. The install typicall...

phantom headers
I have a header which keeps coming back after I remove it in the print preview window. Does anyone know why this might be happening? tia, Dave If you open the workbook with macros disabled, does the header still come back? If it doesn't come back, it sounds like you have a macro that runs right before you print. Take a look under ThisWorkbook to see if you have any code in the workbook_beforePrint procedure. dave wrote: > > I have a header which keeps coming back after I remove it > in the print preview window. Does anyone know why this > might be happening? > &...

Valid xml to read from an xml file?
I'm using vb.net, i get an error at the reader line saying the remote server can't be found. Is the below even valid? dim reader as XmlTextReader reader = new XmlTextReader ("http://www.mysite.com/my.xml") do while (reader.Read()) 'do some action here response.write(reader) loop thanx chumley XmlTextReader uses System.Net.WebRequest under the covers -- see if you can figure out how to create a connection that way. Usually there's some proxy server information missing that you can enable if you use WebRequest directly, and then pass the result of GetResponse()...

Saving DataSet as XML in ADO format using VB.NET
Hi, I am trying to convert a lot of web reports from ASP/VB to ASP.NET/VB.NET. I would like to save my dataset in XML and then use XSLT to transform the XML. The catch is I would like to have the XML in the format that ADO uses versus the default format in which ADO.NET uses. Currently, I am using ADO within .NET, but I am concerned about the performance and it might improve if I used the native data providers for .NET. I am not sure if I am missing something but how do I save the .NET DataSet to XML in the OLD ADO format? Thanks for you help in advance and it is most appreciated. In the ...

XML variable for description on receipt?
Hi, I would like to add a description (actually all of those 3 extended descriptions) to display on the printed receipt under the main description. What is the variable to do that? Entry.Item.Description Entry.Item.ExtendedDescription Entry.Item.SubDescription1 Entry.Item.SubDescription2 Entry.Item.SubDescription3 R. "Zorian" <Zorian@discussions.microsoft.com> wrote in message news:F4425EAC-62B6-46FE-826A-D8BA2AA75DBB@microsoft.com... > Hi, I would like to add a description (actually all of those 3 extended > descriptions) to display on the printed receipt un...

Is it possible to Extract IP Address from the message headers of E-Mails in .PST file. #2
Hi, I am working with .PST files to extract contents(programatically using VB.NET) like sender's e-mail, the date and time sent etc from each of the individual E-Mails. I also want to extract sender's IP address from each of the E-Mail in .PST file. I know there is entry of the IP address in the SMTP header, but don't know how to extract it or access the header programatically. Can someone please tell me how to do it? Or is there any property of MailItem Object to achieve this? ...

Valid Headers for Exchange 5.5 Export
Hi, I need to Export all permissions on all mailboxes in a specific container in Exchange 5.5. Does anybody know the correct headers used for this? Thanks in advance! ...

xml to SQL
Hey we have a project in which a company produces a XML page in reply to actions on it's site. I see that SQL 2000 works well with XML so Can someone point me in the right direction, I would like to take the XML from thier SQL and have it "post" to own sql server (add,create, data, modifity and delete data on the fly). I was looking at doing XML to HTML and then passing to some a ASP but if we can grab from the responsetext then we could save time and headaches. Now I really know next to nothing about XML but I am reading all the newsgroups and pulled now TONS of xml / sql stuff ...

new xml file is larger than the original
i'm working on a windows application that will edit and create xml files from another application. the original file is 83k, the one created by my vb.net program is 153k but all i add is a new xmlelement when i use the other program and add a xmlelement is only increased the file to 85k. how come my application increased 70k in size and also added the <?xml version="1.0"?> when i didn't tell it to. how do i duplicated a xml file and only add the xml element that i want to insert. where did the extra 70k come from. thanks here is my code: Dim newEvtEnr...

xml data in excel
I have designed an excel template with tabular format (row by row input) for user input. I have to make the validation for those input. My question is that is it possible to use XML schema as the input format template and use it for the data validation like normal XML validation. Could anyone suggest me how to do that?? Million thanks. ...

XSLT, XML to XML
Hello, I would like to transform this; <?xml version="1.0" encoding="utf-8" ?> <ProductList> <Product> <ID>1</ID> <Name>Gadget</Name> </Product> </ProductList> to this; <?xml version="1.0" encoding="utf-8" ?> <ProductList> <Product> <ID>1</ID> <Name>Gadget</Name> </Product> </ProductList> Basically I am hoping to use XslTransform and an XSLT stylesheet to change the format of some input XML so i...

Only 1 File Header Record in Safe Pay file.
We are on Dynamics GP 9.0 and we are looking at generating a Safe Pay file for positive pay feature with our bank. We would like to stack our files i.e. we would like 1 file to be generated for multiple check books in our company, however the bank requires one "Transmission Header Record" and only one "File Header Record" in our file. Is that something that is achievable with GP 9.0 or will we have to generate one file per check book? Thanks, Hetal. Hetal, Unfortunately, the check run generates is based on one chechbook at a time. So, you will need to combine all SafePa...