Removing xmlns:xsd and xmlns:xsi when using ImportNode

I'm doing some document merging where I want to bring in an XmlDocument and 
import its document element into another document deeper in its tree. 
However, when serializing my underlying objects, .Net likes to add these 
namespaces:
<RootNode xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ChildNode xmlns="MyObjectHierarchyNamespace/>
</RootNode>

The problem this is causing me is that any node(s) that have those 
namespaces get properly imported into the XML, but those nodes fail to 
deserialize. Is there a wya to prevent the aforementioned namespace issue 
(in either importation or deserialization) without manually removing the 
attributes during merging? 


0
2/22/2007 9:12:10 PM
dotnet.xml 7266 articles. 0 followers. Follow

3 Replies
695 Views

Similar Articles

[PageSpeed] 46

"Keith Patrick" <richard_keith_patrick@nospam.hotmail.com> wrote in message 
news:uRiMdYsVHHA.4828@TK2MSFTNGP05.phx.gbl...
> I'm doing some document merging where I want to bring in an XmlDocument 
> and import its document element into another document deeper in its tree. 
> However, when serializing my underlying objects, .Net likes to add these 
> namespaces:
> <RootNode xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>    <ChildNode xmlns="MyObjectHierarchyNamespace/>
> </RootNode>
>
> The problem this is causing me is that any node(s) that have those 
> namespaces get properly imported into the XML, but those nodes fail to 
> deserialize. Is there a wya to prevent the aforementioned namespace issue 
> (in either importation or deserialization) without manually removing the 
> attributes during merging?


Keith, if they fail to deserialize, it's probably because you don't have the 
correct namespaces declared on the properties they should deserialize into. 
For instance, what namespace do you have declared on the ChildNode property?

In other words, this is more likely because of the 
xmlns="MyObjectHierarchyNamespace" rather than because of the xmlns:xsd or 
xmlns:xsi namespace nodes.

Here's a very brief lesson on XML namespaces, in case you need it:

<foo xmlns="bar"/>

and

<foo xmlns="baz"/>

Are elements of two totally different and unrelated types. If you had a 
property that the first one deserialized into, you would not want the second 
one to be able to deserialize into that same property, because it's a 
totally different entity that happens to also have the local name "foo".

John


0
John
2/23/2007 12:36:15 AM
I've got all my classes tagged with XmlType("MyObjectHierarchyNamespace") 
but not the properties of those types. But the thing is, my namespace is 
already being declared on the primary document so that when it merges in, 
I'll have:

    <Grades xmlns="MyObjectHierarchyNamespace">
        <Grade Name="1st">
            <Subjects>
                <Subject Name="Math">
                    <Segments>
                        <Segment Name="SegmentOne" />
                    </Segments>
                </Subject>
                <Subject Name="English">
                    <Segments>
                        <Segment Name="SegmentOne">
                            <Modules>
                                <Module 
xmlns="MyObjectHierarchyNamespace"/>
                                <Module />
                                <Module />
                            </Modules>
                            .
                            .
                            .

In this case, everything shows up except that first module (Modules contains 
2 Module objects).  public class Module has 
XmlType("MyObjectHierarchyNamespace") as does ModuleCollection, but not the 
property Modules


0
2/23/2007 3:39:55 PM
Ahh, found a fix. I was using XmlTypeAttribute, but converting to 
XmlRootAttribute wound up working.



0
2/23/2007 3:53:32 PM
Reply:

Similar Artilces:

Using variables with pivot tables
I have a pivot table which I would like to control from a navigation sheet i.e. I'd like to be able to change the values in the pivot using variables. Is this possible? Hi Lorraine If you are wanting to change the page fields in Pivot Tables, then you will probably be able to adapt some of the code in one or other of the tow downloads from Debra Dalgleish's site. http://www.contextures.com/excelfiles.html#Pivot http://www.contextures.com/PivotMultiPagesChange.zip http://www.contextures.com/PivotPageSpinner.zip -- Regards Roger Govier "Lorraine G" <Lorraine G@...

