473,698 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to add xsi:schemaLocat ion attribute to XML element

Hi all,

I am trying to serialize a C# object into a XML document
using "XmlSeriali zer" class. One of the elements of the XML document
needs a "xsi:schemaLoca tion" attribute. I am not sure how to add this
to the XML element
Please help me with if you can.

Thanks,
kaush

Nov 12 '05 #1
2 7496
JMD
The root element of the document can contain, along with all the xmlns
stuff, an attribute called
xsi:schemaLocat ion="namespaceU RI filename.xsd"

There are two tokens inside the single string. This is a hint for the
validator to know where to find a physical xsd file to go with that
namespace.

--John

Nov 12 '05 #2
If I add it to the root element of the element for which I need to add
the xsi:schemaLocat ion attribute, it does not seem to be working.

Below is the partial XML doc:

<ProcessMessa ge
xmlns="http://www.starstandar ds.org/webservices/2003/12/transport">
<payload
xmlns="http://www.starstandar ds.org/webservices/2003/12/transport">
<Content id="Content0">
<rey_ServiceSta tusRequest
xmlns="http://www.starstandar ds.org/STAR"> ...this goes on .
"rey_ServiceSta tusRequest" parent is "Content"
I need to add the xsi:schemaLocat ion attribute to
"rey_ServiceSta tusRequest" element. Actually this XML document I
produce it from a C# object. I use XMLSERIALIZE class to serialize the
object into XML document. For some reason I am not able to add the
xsi:schemaLocat ion attribute. I am able to add schemaLocation attribute
without the "xsi" prefix. I am able to do this using
//[System.Xml.Seri alization.XmlAt tributeAttribut e(DataType="any URI")].
This declaration is for a particular memeber of the class.

Could you please help me out ?

The only other option I have is to construct the XML doc "element" by
"element" which I do not want to do.

Please help

Nov 12 '05 #3

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

Similar topics

1
6377
by: Naresh Agarwal | last post by:
Hi I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing. I want to perform schema validations on the xml. The problem is that root element of XML document does not have "xsi:schemaLocation" attribute, which is used to specify the .xsd file. Is there any other way for specifying the name of .xsd file?
1
2434
by: Naresh Agarwal | last post by:
Hi I'm using SAX Parser of Xerces Java v2.4.0 for XML Parsing. I want to perform schema validations on the xml. The problem is that root element of XML document does not have "xsi:schemaLocation" attribute, which is used to specify the .xsd file. Is there any other way for specifying the name of .xsd file?
0
10737
by: Sarah Tegtmeier | last post by:
Hi I have a question about the correct use of the attribute xsi:schemaLocation. My programm has to process XML files where the value of this attribute causes some problems. The programm is written in C++ using Xerces C++ version 2.3.0. An older older version of the programm used Xerces C++ version 1.6.0. The XML files look like the following example:
0
2677
by: Ron James | last post by:
I'm developing a GUI application in C#. I have a schema file (.XSD) and am able to serialize and deserialize the applications data using the schema file to an .XML file. (I'm using xsd.exe to generate my serializable class, XmlSerializer to Serialize and DeSerialize and XMLValidatingReader to validate. My intention is that application users can edit the content of the .XML file using their favorite XML editor as well as by using my...
0
650
by: kaushsoap | last post by:
Hi all, I am trying to serialize a C# object into a XML document using "XmlSerializer" class. One of the elements of the XML document needs a "xsi:schemaLocation" attribute. I am not sure how to add this to my XML element Please help me with this if you can. Thanks, kaush
1
2364
by: jean | last post by:
I am creating an xmldatadocument from an acess database with visual basic. Here is the header code I am using: Dim xmldcl As XmlDeclaration = myDoc.CreateXmlDeclaration("1.0", "UTF-8", "yes") Dim newElem As XmlElement = myDoc.CreateElement("sender") newElem.SetAttribute("schemaVersion", "1.0") newElem.SetAttribute("xmlns", "http://www.somewhere.org") newElem.SetAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")
0
1955
by: kolja2003 | last post by:
Hi, I need to program the creation of the XML file of given structure. I try to do it through the serialization of class object. hence I need to write the class definition which will be serialized to needed XML file. So I descibed all structure of my XML file at class definition unless one thing. In my XML file I have the expression like <xsi:schemaLocation="http://tempuri.org/schema..\schema\StandartReport.xsd"> in root element. And I...
2
18461
by: grochmal | last post by:
I am trying to use XmlSerializer to serialize a class I have created specifically for generating an XML file. The problem is that the XML file must contain a xsi:schemaLocation attribute in my root node but I can't figure out any way to do it. Here is what the resulting XML file must look like (small sample): <TXLife xmlns="http://ACORD.org/Standards/Life/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
0
6262
by: spiceworm | last post by:
Hi all, I'm getting really confused how to solve this. I've got this class generated from XSD with xsd (from visual studio 2005) namespace gpx { using System.Xml.Serialization;
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9029
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...
0
8862
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...
0
7729
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
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
3050
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
2331
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2002
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.