473,386 Members | 1,821 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,386 software developers and data experts.

How to canonicalize an XML Document subsets

Hi,

I canonicalize document subset and result is different
from w3c.org examples. Do you know where is the problem?

thanks Martin

String xPath="(//. | //@* | //namespace::*)[self::mss:Parent or
(parent::Parent and not(self::Child)) or self::ns1:GrandChild or
parent::ns1:GrandChild]";

XmlNamespaceManager nsmgr=new
XmlNamespaceManager(message.NameTable);
nsmgr.AddNamespace("ns1","http://example.org/ns1");
XmlNodeList nodeList=message.SelectNodes(xPath,nsmgr);

XmlDsigC14NTransform tr=new XmlDsigC14NTransform();
tr.LoadInput(nodeList);
Stream res=(Stream)tr.GetOutput();

INPUT DOCUMENT:
<GrandParent xml:lang="en" xml:space="default">
<Parent xml:foo="bar" xml:fool="barbar">
<Child xml:foo="barbarossa" xml:lang="ge">
<GrandChild xml:space="preserve"/>
</Child>
</Parent>
</GrandParent>

MY RESULT:
<Parent xml:lang="en" xml:space="default" xml:foo="bar" xml:fool="barbar">
<GrandChild xml:foo="barbarossa" xml:lang="ge"
xml:space="preserve"></GrandChild>
</Parent>

CORRECT RESULT :
<Parent xml:foo="bar" xml:fool="barbar" xml:lang="en" xml:space="default">
<GrandChild xml:foo="barbarossa" xml:fool="barbar" xml:lang="ge"
xml:space="preserve"></GrandChild>
</Parent>

Nov 23 '05 #1
0 1187

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

Similar topics

3
by: Simon | last post by:
Hi, I'm hoping you could show me examples of how a functional/declarative language could be used to consicely describe resticted subsets of elements. I'm looking for a 'specification' style...
4
by: Oleg Subachev | last post by:
I need to canonicalize (in the sence of http://www.w3.org/TR/xml-c14n) some input XML and get canonicalized output XML. How can I perform this under .NET ? -- Oleg Subachev
0
by: Pollux | last post by:
Hi, I'm having a problem canonicalizing an xml document and getting a hash that matches that of an existing document so I was wondering if somebody knew what I was doing wrong. I generate an...
1
by: Pollux | last post by:
Hi I previously posted a question which hasn't been answered, so I figured it must have been too complicated. I must admit that I didn't make it very easy to follow. In fact, the information I...
0
by: Martin Silar | last post by:
Hi, I canonicalize document subset and result is different from w3c.org examples. Do you know where is the problem? thanks Martin String xPath="(//. | //@* | //namespace::*)"; ...
7
by: Gaijinco | last post by:
I been thinking about this topic for a long time. The best I have done is the following code: #include <iostream> using namespace std; #include <cmath> int main(){ const int SIZE=3;
4
by: LurfysMa | last post by:
I could use some help with a table design problem. I have an electronic flashcard program. Actually, several of them. They each rely on a utility program to keep track of the usage statistics....
3
by: Lord0 | last post by:
I *think* I need to be able to validate subsets of an XML document using different schema. The functionality I'm trying to implement is this. a) External suppliers produce an XML document...
4
by: Patrick | last post by:
Hi, I want to write a programs that checks if a set of numbers in a list obey a condition, the problem is that i have say "n" numbers and i need to check all subsets of the n numbers for the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.