Remove Excel Icon ??
Hi, I would like to remove the possibility to export data in Excel. I think I already read it's impossible but I just want to confirm. Thanks, Sylvie Your correct, there is no supported way to do this in the current release of Microsoft CRM 1.2 -- John O'Donnell Microsoft CRM MVP http://www.microsoft.com/BusinessSolutions/Community/CRMFaqLanding.aspx "sylvie" <sylvie.mondoux@proximi-t.com> wrote in message news:09dd01c47b03$d3627560$a301280a@phx.gbl... > Hi, > > I would like to remove the possibility to export data in > Excel. I think I already rea...

Removal
How do I completely remove all traces of Outlook 2002 for a complete fresh reinstall. I can't find anything for '02. HELP!!!!!!!!!!!!!!!!! ...

Unable to use SetFocus on boolean field
I have a boolean field in one of my forms and it does not appear to have the Crm javascript method SetFocus implemented or at least calling that method results in an error. The method is in the crm sdk listed under the available methods for all field types. The methode does work for textbox fields. so: crmForm.all.some_textbox.SetFocus(); >> works crmForm.all.some_boolean_field.SetFocus(); >> throws an exception Possible Bug? -- Patrick Verbeeten (MCSD) Lead Developer Aviva IT www.aviva-it.nl ------=_NextPart_0001_3FA405FE Content-Type: text/plain Content-Transfer-Encod...

xsd.exe error
Hi, When I try to compile xsd file with xsd.exe that comes with Visual Studio.NET 2003 with following command line: xsd /d /l:"Microsoft.MCpp.MCppCodeProvider, MCppCodeDomProvider, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, Custom=null" /namespace:Schema MyFile.xsd I get following error: DataSet doesn't support 'union' or 'list' as simpleType Following lines in xsd file are responsible for the error: <xs:simpleType name="MyType"> <xs:union> <xs:simpleType> <xs:restriction base=&qu...

how do I remove spaces from cells that were pasted
I am pasting numbers into a spreadsheet, however its treating them as text because there is a space before the number. How do I remove the space so it treats it as a number ? I have used the =trim() function and its not working. Thanks for any help ! Hi! It sounds like you're copy/pasting from a website. Try this macro from David McRitchie. Look for TRIMALL, it's about half way down the page: http://www.mvps.org/dmcritchie/excel/join.htm Biff >-----Original Message----- >I am pasting numbers into a spreadsheet, however its treating them as text >because there is a...

Remove lines with +++
Is there anyway to find any line that has a + in it and delete that whole line?! I'd also like to do the same for *. I have a list of about 1300-1500 names and addresses. Some of them have a few +++ next to the name and some of them have a few *** next to the name. These were put there by the company to designate things. They need to be removed from the list, but it's a lost of work doing it one by one. You could apply an autofilter to the column with these characters in and from the pull-down select Custom - in the panel choose "Contains" (scroll down for this) the...

Creating a CWnd in another thread and use it in main thread
Hello, in my app I have a window (CFrameWnd derived) which takes some time to be created. Also it should exist only once so I use a singleton to access it. I would like to run the window creation in the background so that when I need it it appears instantly. I use a thread to create the window. The creation runs fine but when the main thread wants to use the created window (through the singleton) the HWND is not valid. I have read a lot of stuff about this but can't find a solution to my issue. Has anyone some hints to share? Regards, Nicolas "Nicolas Bonamy" <mynab@hotm...

How to Remove SRS
How to I remove or disable Site Replication Service (SRS) from my Exchange 2003? Thank You, Jason HI Remove the SRS by expanding the Tools node in ESM, right-clicking Site Replication Service, and clicking Delete "jpollock" wrote: > How to I remove or disable Site Replication Service (SRS) from my Exchange > 2003? > > Thank You, > > Jason > > And make sure you are doing it while logged in to the console of the Exchange server on which the SRS is running. -- Jim McBee Web: http://www.somorita.com Blog: http://mostlyexchange.blogspot.com &...

remove Fax from address book?
Is there a way to stop showing Fax in the address book? I have a lot of fax numbers in my Contacts. I do not want to loose them - just not show them in the Address Book. thx Outlook considers fax numbers to be valid electronic addresses, since there are many client- and server-based components that can use such addresses. One method to hide fax numbers from the address book is to prefix the fax number with one or more letters (maybe B for business fax, H for home, O for other). If the fax number begins with a letter, Outlook won't show it in the address book. There are a couple of t...

Use of video clips in Powerpoint Presentation
I am attempting to 'insert' several mpeg 1 clips as part of a presentation. These clips were created from a DVD camera file. I have checked that the file type is 'associated' with 'Windows Media Player' but I cannot get these files to play. I CAN see a thumbnail image in the 'placeholder' location. It is my hope that these clips can be 'autoplayed' either on click or 'after the last action'. Am I missing something obvious? Looks like i've managed to resolve this myself. I converted the .mpg files to .wmv files and voila! It all...

Macro to filter dates using Userform1 & printing
I have a speadsheet that has 5 columns. (Headings are in row 2 and are: Cell A2=Date, B2=Name, C2=Paylist, D2=Cycle, E2=Action). Data starts in Row 3 and will go down to row 5000. The dates would start 01-Jan-2011 and could go up to 31-Dec-2011. Right now I have 2 macro's to sort by date and paylist but what I also need is a macro to allow the user to sort by the user inputting a from date (I think I can use a calendar to pick from) and a to date (option of => and =<) in a form. The next piece is how to display and be able to print this filtered info. I am not sure ...

allmost done with removing our 1st exchange 03 server
We are in the process of removing the 1st exchange server in our domain. Everything has been replicated over to a new server and all mailboxes have been moved. When we shut down the original server down, email still works great for 90% of the team. For the rest of us, when type the name of person to receive an email, outlook it still tries to resolve the name on the original server. I checked the profile on the users mailbox and it shows them pointing to the new server. Any suggestions would be appreciated. Try creating a new Outlook profile. Also, when you shut down you're...

Removing an item from menu
How can I remove an item from the menu and add some thing else. For instance, how can I remove inactive from the menu in contact page and put some other item with my own code behind it? You can hide the public views by simply creating a team (non used views or whatever you want to name it) and share the view to that team(done in the customize entity fields in the forms and views), this will make it a private view that only members of that team can see. You can also create new public or private views in the same place. "Amin" wrote: > How can I remove an item from the m...

Cannot Remove a program from Add Remove via remove.
I downloaded a program Fast At Last and it did not download properly and I could not remove it. Even System Restore did not remove it. The program is listed as 924PL32. Kept getting messages The feature you are trying to use is on a network resource that is unavailable. C:\dell\GC605. Seems Dell is the publisher but they would not give me free support on this issue. Any suggestions as to how I can remove the program? I believe it may be associated with spyware. When I ran spysweeper it removed some Rouge Security products but I still cannot remove this program. Cor...

Need to remove selected characters
I have 25000 cells with map coordinates in it in the following format: N34* 51.87' I need the data in the following format: N55 13.26 So basically I need to strip out the * and ' from each cell. Any simple way to do this? I sure would appreciate any assistance. Thank you -- Dale Hi! Select the range of cells in question. Goto Edit>Rplace Find what: ~* Replace with: nothing, leave this blank Replace All Repeat the process for the ' It's VERY important that you select the specific range before you attempt this!!!!!!! Biff "Natedanger" <Natedanger@d...

Can't Reply to a Message using OWA
I am using Outlook Web Acces from home. When I try to reply to a message, PowerPoint launches. From there I end up in an endless loop of errors. What's wrong? A. ...

Using perfmon for OWA
All performance counters which are used to monitor exchange webmail (messages sent, appointments deleted etc.) are 0. Where is the problem? If I add some processor counters, then it gives me true information, but none of the exchange OWA counters give me information. Only zeros. On 21 Mar 2007 04:46:56 -0700, "Siim" <siimtina@gmail.com> wrote: >All performance counters which are used to monitor exchange webmail >(messages sent, appointments deleted etc.) are 0. Where is the >problem? >If I add some processor counters, then it gives me true information, >but no...

