473,325 Members | 2,308 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,325 software developers and data experts.

I cannot create an XML element with a namespace


I have got to create an XML file using XMLDocument() like this:

<?xml version="1.0" encoding="UTF-8" ?>
- <xml xmlns:xi="http://www.dpr.co.uk/mplcvalidationtables/">
- <xi:table ValidationTable="3" Heading="A/C Control Status"
Description="Description">
<item Code="AA" CodeDescription="Arrears Arrangement" />
<item Code="AD" CodeDescription="Arrears Arrangement Defaulted" />
<item Code="D" CodeDescription="Deceased" />
</ xi:table>
- < xi:table ValidationTable="4" Heading="Capital Adequacy Grp"
Description="Group Description">
<item Code="0" CodeDescription="Capital Adequacy Group 0" />
<item Code="1" CodeDescription="Adequacy Group 1" />
</ xi:table>

I got mostly all this, but I cannot create an XML element with a namespace
(xi:table), the prefix property seems not to have any effect. And the element
created it’s only <table………………>
Thanks,
Filippo

Mar 20 '07 #1
3 1678
On Mar 20, 6:14 am, Filippo Bettinaglio
<FilippoBettinag...@discussions.microsoft.comwrote :
I have got to create an XML file using XMLDocument() like this:

<?xml version="1.0" encoding="UTF-8" ?>
- <xml xmlns:xi="http://www.dpr.co.uk/mplcvalidationtables/">
- <xi:table ValidationTable="3" Heading="A/C Control Status"
Description="Description">
<item Code="AA" CodeDescription="Arrears Arrangement" />
<item Code="AD" CodeDescription="Arrears Arrangement Defaulted" />
<item Code="D" CodeDescription="Deceased" />
</ xi:table>
- < xi:table ValidationTable="4" Heading="Capital Adequacy Grp"
Description="Group Description">
<item Code="0" CodeDescription="Capital Adequacy Group 0" />
<item Code="1" CodeDescription="Adequacy Group 1" />
</ xi:table>

I got mostly all this, but I cannot create an XML element with a namespace
(xi:table), the prefix property seems not to have any effect. And the element
created it's only <table..................>

Thanks,
Filippo
try this.

XmlNode oNode = oXML.CreateElement("xi:Table","xi");

-
shashank kadge

Mar 20 '07 #2

doing

newnode = xDoc2.CreateElement("xi:table","xi"); as you said I got

<xi:table ValidationTable="4" Heading="Capital Adequacy Grp"
Description="Group Description" xmlns:xi="xi">

but I do not need the .....xmlns:xi="xi"... and it is also wrong,

this is declared at the top for the XML document:

<xml xmlns:xi="http://www.dpr.co.uk/mplcvalidationtables/">

Thanks,
Filippo
"shashank kadge" wrote:
On Mar 20, 6:14 am, Filippo Bettinaglio
<FilippoBettinag...@discussions.microsoft.comwrote :
I have got to create an XML file using XMLDocument() like this:

<?xml version="1.0" encoding="UTF-8" ?>
- <xml xmlns:xi="http://www.dpr.co.uk/mplcvalidationtables/">
- <xi:table ValidationTable="3" Heading="A/C Control Status"
Description="Description">
<item Code="AA" CodeDescription="Arrears Arrangement" />
<item Code="AD" CodeDescription="Arrears Arrangement Defaulted" />
<item Code="D" CodeDescription="Deceased" />
</ xi:table>
- < xi:table ValidationTable="4" Heading="Capital Adequacy Grp"
Description="Group Description">
<item Code="0" CodeDescription="Capital Adequacy Group 0" />
<item Code="1" CodeDescription="Adequacy Group 1" />
</ xi:table>

I got mostly all this, but I cannot create an XML element with a namespace
(xi:table), the prefix property seems not to have any effect. And the element
created it's only <table..................>

Thanks,
Filippo

try this.

XmlNode oNode = oXML.CreateElement("xi:Table","xi");

-
shashank kadge

Mar 22 '07 #3
On Mar 22, 5:15 am, Filippo Bettinaglio
<FilippoBettinag...@discussions.microsoft.comwrote :
doing

newnode = xDoc2.CreateElement("xi:table","xi"); as you said I got

<xi:table ValidationTable="4" Heading="Capital Adequacy Grp"
Description="Group Description" xmlns:xi="xi">

but I do not need the .....xmlns:xi="xi"... and it is also wrong,

this is declared at the top for the XML document:

