473,770 Members | 7,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

xsi:noNamespace SchemaLocation Problem


I use the following code to create the XML from a class object

Dim serialize As New
System.Xml.Seri alization.XmlSe rializer(GetTyp e(XYZObject))
serialize.Seria lize(obWtiter, obObject)
But I need the following ' xsi:noNamespace SchemaLocation= "obj-envelope.xsd"'
to be included in the in the main opening tag

How can I cause the XmlSerializer to do that?

Thank you,
Samuel
Aug 7 '08 #1
3 5418


"Samuel" <sa************ @ntlworld.comwr ote in message
news:O3******** ******@TK2MSFTN GP05.phx.gbl...
>
I use the following code to create the XML from a class object

Dim serialize As New
System.Xml.Seri alization.XmlSe rializer(GetTyp e(XYZObject))
serialize.Seria lize(obWtiter, obObject)
But I need the following '
xsi:noNamespace SchemaLocation= "obj-envelope.xsd"' to be included in the in
the main opening tag

How can I cause the XmlSerializer to do that?

Thank you,
Samuel
This seems to be what you are looking for:
http://johnstewien.spa ces.live.com/blog/cns!E6885DB5CEB ABBC8!888.entry

--

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

Aug 8 '08 #2

"Joe Fawcett" <jo********@new sgroup.nospamwr ote in message
news:%2******** **********@TK2M SFTNGP04.phx.gb l...
>

"Samuel" <sa************ @ntlworld.comwr ote in message
news:O3******** ******@TK2MSFTN GP05.phx.gbl...
>>
I use the following code to create the XML from a class object

Dim serialize As New
System.Xml.Ser ialization.XmlS erializer(GetTy pe(XYZObject))
serialize.Seria lize(obWtiter, obObject)
But I need the following '
xsi:noNamespac eSchemaLocation ="obj-envelope.xsd"' to be included in the
in the main opening tag

How can I cause the XmlSerializer to do that?

Thank you,
Samuel
This seems to be what you are looking for:
http://johnstewien.spa ces.live.com/blog/cns!E6885DB5CEB ABBC8!888.entry

--

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

Thank you for the link,

I managed to add the xsd reference

The actual code didn't work so I wonder how can I set the encoding that the
serelizer will use

Thank you,
Samuel
Aug 8 '08 #3
Samuel wrote:
"Joe Fawcett" <jo********@new sgroup.nospamwr ote in message
news:%2******** **********@TK2M SFTNGP04.phx.gb l...
The actual code didn't work so I wonder how can I set the encoding that the
serelizer will use
The Serialize method has several overloads
http://msdn.microsoft.com/en-us/libr...serialize.aspx
if you pass in a TextWriter it will use the encoding of the TextWriter,
if you pass in an XmlWriter you can set the encoding with the
XmlWriterSettin gs you create the XmlWriter with:
Dim wSettings As New XmlWriterSettin gs()
wSettings.Encod ing = Encoding.UTF8
Using xWriter As XmlWriter = XmlWriter.Creat e("file.xml", wSettings)
serializer.Seri alize(xWriter, someObject)
End Using
--

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

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

Similar topics

0
1807
by: Lindy | last post by:
I'm using VB .Net and am new to XML. I need to create an XML file with the following lines: <?xml version="1.0" encoding="UTF-8" ?> - <HC_DATA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://.../asc.xsd"> other stuff... </HC_DATA>
0
1502
by: Lindy | last post by:
I'm using VB .Net and am new to XML. I need to create an XML file with the following lines: <?xml version="1.0" encoding="UTF-8" ?> - <HC_DATA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://.../asc.xsd"> other stuff... </HC_DATA>
1
2323
by: Tjerk Wolterink | last post by:
Who can learn me the difference between the these two attributes: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation and xsi:noNamespaceSchemaLocation
0
4565
by: jr | last post by:
Hello, I have got a schema file "myschema.xsd" from my customer for which I must create xml files. I used xsd.exe to create a class for the schema. I fill an object for that class with data and serialize it. My customer gave me an example xml file, how it should look like, and it begins with <?xml version="1.0" encoding="UTF-8"?>
1
7895
by: Balaji V | last post by:
Hi, I am creating C# calsses to seralize and deserialize based on xsd. When defining the classes to do seralization i need to specify the schema for the reference. Typically my class definition looks like this : public class MyClass
1
7797
by: AP | last post by:
Hi, I'm getting the following error trying to validate an xml document against a schema: The 'xsi:noNameSpaceSchemaLocation' attribute is not declared My xml file looks like this: <?xml version="1.0" encoding="utf-8"?> <TitleNotification xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" d1p1:noNameSpaceSchemaLocation="http://www.pdr.com&#xA;https://extw3c.pdr.co...
3
6750
by: Mark Jerde | last post by:
I've been looking through MSDN, books and googling for a couple hours but haven't found the solution yet. I'm using CSharp in VS .NET 2003. I'm trying to use XmlDocument to save XML files that are valid to a schema I've developed. I want the root element to look like this: <TestCase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="TestCaseSchema_03.xsd"> I've tried several variations of...
1
7822
by: Craig | last post by:
Hi there, I'm generating an XML script using ElementTree which has the following attributes in the root element: <CANmessages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="code/can.xsd"> My python script I have written is:
2
2480
by: =?ISO-8859-1?Q?Jean=2DFran=E7ois_Michaud?= | last post by:
Hello guys, I was wondering if it was possible to disregard the xsi:noNamespaceSchemaLocation. For validation it's obviously easier to have it point to say a local directory but the final xsi:noNamespaceSchemaLocation has to point to a specific location that is not local. I was wondering if it was possible to make sure that the xsi:noNamespaceSchemaLocation points to the non local location, force the parser to disregard the...
0
9592
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10004
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9870
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.