XmlSerializer Question

G

George

I need to desearilize following XML

<QUOTE>
.....
<aaia:Line>
<LineNumber>1</LineNumber>
.....
</aaia:Line>
.....
</QUOTE>

The problem is that I had to specify that object Line has a namespace. But the LineNumber does not. For what eve reason the parser looking for namespace prefixed LineNumber too. Meaning that when i prefix the LineNumber tag with "aaia" it works but without it the parser does not read the value "1".

How do i tell the parser that it should not look for "aaia" in front of LineNumber?


I have following classes for it.
public class clsQuote

{


[System.Xml.Serialization.XmlElementAttribute(ElementName="Line", Namespace="aaia")]

public clsQuoteLine[] Lines;

};



public class clsAddRequestForQuoteLine

{

public int LineNumber;

}





thanks

George
 
B

Bruce Barker

try:

public class clsAddRequestForQuoteLine
{
[System.Xml.Serialization.XmlElementAttribute(ElementName="LineNumber",Namespace="")]
public int LineNumber;
}
-- bruce (sqlwork.com)



I need to desearilize following XML

<QUOTE>
....
<aaia:Line>
<LineNumber>1</LineNumber>
.....
</aaia:Line>
....
</QUOTE>

The problem is that I had to specify that object Line has a namespace. But the LineNumber does not. For what eve reason the parser looking for namespace prefixed LineNumber too. Meaning that when i prefix the LineNumber tag with "aaia" it works but without it the parser does not read the value "1".

How do i tell the parser that it should not look for "aaia" in front of LineNumber?


I have following classes for it.
public class clsQuote

{


[System.Xml.Serialization.XmlElementAttribute(ElementName="Line", Namespace="aaia")]

public clsQuoteLine[] Lines;

};



public class clsAddRequestForQuoteLine

{

public int LineNumber;

}





thanks

George
 
G

George

I tried, does not work.
Even when i used
[System.Xml.Serialization.XmlElementAttribute(ElementName="LineNumber",Namespace="")]

it looks like parser still expecting "aaia" prefix. Because if i put one in there the parser reads the value correctly.

Thanks
George.
try:

public class clsAddRequestForQuoteLine
{
[System.Xml.Serialization.XmlElementAttribute(ElementName="LineNumber",Namespace="")]
public int LineNumber;
}
-- bruce (sqlwork.com)



I need to desearilize following XML

<QUOTE>
....
<aaia:Line>
<LineNumber>1</LineNumber>
.....
</aaia:Line>
....
</QUOTE>

The problem is that I had to specify that object Line has a namespace. But the LineNumber does not. For what eve reason the parser looking for namespace prefixed LineNumber too. Meaning that when i prefix the LineNumber tag with "aaia" it works but without it the parser does not read the value "1".

How do i tell the parser that it should not look for "aaia" in front of LineNumber?


I have following classes for it.
public class clsQuote

{


[System.Xml.Serialization.XmlElementAttribute(ElementName="Line", Namespace="aaia")]

public clsQuoteLine[] Lines;

};



public class clsAddRequestForQuoteLine

{

public int LineNumber;

}





thanks

George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top