VLOOKUP using a list not in alphabetical order.
I want to create a pulldown list to select various material based on size (ie: 1/2" x 1", 5/8" x 1", 3/4" x 1", etc...). I then want to use VLOOKUP to find the associated price. The problem is that my list of material is not in alphabetical order as i want list them based on size therefore, 5/8" before 3/4" or 1" but Excel put the 1" first, followed by 1/2", 3/4", and then 5/8". I thought about adding a column in my list of material to number the items in the order i want them listed. But how do i tell VLOOKUP to look at the ...

using MSXML in VC++...
Hi i am working with MSXML in vc++ 6. Currently i have loaded xml file successfully, i can read its node and search the node with specific property. Now the problem is that when i want to start traversing from the node that i have searched it does not work correctly. my code is ... void CXMLTestDlg::DisplayChildren(IXMLDOMNodePtr pParent) { // display the current node's name DisplayChild(pParent); // simple for loop to get all children for (IXMLDOMNodePtr pChild = pParent->firstChild; NULL != pChild; pChild = pChild->nextSibling) { // for each child, call th...

Remove deduction code from payroll stub
Is it possible to remove just a single payroll deduction code from a payroll stub using 'Employee Checks Stub on Top-D'? For example, an employee has three deductions: Insurance, 401k, Medical. Would it be possible then to show insurance and 401k but leave medical off the check stub for all employees who have medical? Thanks in advance for your help! I don't believe so because the deduction field is an array so you'd have to know which array value. Even if you did, I don't think you can use arrays in report restrictions. -- Charles Allen, MVP "drose03...

How to Remove Yahoo toolbar
I have three toolbars installed on IE8-Yahoo (to the right of the address box), and Google and AVG below the address box. I want to uninstall the Yahoo toolbar but how? It is not listed under 'Add/Remove' programs and there is a magnifying glass and arrow to the right of this toolbar that says 'Manage search providers' so I removed Yahoo toolbar from there but it is still showing. I uninstalled Yahoo messenger (since the toolbar was included during the Messenger install so it would be removed by deleting Messenger) but it is still there. I know that for AV...

Import CSV files using Macro
i have 41 csv files that i need to import into 41 sheets in Excel. the name of the csv files and the sheet names are the same minus the extension (.csv). The sheets will be existing sheets with headers. Please Help the Novice thanks M3ntz Well, one way would be to use the Data->Import External Data->New Database Query and select CSV files as the source database. Drawback: it's completey manual & you'll have to go through it 41 times Another way is to choose File->Open, select all 41 CSV files, and let Excel open them. Each will open in its own workbook. You ...

Removing password protection on a sheet
A co-worker of mine protected a sheet in her workbook but lost th password. I help her with formula/script issues and I thought I coul simply copy the data on this sheet and paste it to another sheet to ge around it, but it won't let me select anything other than a few cell (based on the cells settings I'm sure). I know that Microsoft doesn' support removal of passwords when you don't know the password (make sense from a secuity standpoint) but was hoping someone could help m out here. She can remake it if need be but thought I'd ask ;) Thanks -- Otto.ts ------------...

Using Named Range in LOOKUP formula?
My LOOKUP formula currently reads: =((LOOKUP($I6,$A$2:$A$7,$D$2:$D$7)-J6)+(LOOKUP($I6,$A$2:$A$7,$G$2:$G $7))) I would like to change this so the ranges are columns in a Named Range. Something like: =((LOOKUP($I6,Range_Col1,Range_Col4)-J6)+ (LOOKUP($I6,Range_Col1,Range_Col7))) The range name will be selected in a drop-down (data validation) in another cell. So "Range_Col1" actually needs to be referenced from the value selected in K10. Can this be done with formulas? Or do I need a macro? Ed Assuming your named range refers to A1:G7 You can use an expression like this: INDEX...