<xml xmlns:xi="http://www.dpr.co.uk/mplcvalidationtables/">

Thanks,
Filippo

"shashank kadge" wrote:
On Mar 20, 6:14 am, Filippo Bettinaglio
<FilippoBettinag...@discussions.microsoft.comwrote :
I have got to create an XML file using XMLDocument() like this:
<?xml version="1.0" encoding="UTF-8" ?>
- <xml xmlns:xi="http://www.dpr.co.uk/mplcvalidationtables/">
- <xi:table ValidationTable="3" Heading="A/C Control Status"
Description="Description">
<item Code="AA" CodeDescription="Arrears Arrangement" />
<item Code="AD" CodeDescription="Arrears Arrangement Defaulted" />
<item Code="D" CodeDescription="Deceased" />
</ xi:table>
- < xi:table ValidationTable="4" Heading="Capital Adequacy Grp"
Description="Group Description">
<item Code="0" CodeDescription="Capital Adequacy Group 0" />
<item Code="1" CodeDescription="Adequacy Group 1" />
</ xi:table>
I got mostly all this, but I cannot create an XML element with a namespace
(xi:table), the prefix property seems not to have any effect. And the element
created it's only <table..................>
Thanks,
Filippo
try this.
XmlNode oNode = oXML.CreateElement("xi:Table","xi");
-
shashank kadge- Hide quoted text -

- Show quoted text -
okay. try this.
************************************************** ***********
XmlDocument oXML = new XmlDocument();
XmlDeclaration oDec = oXML.CreateXmlDeclaration("1.0","","yes");
oXML.PrependChild(oDec);

XmlElement oRoot = oXML.CreateElement("xi","AD","http://
www.dpr.co.uk/mplcvalidationtables");
oXML.AppendChild(oRoot);

for(int iLoop=0;iLoop<3;iLoop++)
{
XmlNode oNode = oXML.CreateElement("xi","Table","http://
www.dpr.co.uk/mplcvalidationtables");
oXML.DocumentElement.AppendChild(oNode);

}

MessageBox.Show(oXML.OuterXml);
************************************************** ***********

let me know if u find any other way.

-
shashank kadge

Mar 22 '07 #4

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

Similar topics

1
by: wooks | last post by:
The schema below describes an interface to a form where the appInterface type is an extension of an abstract type called interface and it contains an appFrame element that is an extension of an...
2
by: PeterW | last post by:
I have an xml file from which I want to generate an xsd schema and at a later stage a cs class. The xml file has a mix of defined namespaces and also an empty namespace. These are defined as...
3
by: ciaran.mchale | last post by:
Hi folks, I downloaded the binary version of Xerces C++ 2.7.0 for Windows and am using it to help me get up to speed with XML and XML Schema. So please excuse me if this is a "novice" question....
1
by: Hennesey | last post by:
Hello all, I am developing a Visual Studio .Net 2005 application that consumes an Axis 1.3 web service. Importing the WSDL file generates an error "cannot resolve apachesoap:Map type" ...
0
by: DotDidIt | last post by:
Hi Everybody! I developed a Web service with IBM RAD v 6.0.1. After creating the WSDL file i have tried to develop a .Net client. But by using wsdl.exe (1.1.4322) to create a .net c# proxy i...
16
by: TT (Tom Tempelaere) | last post by:
Hi all, I created an XSD to define the structure of an XML file for my project. I made an XML file linked to the XSD using XmlSpy. The problem is that if I read the file using .NET XmlDocument...
0
by: =?Utf-8?B?RmlsaXBwbyBCZXR0aW5hZ2xpbw==?= | last post by:
I have got to create an XML file using XMLDocument() like this: <?xml version="1.0" encoding="UTF-8" ?> - <xml xmlns:xi="http://www.dpr.co.uk/mplcvalidationtables/"> - <xi:table...
5
by: carlpayne1984 | last post by:
Hi all, I'm fairly new to XML, however already I have studied myself stupid without being able to solve this problem. Basically, I have an XML file/Schema about a CD catalog that I've created that...
13
by: Bill Nguyen | last post by:
Is it possible to create your won XSD to use with .NET based on an XML content? For example the one below: <?xml version="1.0"?> <pcats:FuelsDoc...
4
by: =?Utf-8?B?VG9yZW4gVmFsb25l?= | last post by:
Was editing code, am getting the following errors } expected Type or namespace definition, or end-of-file expected Eyes crossed cannot find code below! using System; using...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.