|
hi all,
I have created an xml dom document dynamically from ADO.save option.. and i hav cleaned the unnecesary schema info from that xml dom object by applying this style sheet...
*******************************************
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
xmlns:rs="urn:schemas-microsoft-com:rowset"
xmlns:z="#RowsetSchema">
<xsl: output indent="yes" method="xml" version="1.0" standalone="yes" />
<xsl:template match="/">
<DATA>
<xsl:apply-templates select="xml/rs:data/z:row"/>
</DATA>
</xsl:template>
<xsl:template match="xml/rs:data/z:row">
<ROW>
<xsl:for-each select="@*">
<xsl:element name="{name()}">
<xsl:value-of select="z:row"/>
</xsl:element>
</xsl:for-each>
</ROW>
</xsl:template>
</xsl:stylesheet>
************************************************
but it is giving output as :
************************************************
<?xml version="1.0" encoding="UTF-16" standalone="yes"?>
<DATA xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<ROW>
<COUNTRY_CODE></COUNTRY_CODE>
<COUNTRY_NAME></COUNTRY_NAME>
</ROW>
<ROW>
<COUNTRY_CODE></COUNTRY_CODE>
<COUNTRY_NAME></COUNTRY_NAME>
</ROW>
</DATA>
************************************************
But i want the output as :
************************************************
<?xml version="1.0" ?>
<DATA>
<ROW>
<COUNTRY_CODE></COUNTRY_CODE>
<COUNTRY_NAME></COUNTRY_NAME>
</ROW>
<ROW>
<COUNTRY_CODE></COUNTRY_CODE>
<COUNTRY_NAME></COUNTRY_NAME>
</ROW>
</DATA>
************************************************
any modification in stylesheet will help??? ... or can i use removeNamedItem to remove the attributes of the parent .. i.e
For the node :
<DATA xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
Can i use...
Element = objXML.documentElement.parentNode;
Atts = Element.attributes;
RemItem = Atts.removeNamedItem("xmlns:dt")
..ThanX for any help!
Rgds
ksm
ksm
|
|
|
|
|
<xsl:stylesheet exclude-result-prefixes="dt rs z"
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
okay 2 textboxes one box i have user input the other one is a password now i need to bind the userid and the datatime stamp to the listbox that i need to bind to xml file and then call and read that xml file into another listbox on another form
im using c#
Thanks any help would be greatly appreciated.......i checked out the article on msdn and im still lost.
Da Intern
|
|
|
|
|
is there any way to make a selection of the top 5 (or any number) rows with certain attributes.
I'm used to SQL language and have tried some of the xml features for this too but haven´t seen anything about selecting a certain number of "rows".
Anyone who knows?
Regards
M
|
|
|
|
|
You can use XPath to contruct a query, then depending on what language you are using to implement this you could (C# exmample):
public XmlNodeList Search(string input)
{
string query = "/mainnode/subnode/[name = " + input.Trim().ToString() + "]";
XmlDocument doc = new XmlDocument();
doc.Load("mydata.xml");
XmlNodeList nodes = doc.SelectNodes(query);
return nodes;
}
Then just iterate through your return XmlNodeList 5 times. I suppose there are other ways to do this, this is just a quick example.
-Nick Parker
|
|
|
|
|
Yep, the "pure" xsl solution will be using position() I believe, like this:
"/store/books[position() <= 5]"
This will select 5 first books
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Hi
I'm trying to access a sequence which is part of a node in an XML file.
<br />
<property pr_ref="ABC" ... ><br />
<sellingpoint text="HALLWAY" /><br />
<sellingpoint text="DINING ROOM" /><br />
<sellingpoint text="KITCHEN" /><br />
</property><br />
I can iterate through the "property" nodes and retrieve their columns (pr_ref) but how on earth do I access the sequence of selling points? I've tried childrows and parents rows and I'm lost!
I'm using VB.NET and I have the entire file in a DataSet. The second table of the dataset seems to contain ALL of the sellingpoint rows, not just those related to the one property.
I'm desperate!
Bernhard
Don't worry, nobody lives forever.
|
|
|
|
|
Well, if you have created the class for handling your dataset (Generate code or something), then you should be able to use a function of propertyRow , which named like GetSellingpointRows() .
If you don't see it, then you can try using GetChildRows anyway. I can't help you much with VB, but here is a link to IBuySpy[^]. You can download a VB version and see how they did this (look in PortalCfg.vb and Components/Configuration.vb):
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
Not sure this is the right forum but I have a problem generating XML for my IE Treeview Web control. With XML Explicit I get a long XML string that truncates returned data before generating the next line of code. I can only assume it's exceeded the 255 char record limit for SQL Server 2000 and is truncating data. The example in CODE PROJECT doesn't seem to address this because their sample of data is small. Any ideas? Thanks.
|
|
|
|
|
|
I have a rule that looks like this:
<xsl:template match="item" >
<item>
<xsl:apply-templates />
</item>
</xsl:template>
This matches all <item> nodes in my source document. However, the source document contains <item xsi:type="ns:AAA"> and <item xsi:type="ns:BBB"> nodes.
I want only the AAA nodes to be picked up. Any ideas...?
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Have you tried item[@xsi:type='ns:AAA'] as the match attribute?
|
|
|
|
|
Worked like a charm!
Thanks
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Hi..
I exported an access 2000 table to XML file
in some elements appears:
<Title>myDataHere</Title>
in some elements appears:
<Title>
<![CDATA[myDataHere]]>
</Title>
what does CDATA do ?
what if I ommit it ?
note than in cases that CDATA appears myDataHere includes (") or (..)
|
|
|
|
|
CDATA specifies a chunk of raw character data, terminated by ]]> . This allows you to embed data with characters with special meaning in XML (namely, < , > , & , and " ) without escaping them.
More info (straight from the XML spec):
http://www.w3.org/TR/REC-xml#sec-cdata-sect[^]
- Mike
|
|
|
|
|
CDATA is simply data that will not be parsed when read. For example, I have an XML help file that contains code snippets for common programming tasks. Since a lot of the characters in the code would violate XML rules and I don't want the format touched. I enter that data into my file as CDATA-type nodes.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
I didn't know about this. Helpful!
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Coolbeans. I'm glad I could you also.
By the way, great sig! Funny how words like that can mean different things to you depending on what you're currently going through in life.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
Tom Archer wrote:
By the way, great sig!
Tom Archer wrote:
Funny how words like that can mean different things to you depending on what you're currently going through in life.
True.
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Thank you all
|
|
|
|
|
I need to access the value of a node that also contains childnodes such as
<node>
text
<child>value</child>
</node>
Inner text doesn't work because I get the child text also. I think that the way Innertext is done is pretty bad. Any Ideas? Thanks.
Steve
Steve
Not all who wander are lost...
|
|
|
|
|
You can just iterate through the children (IXMLDOMNodeList) checking the type (IXMLDOMNode::nodeType), if it is a text node (NODE_TEXT) append the value to your string otherwise keep iterating...
|
|
|
|
|
Thanks. Will this also work on .NET?
Steve
Not all who wander are lost...
|
|
|
|
|
Sure, it'll work with any DOM/Language, just the interface/method/constants names may vary slightly...
|
|
|
|
|