473,394 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

XmlSerializer: deserialize against xsd generated class

Hi,

I have a schema that has an optional element, fieldTag4000Field. If the
element is omitted from the XML request, when it is deserialized, it will be
null when I check it - which is fine.

What happens when the element is supplied as <fieldTag4000Field/(empty),
it does not equate to null. I want to be able handle this at the
deserialization level rahter than in my edits later.

Is there a way to alter the behavior so when I deserialize it, it is null?

I also want to add that I am calling the "CanDeserialize" method of the
XmlSerializer object, passing in the request as a XmlNodeReader.

Thanks.

The following C# class snippet was generated by xsd.exe V2:

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageType {

private Request_TypeMessageTypeFieldTag4000 fieldTag4000Field;

public Request_TypeMessageTypeFieldTag4000 FieldTag4000 {
get {
return this.fieldTag4000Field;
}
set {
this.fieldTag4000Field = value;
}
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageTypeFieldTag4000 {

private IDType_Type intermediaryIDCodeField;

private bool intermediaryIDCodeFieldSpecified;

private string intermediaryIdentifierField;

public IDType_Type IntermediaryIDCode {
get {
return this.intermediaryIDCodeField;
}
set {
this.intermediaryIDCodeField = value;
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool IntermediaryIDCodeSpecified {
get {
return this.intermediaryIDCodeFieldSpecified;
}
set {
this.intermediaryIDCodeFieldSpecified = value;
}
}
public string IntermediaryIdentifier {
get {
return this.intermediaryIdentifierField;
}
set {
this.intermediaryIdentifierField = value;
}
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="MyNamespace")]
public enum IDType_Type {

B,

C,

D,

F,

U,
}

Jul 21 '08 #1
9 3255
Unless you want to implement IXmlSerializable then I don't think you can do
what you want. You can specify that a null element is shown as:
<myElement xsi:nil="true"/>
rather than being omitted entirely by adding the XmlElement(IsNullable =
true) attribute to the field/property.

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name

"j.a. harriman" <je*******************@nospam.nospamwrote in message
news:69**********************************@microsof t.com...
Hi,

I have a schema that has an optional element, fieldTag4000Field. If the
element is omitted from the XML request, when it is deserialized, it will
be
null when I check it - which is fine.

What happens when the element is supplied as <fieldTag4000Field/(empty),
it does not equate to null. I want to be able handle this at the
deserialization level rahter than in my edits later.

Is there a way to alter the behavior so when I deserialize it, it is null?

I also want to add that I am calling the "CanDeserialize" method of the
XmlSerializer object, passing in the request as a XmlNodeReader.

Thanks.

The following C# class snippet was generated by xsd.exe V2:

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageType {

private Request_TypeMessageTypeFieldTag4000 fieldTag4000Field;

public Request_TypeMessageTypeFieldTag4000 FieldTag4000 {
get {
return this.fieldTag4000Field;
}
set {
this.fieldTag4000Field = value;
}
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageTypeFieldTag4000 {

private IDType_Type intermediaryIDCodeField;

private bool intermediaryIDCodeFieldSpecified;

private string intermediaryIdentifierField;

public IDType_Type IntermediaryIDCode {
get {
return this.intermediaryIDCodeField;
}
set {
this.intermediaryIDCodeField = value;
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool IntermediaryIDCodeSpecified {
get {
return this.intermediaryIDCodeFieldSpecified;
}
set {
this.intermediaryIDCodeFieldSpecified = value;
}
}
public string IntermediaryIdentifier {
get {
return this.intermediaryIdentifierField;
}
set {
this.intermediaryIdentifierField = value;
}
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="MyNamespace")]
public enum IDType_Type {

B,

C,

D,

F,

U,
}

Jul 22 '08 #2
Thanks for the answer Joe.

I also found some examples of using a style sheet and doing a transformation
(Using XslCompiledTransform) of the original XmlDocument. I've run a test
and it seems to work in that the result is as if the original message hadn't
had them in there. Are there any reasons why not to implement this?

Also, I tried to locate good "beginner" examples of using IXmlSerializable
that might be similar to what I need to do, but came up short. I would like
to to look at this in further detail.

Do you have any links to examples or are you aware if any of the Microsoft
example downloads (such as SDK) have any?

Thanks. Jeff

"Joe Fawcett" wrote:
Unless you want to implement IXmlSerializable then I don't think you can do
what you want. You can specify that a null element is shown as:
<myElement xsi:nil="true"/>
rather than being omitted entirely by adding the XmlElement(IsNullable =
true) attribute to the field/property.

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name

"j.a. harriman" <je*******************@nospam.nospamwrote in message
news:69**********************************@microsof t.com...
Hi,

I have a schema that has an optional element, fieldTag4000Field. If the
element is omitted from the XML request, when it is deserialized, it will
be
null when I check it - which is fine.

What happens when the element is supplied as <fieldTag4000Field/(empty),
it does not equate to null. I want to be able handle this at the
deserialization level rahter than in my edits later.

Is there a way to alter the behavior so when I deserialize it, it is null?

I also want to add that I am calling the "CanDeserialize" method of the
XmlSerializer object, passing in the request as a XmlNodeReader.

Thanks.

The following C# class snippet was generated by xsd.exe V2:

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageType {

private Request_TypeMessageTypeFieldTag4000 fieldTag4000Field;

public Request_TypeMessageTypeFieldTag4000 FieldTag4000 {
get {
return this.fieldTag4000Field;
}
set {
this.fieldTag4000Field = value;
}
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageTypeFieldTag4000 {

private IDType_Type intermediaryIDCodeField;

private bool intermediaryIDCodeFieldSpecified;

private string intermediaryIdentifierField;

public IDType_Type IntermediaryIDCode {
get {
return this.intermediaryIDCodeField;
}
set {
this.intermediaryIDCodeField = value;
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool IntermediaryIDCodeSpecified {
get {
return this.intermediaryIDCodeFieldSpecified;
}
set {
this.intermediaryIDCodeFieldSpecified = value;
}
}
public string IntermediaryIdentifier {
get {
return this.intermediaryIdentifierField;
}
set {
this.intermediaryIdentifierField = value;
}
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="MyNamespace")]
public enum IDType_Type {

B,

C,

D,

F,

U,
}


Jul 22 '08 #3
Jeff

IXmlSerializable is reasonably straightforward.
The newer version needs three methods, ReadXml, WriteXml and one to find the
Schema which is pointed to by an attribute, I normally just include the
schema as an embedded resource.
In ReadXml you get an XmlReader containing the XML and use it to populate
the object's fields, either reading it directly or loading it into a
DomDocumnt/XPathDocument if that's easier. WriteXml takes the fields and
creates an XML document.
There is an example here: http://www.devx.com/dotnet/Article/29720

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name

"j.a. harriman" <je*******************@nospam.nospamwrote in message
news:04**********************************@microsof t.com...
Thanks for the answer Joe.

I also found some examples of using a style sheet and doing a
transformation
(Using XslCompiledTransform) of the original XmlDocument. I've run a test
and it seems to work in that the result is as if the original message
hadn't
had them in there. Are there any reasons why not to implement this?

Also, I tried to locate good "beginner" examples of using IXmlSerializable
that might be similar to what I need to do, but came up short. I would
like
to to look at this in further detail.

Do you have any links to examples or are you aware if any of the Microsoft
example downloads (such as SDK) have any?

Thanks. Jeff

"Joe Fawcett" wrote:
>Unless you want to implement IXmlSerializable then I don't think you can
do
what you want. You can specify that a null element is shown as:
<myElement xsi:nil="true"/>
rather than being omitted entirely by adding the XmlElement(IsNullable =
true) attribute to the field/property.

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name

"j.a. harriman" <je*******************@nospam.nospamwrote in message
news:69**********************************@microso ft.com...
Hi,

I have a schema that has an optional element, fieldTag4000Field. If
the
element is omitted from the XML request, when it is deserialized, it
will
be
null when I check it - which is fine.

What happens when the element is supplied as <fieldTag4000Field/>
(empty),
it does not equate to null. I want to be able handle this at the
deserialization level rahter than in my edits later.

Is there a way to alter the behavior so when I deserialize it, it is
null?

I also want to add that I am calling the "CanDeserialize" method of the
XmlSerializer object, passing in the request as a XmlNodeReader.

Thanks.

The following C# class snippet was generated by xsd.exe V2:

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageType {

private Request_TypeMessageTypeFieldTag4000 fieldTag4000Field;

public Request_TypeMessageTypeFieldTag4000 FieldTag4000 {
get {
return this.fieldTag4000Field;
}
set {
this.fieldTag4000Field = value;
}
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageTypeFieldTag4000 {

private IDType_Type intermediaryIDCodeField;

private bool intermediaryIDCodeFieldSpecified;

private string intermediaryIdentifierField;

public IDType_Type IntermediaryIDCode {
get {
return this.intermediaryIDCodeField;
}
set {
this.intermediaryIDCodeField = value;
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool IntermediaryIDCodeSpecified {
get {
return this.intermediaryIDCodeFieldSpecified;
}
set {
this.intermediaryIDCodeFieldSpecified = value;
}
}
public string IntermediaryIdentifier {
get {
return this.intermediaryIdentifierField;
}
set {
this.intermediaryIdentifierField = value;
}
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="MyNamespace")]
public enum IDType_Type {

B,

C,

D,

F,

U,
}


Jul 23 '08 #4
Hi Jeff

The code produced by xsd.exe, copes well with simple schema's, but if
your working against anything a bit complicated then it can cause
issues.

If you continue to have problems then I suggest you take a look at
Liquid XML Data Binder

http://www.liquid-technologies.com/P...taBinding.aspx

This supports much more of the xsd standard, and the objects are more
strongly typed (it also comes with a free XSD editor).

Hope this helps

Regards Simon

On 23 Jul, 08:00, "Joe Fawcett" <joefawc...@newsgroup.nospamwrote:
Jeff

IXmlSerializable is reasonably straightforward.
The newer version needs three methods, ReadXml, WriteXml and one to find the
Schema which is pointed to by an attribute, I normally just include the
schema as an embedded resource.
In ReadXml you get an XmlReader containing the XML and use it to populate
the object's fields, either reading it directly or loading it into a
DomDocumnt/XPathDocument if that's easier. WriteXml takes the fields and
creates an XML document.
There is an example here:http://www.devx.com/dotnet/Article/29720

--

Joe Fawcett (MVP - XML)http://joe.fawcett.name

"j.a. harriman" <jeffrey_no_spam_al...@nospam.nospamwrote in message

news:04**********************************@microsof t.com...
Thanks for the answer Joe.
I also found some examples of using a style sheet and doing a
transformation
(Using XslCompiledTransform) of the original XmlDocument. *I've run atest
and it seems to work in that the result is as if the original message
hadn't
had them in there. *Are there any reasons why not to implement this?
Also, I tried to locate good "beginner" examples of using IXmlSerializable
that might be similar to what I need to do, but came up short. *I would
like
to to look at this in further detail.
Do you have any links to examples or are you aware if any of the Microsoft
example downloads (such as SDK) have any?
Thanks. Jeff
"Joe Fawcett" wrote:
Unless you want to implement IXmlSerializable then I don't think you can
do
what you want. You can specify that a null element is shown as:
<myElement xsi:nil="true"/>
rather than being omitted entirely by adding the XmlElement(IsNullable=
true) attribute to the field/property.
--
Joe Fawcett (MVP - XML)
>http://joe.fawcett.name
"j.a. harriman" <jeffrey_no_spam_al...@nospam.nospamwrote in message
news:69**********************************@microso ft.com...
Hi,
I have a schema that has an optional element, fieldTag4000Field. *If
the
element is omitted from the XML request, when it is deserialized, it
will
be
null when I check it - which is fine.
What happens when the element is supplied as <fieldTag4000Field/>
(empty),
it does not equate to null. *I want to be able handle this at the
deserialization level rahter than in my edits later.
Is there a way to alter the behavior so when I deserialize it, it is
null?
I also want to add that I am calling the "CanDeserialize" method of the
XmlSerializer object, passing in the request as a XmlNodeReader.
Thanks.
The following C# class snippet was generated by xsd.exe V2:
* *[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
* *[System.SerializableAttribute()]
* *[System.Diagnostics.DebuggerStepThroughAttribute()]
* *[System.ComponentModel.DesignerCategoryAttribute("c ode")]
* *[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
* *public partial class Request_TypeMessageType {
* * * *private Request_TypeMessageTypeFieldTag4000 fieldTag4000Field;
* * * *public Request_TypeMessageTypeFieldTag4000 FieldTag4000 {
* * * * * *get {
* * * * * * * *return this.fieldTag4000Field;
* * * * * *}
* * * * * *set {
* * * * * * * *this.fieldTag4000Field = value;
* * * * * *}
* * * *}
* *}
* *[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
* *[System.SerializableAttribute()]
* *[System.Diagnostics.DebuggerStepThroughAttribute()]
* *[System.ComponentModel.DesignerCategoryAttribute("c ode")]
* *[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
* *public partial class Request_TypeMessageTypeFieldTag4000 {
* * * *private IDType_Type intermediaryIDCodeField;
* * * *private bool intermediaryIDCodeFieldSpecified;
* * * *private string intermediaryIdentifierField;
* * * *public IDType_Type IntermediaryIDCode {
* * * * * *get {
* * * * * * * *return this.intermediaryIDCodeField;
* * * * * *}
* * * * * *set {
* * * * * * * *this.intermediaryIDCodeField = value;
* * * * * *}
* * * *}
* * * *[System.Xml.Serialization.XmlIgnoreAttribute()]
* * * *public bool IntermediaryIDCodeSpecified {
* * * * * *get {
* * * * * * * *return this.intermediaryIDCodeFieldSpecified;
* * * * * *}
* * * * * *set {
* * * * * * * *this.intermediaryIDCodeFieldSpecified= value;
* * * * * *}
* * * *}
* * * *public string IntermediaryIdentifier {
* * * * * *get {
* * * * * * * *return this.intermediaryIdentifierField;
* * * * * *}
* * * * * *set {
* * * * * * * *this.intermediaryIdentifierField = value;
* * * * * *}
* * * *}
* *}
* *[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
* *[System.SerializableAttribute()]
* *[System.Xml.Serialization.XmlTypeAttribute(Namespac e="MyNamespace")]
* *public enum IDType_Type {
* * * *B,
* * * *C,
* * * *D,
* * * *F,
* * * *U,
* *}- Hide quoted text -

- Show quoted text -
Jul 30 '08 #5
Simon,

Thanks for the link, I will take a look at it as it may be something we
could use.

In the meantime, I did find a code snippet that removes the "empty" nodes
but it removes ALL the empty nodes in the XML and I didn't state (earlier)
that I want to do this beginning with a particular child node only.

When I use the following XPath statement in XMLSpy's XPath Evaluator, it
locates the "empty" node mentioned in the previous posts:
/parentnode/secondchildnode//*[not(node())]

When I use the same statement in my C# code, it will not locate any empty
nodes "under" the "secondchildnode" (count = 0):
XmlNodeList element =
doc.SelectNodes("/parentnode/secondchildnode//*[not(node())]");

The plan is to loop through "element" and remove the nodes using the
"ParentNode.RemoveChild" of an XmlNode - setting it to each array element,
etc.

Any ideas as to why this is not working in .NET VS2005 2.0 framework?

Thanks.

Jeff

"Sprotty" wrote:
Hi Jeff

The code produced by xsd.exe, copes well with simple schema's, but if
your working against anything a bit complicated then it can cause
issues.

If you continue to have problems then I suggest you take a look at
Liquid XML Data Binder

http://www.liquid-technologies.com/P...taBinding.aspx

This supports much more of the xsd standard, and the objects are more
strongly typed (it also comes with a free XSD editor).

Hope this helps

Regards Simon

On 23 Jul, 08:00, "Joe Fawcett" <joefawc...@newsgroup.nospamwrote:
Jeff

IXmlSerializable is reasonably straightforward.
The newer version needs three methods, ReadXml, WriteXml and one to find the
Schema which is pointed to by an attribute, I normally just include the
schema as an embedded resource.
In ReadXml you get an XmlReader containing the XML and use it to populate
the object's fields, either reading it directly or loading it into a
DomDocumnt/XPathDocument if that's easier. WriteXml takes the fields and
creates an XML document.
There is an example here:http://www.devx.com/dotnet/Article/29720

--

Joe Fawcett (MVP - XML)http://joe.fawcett.name

"j.a. harriman" <jeffrey_no_spam_al...@nospam.nospamwrote in message

news:04**********************************@microsof t.com...
Thanks for the answer Joe.
I also found some examples of using a style sheet and doing a
transformation
(Using XslCompiledTransform) of the original XmlDocument. I've run a test
and it seems to work in that the result is as if the original message
hadn't
had them in there. Are there any reasons why not to implement this?
Also, I tried to locate good "beginner" examples of using IXmlSerializable
that might be similar to what I need to do, but came up short. I would
like
to to look at this in further detail.
Do you have any links to examples or are you aware if any of the Microsoft
example downloads (such as SDK) have any?
Thanks. Jeff
"Joe Fawcett" wrote:
>Unless you want to implement IXmlSerializable then I don't think you can
>do
>what you want. You can specify that a null element is shown as:
><myElement xsi:nil="true"/>
>rather than being omitted entirely by adding the XmlElement(IsNullable =
>true) attribute to the field/property.
>--
>Joe Fawcett (MVP - XML)
>>http://joe.fawcett.name
>"j.a. harriman" <jeffrey_no_spam_al...@nospam.nospamwrote in message
>>news:69**********************************@micros oft.com...
Hi,
I have a schema that has an optional element, fieldTag4000Field. If
the
element is omitted from the XML request, when it is deserialized, it
will
be
null when I check it - which is fine.
What happens when the element is supplied as <fieldTag4000Field/>
(empty),
it does not equate to null. I want to be able handle this at the
deserialization level rahter than in my edits later.
Is there a way to alter the behavior so when I deserialize it, it is
null?
I also want to add that I am calling the "CanDeserialize" method of the
XmlSerializer object, passing in the request as a XmlNodeReader.
Thanks.
The following C# class snippet was generated by xsd.exe V2:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageType {
private Request_TypeMessageTypeFieldTag4000 fieldTag4000Field;
public Request_TypeMessageTypeFieldTag4000 FieldTag4000 {
get {
return this.fieldTag4000Field;
}
set {
this.fieldTag4000Field = value;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageTypeFieldTag4000 {
private IDType_Type intermediaryIDCodeField;
private bool intermediaryIDCodeFieldSpecified;
private string intermediaryIdentifierField;
public IDType_Type IntermediaryIDCode {
get {
return this.intermediaryIDCodeField;
}
set {
this.intermediaryIDCodeField = value;
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool IntermediaryIDCodeSpecified {
get {
return this.intermediaryIDCodeFieldSpecified;
}
set {
this.intermediaryIDCodeFieldSpecified = value;
}
}
public string IntermediaryIdentifier {
get {
return this.intermediaryIdentifierField;
}
set {
this.intermediaryIdentifierField = value;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="MyNamespace")]
public enum IDType_Type {
B,
C,
D,
F,
U,
}- Hide quoted text -
- Show quoted text -

Jul 31 '08 #6

You could remove the empy elements in the DOM before loading it as you
suggest.
Im not seeing a problem with that

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml("<parentnode><secondchildnode><b/></
secondchildnode></parentnode>");
XmlNodeList xnl = xmlDoc.SelectNodes("//*[not(node())]");
Debug.Assert(xnl.Count == 1);

or you could remove it from the object model after its been loaded
(deserialized).

If you were using Liquid XML then you may be able to add code in that
would remove the empty elements as part of the de-serialization.

Cheers Simon
On 31 Jul, 21:22, j.a. harriman <jeffrey_no_spam_al...@nospam.nospam>
wrote:
Simon,

Thanks for the link, I will take a look at it as it may be something we
could use.

In the meantime, I did find a code snippet that removes the "empty" nodes
but it removes ALL the empty nodes in the XML and I didn't state (earlier)
that I want to do this beginning with a particular child node only.

When I use the following XPath statement in XMLSpy's XPath Evaluator, it
locates the "empty" node mentioned in the previous posts:
/parentnode/secondchildnode//*[not(node())]

When I use the same statement in my C# code, it will not locate any empty
nodes "under" the "secondchildnode" (count = 0):
XmlNodeList element =
doc.SelectNodes("/parentnode/secondchildnode//*[not(node())]");

The plan is to loop through "element" and remove the nodes using the
"ParentNode.RemoveChild" of an XmlNode - setting it to each array element,
etc.

Any ideas as to why this is not working in .NET VS2005 2.0 framework?

Thanks.

Jeff

"Sprotty" wrote:
Hi Jeff
The code produced by xsd.exe, copes well with simple schema's, but if
your working against anything a bit complicated then it can cause
issues.
If you continue to have problems then I suggest you take a look at
Liquid XML Data Binder
http://www.liquid-technologies.com/P...taBinding.aspx
This supports much more of the xsd standard, and the objects are more
strongly typed (it also comes with a free XSD editor).
Hope this helps
Regards Simon
On 23 Jul, 08:00, "Joe Fawcett" <joefawc...@newsgroup.nospamwrote:
Jeff
IXmlSerializable is reasonably straightforward.
The newer version needs three methods, ReadXml, WriteXml and one to find the
Schema which is pointed to by an attribute, I normally just include the
schema as an embedded resource.
In ReadXml you get an XmlReader containing the XML and use it to populate
the object's fields, either reading it directly or loading it into a
DomDocumnt/XPathDocument if that's easier. WriteXml takes the fields and
creates an XML document.
There is an example here:http://www.devx.com/dotnet/Article/29720
--
Joe Fawcett (MVP - XML)http://joe.fawcett.name
"j.a. harriman" <jeffrey_no_spam_al...@nospam.nospamwrote in message
>news:04**********************************@microso ft.com...
Thanks for the answer Joe.
I also found some examples of using a style sheet and doing a
transformation
(Using XslCompiledTransform) of the original XmlDocument. *I've run a test
and it seems to work in that the result is as if the original message
hadn't
had them in there. *Are there any reasons why not to implement this?
Also, I tried to locate good "beginner" examples of using IXmlSerializable
that might be similar to what I need to do, but came up short. *Iwould
like
to to look at this in further detail.
Do you have any links to examples or are you aware if any of the Microsoft
example downloads (such as SDK) have any?
Thanks. Jeff
"Joe Fawcett" wrote:
Unless you want to implement IXmlSerializable then I don't think you can
do
what you want. You can specify that a null element is shown as:
<myElement xsi:nil="true"/>
rather than being omitted entirely by adding the XmlElement(IsNullable =
true) attribute to the field/property.
--
Joe Fawcett (MVP - XML)
>http://joe.fawcett.name
"j.a. harriman" <jeffrey_no_spam_al...@nospam.nospamwrote in message
>news:69**********************************@microso ft.com...
Hi,
I have a schema that has an optional element, fieldTag4000Field.*If
the
element is omitted from the XML request, when it is deserialized, it
will
be
null when I check it - which is fine.
What happens when the element is supplied as <fieldTag4000Field/>
(empty),
it does not equate to null. *I want to be able handle this at the
deserialization level rahter than in my edits later.
Is there a way to alter the behavior so when I deserialize it, it is
null?
I also want to add that I am calling the "CanDeserialize" methodof the
XmlSerializer object, passing in the request as a XmlNodeReader.
Thanks.
The following C# class snippet was generated by xsd.exe V2:
* *[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
* *[System.SerializableAttribute()]
* *[System.Diagnostics.DebuggerStepThroughAttribute()]
* *[System.ComponentModel.DesignerCategoryAttribute("c ode")]
* *[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
* *public partial class Request_TypeMessageType {
* * * *private Request_TypeMessageTypeFieldTag4000 fieldTag4000Field;
* * * *public Request_TypeMessageTypeFieldTag4000 FieldTag4000 {
* * * * * *get {
* * * * * * * *return this.fieldTag4000Field;
* * * * * *}
* * * * * *set {
* * * * * * * *this.fieldTag4000Field = value;
* * * * * *}
* * * *}
* *}
* *[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
* *[System.SerializableAttribute()]
* *[System.Diagnostics.DebuggerStepThroughAttribute()]
* *[System.ComponentModel.DesignerCategoryAttribute("c ode")]
* *[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
* *public partial class Request_TypeMessageTypeFieldTag4000 {
* * * *private IDType_Type intermediaryIDCodeField;
* * * *private bool intermediaryIDCodeFieldSpecified;
* * * *private string intermediaryIdentifierField;
* * * *public IDType_Type IntermediaryIDCode {
* * * * * *get {
* * * * * * * *return this.intermediaryIDCodeField;
* * * * * *}
* * * * * *set {
* * * * * * * *this.intermediaryIDCodeField = value;
* * * * * *}
* * * *}
* * * *[System.Xml.Serialization.XmlIgnoreAttribute()]
* * * *public bool IntermediaryIDCodeSpecified {
* * * * * *get {
* * * * * * * *return this.intermediaryIDCodeFieldSpecified;
* * * * * *}
* * * * * *set {
* * * * * * * *this.intermediaryIDCodeFieldSpecified = value;
* * * * * *}
* * * *}
* * * *public string IntermediaryIdentifier {
* * * * * *get {
* * * * * * * *return this.intermediaryIdentifierField;
* * * * * *}
* * * * * *set {
* * * * * * * *this.intermediaryIdentifierField = value;
* * * * * *}
* * * *}
* *}
* *[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
* *[System.SerializableAttribute()]
* *[System.Xml.Serialization.XmlTypeAttribute(Namespac e="MyNamespace")]
* *public enum IDType_Type {
* * * *B,
* * * *C,
* * * *D,
* * * *F,
* * * *U,
* *}- Hide quoted text -
- Show quoted text -
Aug 1 '08 #7
Building off your example, here's a respresentation of my actaul XML:
<parentnode>
<firstchildnode>
<a/>
</firstchildnode>
<secondchildnode>
<b/>
<c>
<d/>
<e>12345</e>
</c>
</secondchildnode>
</parentnode>

The XPath expression, "//*[not(node())]", removes all "empty" elements. I
need it to *only* remove "b" & "d" above. "a" would be left alone.

Thanks.

Jeff

"Sprotty" wrote:
>
You could remove the empy elements in the DOM before loading it as you
suggest.
Im not seeing a problem with that

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml("<parentnode><secondchildnode><b/></
secondchildnode></parentnode>");
XmlNodeList xnl = xmlDoc.SelectNodes("//*[not(node())]");
Debug.Assert(xnl.Count == 1);

or you could remove it from the object model after its been loaded
(deserialized).

If you were using Liquid XML then you may be able to add code in that
would remove the empty elements as part of the de-serialization.

Cheers Simon
On 31 Jul, 21:22, j.a. harriman <jeffrey_no_spam_al...@nospam.nospam>
wrote:
Simon,

Thanks for the link, I will take a look at it as it may be something we
could use.

In the meantime, I did find a code snippet that removes the "empty" nodes
but it removes ALL the empty nodes in the XML and I didn't state (earlier)
that I want to do this beginning with a particular child node only.

When I use the following XPath statement in XMLSpy's XPath Evaluator, it
locates the "empty" node mentioned in the previous posts:
/parentnode/secondchildnode//*[not(node())]

When I use the same statement in my C# code, it will not locate any empty
nodes "under" the "secondchildnode" (count = 0):
XmlNodeList element =
doc.SelectNodes("/parentnode/secondchildnode//*[not(node())]");

The plan is to loop through "element" and remove the nodes using the
"ParentNode.RemoveChild" of an XmlNode - setting it to each array element,
etc.

Any ideas as to why this is not working in .NET VS2005 2.0 framework?

Thanks.

Jeff

"Sprotty" wrote:
Hi Jeff
The code produced by xsd.exe, copes well with simple schema's, but if
your working against anything a bit complicated then it can cause
issues.
If you continue to have problems then I suggest you take a look at
Liquid XML Data Binder
>http://www.liquid-technologies.com/P...taBinding.aspx
This supports much more of the xsd standard, and the objects are more
strongly typed (it also comes with a free XSD editor).
Hope this helps
Regards Simon
On 23 Jul, 08:00, "Joe Fawcett" <joefawc...@newsgroup.nospamwrote:
Jeff
IXmlSerializable is reasonably straightforward.
The newer version needs three methods, ReadXml, WriteXml and one to find the
Schema which is pointed to by an attribute, I normally just include the
schema as an embedded resource.
In ReadXml you get an XmlReader containing the XML and use it to populate
the object's fields, either reading it directly or loading it into a
DomDocumnt/XPathDocument if that's easier. WriteXml takes the fields and
creates an XML document.
There is an example here:http://www.devx.com/dotnet/Article/29720
--
Joe Fawcett (MVP - XML)http://joe.fawcett.name
"j.a. harriman" <jeffrey_no_spam_al...@nospam.nospamwrote in message
news:04**********************************@microsof t.com...
Thanks for the answer Joe.
I also found some examples of using a style sheet and doing a
transformation
(Using XslCompiledTransform) of the original XmlDocument. I've run a test
and it seems to work in that the result is as if the original message
hadn't
had them in there. Are there any reasons why not to implement this?
Also, I tried to locate good "beginner" examples of using IXmlSerializable
that might be similar to what I need to do, but came up short. I would
like
to to look at this in further detail.
Do you have any links to examples or are you aware if any of the Microsoft
example downloads (such as SDK) have any?
Thanks. Jeff
"Joe Fawcett" wrote:
>Unless you want to implement IXmlSerializable then I don't think you can
>do
>what you want. You can specify that a null element is shown as:
><myElement xsi:nil="true"/>
>rather than being omitted entirely by adding the XmlElement(IsNullable =
>true) attribute to the field/property.
>--
>Joe Fawcett (MVP - XML)
>>http://joe.fawcett.name
>"j.a. harriman" <jeffrey_no_spam_al...@nospam.nospamwrote in message
>>news:69**********************************@micros oft.com...
Hi,
I have a schema that has an optional element, fieldTag4000Field. If
the
element is omitted from the XML request, when it is deserialized, it
will
be
null when I check it - which is fine.
What happens when the element is supplied as <fieldTag4000Field/>
(empty),
it does not equate to null. I want to be able handle this at the
deserialization level rahter than in my edits later.
Is there a way to alter the behavior so when I deserialize it, it is
null?
I also want to add that I am calling the "CanDeserialize" method of the
XmlSerializer object, passing in the request as a XmlNodeReader.
Thanks.
The following C# class snippet was generated by xsd.exe V2:
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageType {
private Request_TypeMessageTypeFieldTag4000 fieldTag4000Field;
public Request_TypeMessageTypeFieldTag4000 FieldTag4000 {
get {
return this.fieldTag4000Field;
}
set {
this.fieldTag4000Field = value;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageTypeFieldTag4000 {
private IDType_Type intermediaryIDCodeField;
private bool intermediaryIDCodeFieldSpecified;
private string intermediaryIdentifierField;
public IDType_Type IntermediaryIDCode {
get {
return this.intermediaryIDCodeField;
}
set {
this.intermediaryIDCodeField = value;
}
}
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool IntermediaryIDCodeSpecified {
get {
return this.intermediaryIDCodeFieldSpecified;
}
set {
this.intermediaryIDCodeFieldSpecified = value;
}
}
public string IntermediaryIdentifier {
get {
return this.intermediaryIdentifierField;
}
set {
this.intermediaryIdentifierField = value;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="MyNamespace")]
public enum IDType_Type {
B,
C,
D,
F,
U,
}- Hide quoted text -
- Show quoted text -

Aug 1 '08 #8
I may have tried to oversimplify my example.

The "real" XML has a number of "xmlns:" entries following the "parentnode".
When I remove them & test, this statement,
"/parentnode/secondchildnode//*[not(node())]", works as I was expecting.

Is there something I need to do with adding namespaces (e.g
XmlNamespaceManager) or something else that I am unaware of?

If there are 5 namespaces in the XML do I need to add a namespace for each
one?

How are the namespaces used in the XPath statement above?

Thanks.

Jeff

"j.a. harriman" wrote:
Building off your example, here's a respresentation of my actaul XML:
<parentnode>
<firstchildnode>
<a/>
</firstchildnode>
<secondchildnode>
<b/>
<c>
<d/>
<e>12345</e>
</c>
</secondchildnode>
</parentnode>

The XPath expression, "//*[not(node())]", removes all "empty" elements. I
need it to *only* remove "b" & "d" above. "a" would be left alone.

Thanks.

Jeff

"Sprotty" wrote:

You could remove the empy elements in the DOM before loading it as you
suggest.
Im not seeing a problem with that

XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml("<parentnode><secondchildnode><b/></
secondchildnode></parentnode>");
XmlNodeList xnl = xmlDoc.SelectNodes("//*[not(node())]");
Debug.Assert(xnl.Count == 1);

or you could remove it from the object model after its been loaded
(deserialized).

If you were using Liquid XML then you may be able to add code in that
would remove the empty elements as part of the de-serialization.

Cheers Simon
On 31 Jul, 21:22, j.a. harriman <jeffrey_no_spam_al...@nospam.nospam>
wrote:
Simon,
>
Thanks for the link, I will take a look at it as it may be something we
could use.
>
In the meantime, I did find a code snippet that removes the "empty" nodes
but it removes ALL the empty nodes in the XML and I didn't state (earlier)
that I want to do this beginning with a particular child node only.
>
When I use the following XPath statement in XMLSpy's XPath Evaluator, it
locates the "empty" node mentioned in the previous posts:
/parentnode/secondchildnode//*[not(node())]
>
When I use the same statement in my C# code, it will not locate any empty
nodes "under" the "secondchildnode" (count = 0):
XmlNodeList element =
doc.SelectNodes("/parentnode/secondchildnode//*[not(node())]");
>
The plan is to loop through "element" and remove the nodes using the
"ParentNode.RemoveChild" of an XmlNode - setting it to each array element,
etc.
>
Any ideas as to why this is not working in .NET VS2005 2.0 framework?
>
Thanks.
>
Jeff
>
"Sprotty" wrote:
Hi Jeff
>
The code produced by xsd.exe, copes well with simple schema's, but if
your working against anything a bit complicated then it can cause
issues.
>
If you continue to have problems then I suggest you take a look at
Liquid XML Data Binder
>
http://www.liquid-technologies.com/P...taBinding.aspx
>
This supports much more of the xsd standard, and the objects are more
strongly typed (it also comes with a free XSD editor).
>
Hope this helps
>
Regards Simon
>
On 23 Jul, 08:00, "Joe Fawcett" <joefawc...@newsgroup.nospamwrote:
Jeff
>
IXmlSerializable is reasonably straightforward.
The newer version needs three methods, ReadXml, WriteXml and one to find the
Schema which is pointed to by an attribute, I normally just include the
schema as an embedded resource.
In ReadXml you get an XmlReader containing the XML and use it to populate
the object's fields, either reading it directly or loading it into a
DomDocumnt/XPathDocument if that's easier. WriteXml takes the fields and
creates an XML document.
There is an example here:http://www.devx.com/dotnet/Article/29720
>
--
>
Joe Fawcett (MVP - XML)http://joe.fawcett.name
>
"j.a. harriman" <jeffrey_no_spam_al...@nospam.nospamwrote in message
>
>news:04**********************************@microso ft.com...
>
Thanks for the answer Joe.
>
I also found some examples of using a style sheet and doing a
transformation
(Using XslCompiledTransform) of the original XmlDocument. I've run a test
and it seems to work in that the result is as if the original message
hadn't
had them in there. Are there any reasons why not to implement this?
>
Also, I tried to locate good "beginner" examples of using IXmlSerializable
that might be similar to what I need to do, but came up short. I would
like
to to look at this in further detail.
>
Do you have any links to examples or are you aware if any of the Microsoft
example downloads (such as SDK) have any?
>
Thanks. Jeff
>
"Joe Fawcett" wrote:
>
Unless you want to implement IXmlSerializable then I don't think you can
do
what you want. You can specify that a null element is shown as:
<myElement xsi:nil="true"/>
rather than being omitted entirely by adding the XmlElement(IsNullable =
true) attribute to the field/property.
>
--
>
Joe Fawcett (MVP - XML)
>
>http://joe.fawcett.name
>
"j.a. harriman" <jeffrey_no_spam_al...@nospam.nospamwrote in message
>news:69**********************************@microso ft.com...
Hi,
>
I have a schema that has an optional element, fieldTag4000Field. If
the
element is omitted from the XML request, when it is deserialized, it
will
be
null when I check it - which is fine.
>
What happens when the element is supplied as <fieldTag4000Field/>
(empty),
it does not equate to null. I want to be able handle this at the
deserialization level rahter than in my edits later.
>
Is there a way to alter the behavior so when I deserialize it, it is
null?
>
I also want to add that I am calling the "CanDeserialize" method of the
XmlSerializer object, passing in the request as a XmlNodeReader.
>
Thanks.
>
The following C# class snippet was generated by xsd.exe V2:
>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageType {
>
private Request_TypeMessageTypeFieldTag4000 fieldTag4000Field;
>
public Request_TypeMessageTypeFieldTag4000 FieldTag4000 {
get {
return this.fieldTag4000Field;
}
set {
this.fieldTag4000Field = value;
}
}
}
>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Xml.Serialization.XmlTypeAttribute(Anonymou sType=true,
Namespace="MyNamespace")]
public partial class Request_TypeMessageTypeFieldTag4000 {
>
private IDType_Type intermediaryIDCodeField;
>
private bool intermediaryIDCodeFieldSpecified;
>
private string intermediaryIdentifierField;
>
public IDType_Type IntermediaryIDCode {
get {
return this.intermediaryIDCodeField;
}
set {
this.intermediaryIDCodeField = value;
}
}
>
[System.Xml.Serialization.XmlIgnoreAttribute()]
public bool IntermediaryIDCodeSpecified {
get {
return this.intermediaryIDCodeFieldSpecified;
}
set {
this.intermediaryIDCodeFieldSpecified = value;
}
}
>
public string IntermediaryIdentifier {
get {
return this.intermediaryIdentifierField;
}
set {
this.intermediaryIdentifierField = value;
}
}
}
>
[System.CodeDom.Compiler.GeneratedCodeAttribute("xs d",
"2.0.50727.42")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="MyNamespace")]
public enum IDType_Type {
>
B,
>
C,
>
D,
>
F,
>
U,
}- Hide quoted text -
>
- Show quoted text -
Aug 1 '08 #9
j.a. harriman wrote:
The "real" XML has a number of "xmlns:" entries following the "parentnode".
When I remove them & test, this statement,
"/parentnode/secondchildnode//*[not(node())]", works as I was expecting.

Is there something I need to do with adding namespaces (e.g
XmlNamespaceManager) or something else that I am unaware of?
If there are XML namespace declarations and you have elements or
attributes in those namespaces you want to select with XPath then you
indeed should use an XmlNamespaceManager and bind prefixes to the
namespace URIs to use the prefixes in your XPath expressions to qualify
element or attribute names. The XmlNamespaceManager is then passed as
the second argument to the SelectNodes or SelectSingleNode calls.
If you need more concrete help then show us the relevant XML.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Aug 1 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Zion Zadik | last post by:
Dear all, I have a set of c# data classes which i need to fill their data from xml files. serialization looks to be the best way to accomplish this task. Since the data classes are compiled and...
8
by: Harris Boyce | last post by:
Hello, I'm trying to use the FOR XML EXPLICIT clause with SQL Server to deserialize data from my database into a strongly-typed collection object that I will use throughout my application. I...
0
by: keith bannister via .NET 247 | last post by:
(Type your message here) -------------------------------- From: keith bannister Hi, I'm new to .net (as of last week) but here goes. I want to serialize/deserialize a file the conforms...
5
by: Keith Bannister | last post by:
I'm new to .net so here goes. I'm tying to deserialize a class that is associated with an XML schema. I created the C# class with xsd.exe as below: xsd.exe /c /n:somenamespace...
4
by: Alexis | last post by:
Hello, Is there a way of telling the XmlSerializer to ignore all namespaces when deserializing. I'm using XmlAttributeOverrides, but I have to do it for every class the OutputObject usses. Is...
2
by: Vivek | last post by:
In an application which uses an XML file, I wish to use XmlSchemaValidator class to validate this file against the XSD file.. In the example of msdn, (...
0
by: Vivek | last post by:
In an application which uses an XML file, I wish to use XmlSchemaValidator class to validate this file against the XSD file.. In the example of msdn, (...
1
by: Yewen Tang | last post by:
I have a schema file datamodel.xsd, element "properties" is declared as a type of "baseProperty". The schema file also defines "derivedProperty" is a derived type of "baseProperty". <?xml...
0
by: conniehl | last post by:
Hello, I am trying to use XmlSerializer to deserialize an xml file and then use a loop to access the content. With the help of xsd.exe, a serializer class is generated and I am able to use that to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.