473,804 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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/mplcvalidationt ables/">
- <xi:table ValidationTable ="3" Heading="A/C Control Status"
Description="De scription">
<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="Capita l Adequacy Grp"
Description="Gr oup 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 1699
On Mar 20, 6:14 am, Filippo Bettinaglio
<FilippoBettina g...@discussion s.microsoft.com wrote:
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/mplcvalidationt ables/">
- <xi:table ValidationTable ="3" Heading="A/C Control Status"
Description="De scription">
<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="Capita l Adequacy Grp"
Description="Gr oup 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.CreateElem ent("xi:Table", "xi");

-
shashank kadge

Mar 20 '07 #2

doing

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

<xi:table ValidationTable ="4" Heading="Capita l Adequacy Grp"
Description="Gr oup 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/mplcvalidationt ables/">

Thanks,
Filippo
"shashank kadge" wrote:
On Mar 20, 6:14 am, Filippo Bettinaglio
<FilippoBettina g...@discussion s.microsoft.com wrote:
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/mplcvalidationt ables/">
- <xi:table ValidationTable ="3" Heading="A/C Control Status"
Description="De scription">
<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="Capita l Adequacy Grp"
Description="Gr oup 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.CreateElem ent("xi:Table", "xi");

-
shashank kadge

Mar 22 '07 #3
On Mar 22, 5:15 am, Filippo Bettinaglio
<FilippoBettina g...@discussion s.microsoft.com wrote:
doing

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

<xi:table ValidationTable ="4" Heading="Capita l Adequacy Grp"
Description="Gr oup 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/mplcvalidationt ables/">

Thanks,
Filippo

"shashank kadge" wrote:
On Mar 20, 6:14 am, Filippo Bettinaglio
<FilippoBettina g...@discussion s.microsoft.com wrote:
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/mplcvalidationt ables/">
- <xi:table ValidationTable ="3" Heading="A/C Control Status"
Description="De scription">
<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="Capita l Adequacy Grp"
Description="Gr oup 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.CreateElem ent("xi:Table", "xi");
-
shashank kadge- Hide quoted text -

- Show quoted text -
okay. try this.
*************** *************** *************** *************** *
XmlDocument oXML = new XmlDocument();
XmlDeclaration oDec = oXML.CreateXmlD eclaration("1.0 ","","yes") ;
oXML.PrependChi ld(oDec);

XmlElement oRoot = oXML.CreateElem ent("xi","AD"," http://
www.dpr.co.uk/mplcvalidationt ables");
oXML.AppendChil d(oRoot);

for(int iLoop=0;iLoop<3 ;iLoop++)
{
XmlNode oNode = oXML.CreateElem ent("xi","Table ","http://
www.dpr.co.uk/mplcvalidationt ables");
oXML.DocumentEl ement.AppendChi ld(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
2189
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 empty abstract complex type called frameInterface (the reason for that is so that the system will recognise all frames by virtue of their being derived from frameInterface type). <?xml version="1.0"?> <xsd:schema...
2
6935
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 follows: <silcn:silcn xmlns:silcn='http://silcn.org/200309' xmlns='http://xmlprobe.com/200312'> it contains an element <report> off the root and also a separate <Silcn:report> again off the root.
3
2765
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. In the samples/data directory, I ran the following command for all the files: DOMPrint -n -s -f -v=always <filename>
1
4965
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" What's wrong? Does the JAVA guy has to correct something?
0
1802
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 get the following error message: Schema parsing error Namespace 'http://session.ejbs.cac.commerce.com' is not available to be referenced in this schema. Schema parsing error Namespace 'http://session.ejbs.cac.commerce.com'
16
3532
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 and then query for the root element, the result is always null (1). However if I strip the root element of all attributes generated by XmlSpy, then there is no problem to find the root element with .NET XML classes (2). (1) The XML for which...
0
878
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 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>
5
40945
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 I want to combine with an XML/Schema that a friend has created. Both XML files/Schema validate individually. Now comes the tricky part, combining them. I've created a new XML file and schema, called catalog.xml and catalog.xsd. Into the...
13
8169
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 xmlns="http://www.naxml.org/Retail-EDI/Vocabulary/2003-10-16" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="NAXML-FuelPrice15.xsd"> <pcats:TransmissionHeader>
4
1880
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 System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing;
0
9715
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
10603
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10356
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
10099
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
9176
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
5536
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
4314
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
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3003
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.