.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

How can I get xmlns:xsi to appear after (instead of before) a custom xmlns="blah" statement?

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
I need the | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | statement to appear as the second statement after | xmlns="blah" | in an XML file I an trying to generate.  If it appears first the system that consumes the fail is unable to interpret the file. My query: WITH XMLNAMESPACES (DEFAULT 'example', 'http://www.w3.org/2001/XMLSchema-instance' AS xsi) SELECT 'myschema schemav5.xsd' "@xsi:schemaLocation", '27' AS CompanyCode , ISNULL(NULL,'') AS ExampleOfBlankNullField , NULL AS ExampleOfNullField, 2010 AS [Year] , 3 AS [Quarter] FOR XML PATH('CompanyData'), ELEMENTS XSINIL ; The result:   <CompanyData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="example" xsi:schemaLocation="myschema schemav5.xsd"> <CompanyCode>27</CompanyCode> <ExampleOfBlankNullField></ExampleOfBlankNullField> <ExampleOfNullField xsi:nil="true" /> <Year>2010</Year> <Quarter>3</Quarter> </CompanyData> If I could just get that xmlns="example" to be placed before the xmlns:xsi section, then I would be good to go.   Any suggestions on how I can do that? Thank you for your help!

View Complete Post

More Related Resource Links

xmlns:custom="clr-namespace:..." Designview problem

Once adding to simple XAML code reference to it's namespace designer stops work. Is it bug?See sampleThis code shows designer as expected<Window x:Class="Test_CLRNamespace.Window1"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    Title="Test_CLRNamespace" Height="300" Width="300"    >  <Grid>    <Button Margin="41,52,46,62" Name="button1">Button</Button>  </Grid>  </Window>However, this code does not<Window x:Class="Test_CLRNamespace.Window1"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     xmlns:custom="clr-namespace:Test_CLRNamespace"     Title="Test_CLRNamespace" Height="300" Width="300"     >   <Grid>     <Button Margin="41,52,46,62" Name="button1">Button</Button>   </Grid>   </Window>

I am not able to read xml file with XDocument if its Descendants has Attribute xmlns="http://abc.co


I am not able to read xml file with XDocument if its Descendants has  Attribute like:-

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
  <row ID="1" xmlns="http://www.opentravela.org/OTA/2003/05">
    <var country_name="Caribbean and Rest of the world" city_name="Kingston" flight_category="Economy Class" via="Atlanta" flight_departure="London Heathrow" airline_logo="Delta" adult_fare="Delta" child_fare="660" infant_fare="561" date1="132" date2="2010-08-15" />


I don't know what to do ?

Looking for some help..

How can I use XSINIL with out getting the namespace "xmlns:xsi=..." added to my results?

I want to use XSINIL in some nested XML queries using FOR XML PATH, but when I add XSINIL the queries then return with the added namespace of xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" I can not have this happening for my results as I already handled my namespaces up at the root level and can't have them repeating for each of my subqueries. How can I supress xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" but still get my XML result to display "xsi:nil="true" " for all my NULL values?   Thanks

configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

Hi everybodyi'v try to run asimple GridView in web developer 2005and i recive the following message:Line 10: <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">another problem is:i can not edit users using asp.net configuration tool.thanks in advencedRonen Y

Problem with xmlns when I convert object to XML and XML to object back


Hi, I am facing a strange problem.

I have a class object which I am accessing through webservice call.

Now actually that class has a property with type of Array inside that class and that array is the array of same class object. Means in reality, I have detailed tree structure as per how data gets fill up in that class object.

This is how my XML is and my actual code.

string xml_For_Obj = "";

                xml_For_Obj = "<xml version=\"1.0\" encoding=\"utf-16\">  ";
                xml_For_Obj += "    <ComponentObject xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">";
                xml_For_Obj += "        <BundledComponents xmlns=\"http://MySite.com/ISI/OtherWebService/Components\">";
                xml_For_Obj += "            <ComponentObject>";
                xml_For_Obj += "                <SKU>Test Sku Name</SKU> ";
                xml_For_Obj += "                <SubGroup>Test SubGroup</SubGroup> ";
                xml_For_Obj += "                <Quantity>70</Quantity> ";
                xml_For_Obj += "                    <BundledComponents >";

How to update specific element of this XML ( having problem because of XMLns )


