473,662 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get rid of extra namespace

I've the following code:

writer.WriteSta rtDocument();
writer.WriteSta rtElement("n", "Property", "http://www.aaa.com");
writer.WriteAtt ributeString("x mlns", "j", null, "http://www.bbb.com");

writer.WriteAtt ributeString("x mlns", "n", null, "http://www.aaa.com");

writer.WriteEle mentString("Pro pertyDescriptio nText", "http://www.bbb.com",
"hello");

string prefix = writer.LookupPr efix("http://www.aaa.com");
string prefix2 = writer.LookupPr efix("http://www.bbb.com");

writer.WriteEle mentString("Pro pertyUNCode", "http://www.aaa.com", "1234");
writer.WriteSta rtElement(prefi x2, "PropertyStatus ", "http://www.bbb.com");
writer.WriteEle mentString("Sta tusText", "http://www.bbb.com", "FOUND");
writer.WriteEnd Element();
....

I got the following output

<n:Property xmlns:n="http://www.aaa.org">
<j:PropertyDesc riptionText
xmlns:j="http://www.bbb.com">He llo</j:PropertyDescr iptionText>
<n:PropertyUNCo de>1234</n:PropertyUNCod e>
<j:PropertyStat us xmlns:j="http://www.bbb.com">
<j:StatusText>F OUND</j:StatusText>
</j:PropertyStatu s>

Instead i want the output to be

<n:Property xmlns:n="http://www.aaa.com" xmlns:j="http://www.bbb.com">
<j:PropertyDesc riptionText>Hel lo</j:PropertyDescr iptionText>
<n:PropertyUNCo de>1234</n:PropertyUNCod e>
<j:PropertyStat us>
<j:StatusText>F OUND</j:StatusText>
</j:PropertyStatu s>

where xmlns:j is the attribute of the root node and get rid of subsequence
display of the namespace in element that refering to "http:www.bbb.c om"

Jul 21 '05 #1
1 1021
you may want to post this question to
Microsoft.Publi c.DotNet.XML

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Willie" <Wi****@discuss ions.microsoft. com> wrote in message
news:8A******** *************** ***********@mic rosoft.com...
I've the following code:

writer.WriteSta rtDocument();
writer.WriteSta rtElement("n", "Property", "http://www.aaa.com");
writer.WriteAtt ributeString("x mlns", "j", null, "http://www.bbb.com");

writer.WriteAtt ributeString("x mlns", "n", null, "http://www.aaa.com");

writer.WriteEle mentString("Pro pertyDescriptio nText", "http://www.bbb.com",
"hello");

string prefix = writer.LookupPr efix("http://www.aaa.com");
string prefix2 = writer.LookupPr efix("http://www.bbb.com");

writer.WriteEle mentString("Pro pertyUNCode", "http://www.aaa.com", "1234");
writer.WriteSta rtElement(prefi x2, "PropertyStatus ", "http://www.bbb.com");
writer.WriteEle mentString("Sta tusText", "http://www.bbb.com", "FOUND");
writer.WriteEnd Element();
...

I got the following output

<n:Property xmlns:n="http://www.aaa.org">
<j:PropertyDesc riptionText
xmlns:j="http://www.bbb.com">He llo</j:PropertyDescr iptionText>
<n:PropertyUNCo de>1234</n:PropertyUNCod e>
<j:PropertyStat us xmlns:j="http://www.bbb.com">
<j:StatusText>F OUND</j:StatusText>
</j:PropertyStatu s>

Instead i want the output to be

<n:Property xmlns:n="http://www.aaa.com" xmlns:j="http://www.bbb.com">
<j:PropertyDesc riptionText>Hel lo</j:PropertyDescr iptionText>
<n:PropertyUNCo de>1234</n:PropertyUNCod e>
<j:PropertyStat us>
<j:StatusText>F OUND</j:StatusText>
</j:PropertyStatu s>

where xmlns:j is the attribute of the root node and get rid of subsequence
display of the namespace in element that refering to "http:www.bbb.c om"

Jul 21 '05 #2

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

Similar topics

1
4132
by: Chris Bedford | last post by:
Hi: this question has been driving me crazy. would be grateful for any help. I am writing a version of the identity transformation to filter some documents (they happen to be wsdl docs). My problem is that for just about every element in the output document all of the namespace defintions defined in my top
8
2287
by: Some Clown | last post by:
Well... after much consultation with folks on this group, I was convinced that using char arrays and such was bad. I had no clue due in no small part to me being a complete newbie, and the fact that I've been studying an outdated book. Anyhow... now I've been reading up on std::string, vector, iterators, etc and have re-written my playlist editing program using these new features. Thanks to those who've helped me along so far. So...
0
1362
by: IMS.Rushikesh | last post by:
Hi All, I want to serialize an object which contain the DataTable. As DataSet is MarshalByRef object and is serializable. I am using it directly. Even my data is also serialize and save it to XML file. Now as DataSet serialize, it's creating some extra information (schema information), And i don't need that. I only want to store the data in XML format. I don't want to store extra details like namespace etc... As it's increase XML file...
2
1801
by: matthew.schneider | last post by:
I have a defined XML Schema, and XML documents containing data that I validate against it. Periodically, I will have a data document that will contain extra elements that are not part of my schema. The powers that be have determined that this is acceptable. I am looking for the best way to continue to validate my documents against my schema, but ignore any errors dealing with extra elements. My first thought is to use a...
5
1513
by: voidfill3d | last post by:
I have a problem with ASP.NET and entering data into a MS SQL database. I have the following code and what happens is the data gets into the database, but with one extra space at the end of the entry. Is this preventable with something other than a trim in my stored procedure? I know this is not necessarily in ASP.NET because I returned the value with quotes around it and it shows up right, but when I look in the database, it is...
2
1405
by: Siegfried Heintze | last post by:
I'm running on g++ v2.95 and 3.2. Why is it that the print functions work fine without any extra template parameters, but the SizeOfCod2 function requires that the bold code be uncommented? Thanks,
2
2446
by: ricky | last post by:
Can anybody help with the function to get rid of extra characters in the file. I want to remove the string from the file.So i read from input file and pass the string say "john" if found dnt write it to the ouput file but if not found write all the line to the output file so i read line by line cin.get(input,line) if(line != s) output<<line
4
1795
by: VK | last post by:
Can well-formed but non-validated XHTML have extra namespaces? Say <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head>
1
2818
by: Paul J. Lucas | last post by:
I have code that builds a DOM using the Java org.w3c.dom API and it adds an extra attribute to one of the elements that I don't want. Not only that, the value it adds is wrong. The code to create the DOM is: String emptyXMPString = "<x:xmpmeta xmlns:x='adobe:ns:meta/'>\n" + " <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'/>\n" + "</x:xmpmeta>\n";
11
2000
by: Trent | last post by:
Running this I see that on first run, both bubble and selection sort have 9 sort counts while insertion sort has ZERO. With a sorted list, should this be ZERO for all? Also bsort and Ssort have the same exact sorting counts also..shouldn't they differ somewhat? Source and data file below. Thanks
0
8432
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...
1
8546
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
8633
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
7367
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
5654
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
4180
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...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1993
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1752
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.