Hi, I have a XML String inwhich I need to update some element value (using C#) . I am not sure how to update, so here is my XML String.


string xml_For_Obj = "";

                xml_For_Obj = "<xml version=\"1.0\" encoding=\"utf-16\">  ";
                xml_For_Obj += "    <ComponentObject xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">";
                xml_For_Obj += "        <BundledComponents xmlns=\"http://MySite.com/ISI/OtherWebService/Components\">";
                xml_For_Obj += "            <ComponentObject>";
                xml_For_Obj += "                <SKU>Test Sku Name</SKU> ";
                xml_For_Obj += "                <SubGroup>Test SubGroup</SubGroup> ";
                xml_For_Obj += "                <Quantity>70</Quantity> ";
                xml_For_Obj += "                    <BundledComponents >";
                xml_For_Obj += "                        <ComponentObject>";
                xml_For_Obj += "                            <SKU>MYTEST</SKU> ";
                xml_For_Obj += "         

xmlns:xsi= - linq xml


This XML not work:

<?xml version="1.0" ?>
<DtecBS xmlns="http://www.bsi.si" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bsi.si http://www.bsi.si/_data/tecajnice/DTecBS.xsd">
   <tecajnica datum="2010-10-22">
    <tecaj oznaka="USD" sifra="840">1.3934</tecaj>
    <tecaj oznaka="JPY" sifra="392">113.18</tecaj>
    <tecaj oznaka="BGN" sifra="975">1.9558</tecaj>
    <tecaj oznaka="CZK" sifra="203">24.626</tecaj>
    <tecaj oznaka="DKK" sifra="208">7.4577</tecaj>
    <tecaj oznaka="EEK" sifra="233">15.6466</tecaj>
    <tecaj oznaka="GBP" sifra="826">0.88730</tecaj>
    <tecaj oznaka="HUF" sifra="348">275.35</tecaj>
    <tecaj oznaka="LTL" sifra="440">3.4528</tecaj>
    <tecaj oznaka="LVL" sifra="428">0.7097</tecaj>
    <tecaj oznaka="PLN" sifra="985">3.9701</tecaj>
    <tecaj oznaka="RON" sifra="946">4.3013</tecaj>
    <tecaj oznaka="SEK" sifra=&q

custom linq select statement


Hello all,

I am attempting to use a function that returns would ideally query only a specific column name based on a variable (opt) sent from my aspx page. Here is a sample of my incorrect code:

Public Function availOption(ByVal objName As String) As String
        Dim itmInfo As Array = Split(objName, "|")
        Dim opt As String = itmInfo(0)
        Dim CatItemID As String = itmInfo(1)
        Dim odc = New OrderDataClassesDataContext()
        Dim avail = From a In odc.CustomOptionLists _
                    Where a.catID = 8 _
                    Select '*** use opt variable here ***
        If avail.ToString = "True" Then
            Return "panelVisible"
            Return "panelInvisible"
        End If

    End Function


I have tried to select a.Equals(opt), but it doesn't return the correct value. I have tried to research dynamicLinq, but it isn't something that I've figured out yet either. Is dynamic the way to go?

Otherwise any other ideas would be greatly appreciated.

Thanks and have a good evening.

How to get rid of extra xmlns:ns1 in sub element?


Run the following code in AdventureWorks DB

; WITH XMLNAMESPACES ( 'http://www.w3.org/TR/html4/' AS ns1 )

SELECT ProductModelID as "@ns1:ProductModelID",

      Name as "@ns1:ProductModelName",


       SELECT ProductID

custom linq to sql statement gridview paging


Ok, I know this cant really be that hard, but im having trouble finding any info. I have a gridview on the page that i am filling with data based on a user selected date range(a dropdown list). When the user clicks the button i fill the gridview and display it. This is all done using Linq to Sql. I need to impliment paging and sorting as well. Help PLEASE!!! Below is my button click event... i am open to any suggestions to get this working


protected void btnGenerate_Click(object sender, EventArgs e)
        int dateRange =0;
        if (rbDateList.Checked)
            switch (ddlDateRange.SelectedIndex)
                case 0:
                    dateRange = 30;

Deserialize XML xmlns was not expected


This was originally posted in the VC# General Forum and it was suggested I move it here.

Trying to pass Xml serialized messages between two apps over a socket.  When deserializing on the receiving side, I error out with the xmlns was not expected. Both share the project containing the messages that are sent and received.  I've tried multiple things and this error is driving me nuts.  Below are the objects I'm serializing and trying to send.   I can successfully serialize/deserialize the TestPeople message from the sending application. What does it take?


    public class ClientMessage
        public Guid MessageId { get; set; }
        public DateTime MessageDateTime { get; set; }
        public string MessageType { get; set; }

        public ClientMessage()

Custom Controls in C# .NET

Embedding user controls in a Windows form is just like adding a simple button or text box that are already provided with .NET. These basic controls were written essentially like you code your own controls. Typically the controls you design are to be used in multiple forms or to modularize your code. These reasons help reduce the amount of code you have to type as well as make it easier for you to change your implementation. There should almost never be any reason to duplicate code because it leaves a lot of room for bugs. So, implementing functionality specific to your control in the control's source code is a good idea. This reduces code duplication as well as modularize your code, which is a good programming guideline.

Writing custom MembershipProvider

ASP.NET Membership mechanism allows to use the build-in server tables to store and retrieve user data. By default, this mechanism can only be used with SQL Server database to which Microsoft provides suitable MembershipProvider class.
Inheriting from this abstract class, developer can use his own table(-es) from any database and use any database engine other than SQL Server, like Oracle, DB2 etc.

Custom Editing Behavior for DataGridView TextBox Columns

For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key

Write Custom WebParts for SharePoint 2007

The popularity of SharePoint Portal Server 2003 led Microsoft to tightly integrate the next SharePoint version, Microsoft Office SharePoint Server (MOSS) 2007, with its ASP.NET 2.0 WebPart framework. This tight integration enables the ASP.NET and SharePoint developer to do a number of things that previously weren't possible

Writing Custom Web Parts for SharePoint 2007

As I mentioned in an earlier blog post, SharePoint 2007 is built on top of ASP.NET 2.0, which means you can now use ASP.NET 2.0 features (Forms Authentication, Master Pages, Membership, Site Navigation, New Data Controls, etc) when building SharePoint sites. This is true for both the new Windows SharePoint Services 3.0 version (which will be a free download) as well as Microsoft Office SharePoint Server 2007 (which costs money).

Custom views on .aspx webpage


Hi again, i have a client that needs me to create a custom view on thier webpage similar to Microsoft Word.

It goes about that, when I click on an image it redirects me to another page and must create a custom view for a certain paragraph on that page. I am not sure how to do this and wonder if anyone knows how.

I am using C# programming language if that helps at all. I Heard that using javascript would work but i dont know javascript yet so is there any alternative?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend