|
Yes - see here[^]
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanks alot sir...
J A Nasir K
|
|
|
|
|
Hi
I have 2 XML files. The one looks like the following at the top:
<?xml version="1.0" standalone="yes" ?>
- <NewDataSet>
And the other one as follows:
<?xml version="1.0" standalone="yes" ?>
- <dsParrys_offoice_furniture xmlns="http://tempuri.org/dsParrys_offoice_furniture.xsd">
I use the following in my XAML to bind to them:
<!--XmlDataProvider used to populate treeview-->
<XmlDataProvider x:Key="dpNewDS" XPath="*"/>
<!--ProductRange template-->
<HierarchicalDataTemplate DataType="ProductRange" ItemsSource="{Binding XPath=*}">
<WrapPanel>
<TextBlock Text="{Binding XPath=ProductRangeDesc}"/>
</WrapPanel>
</HierarchicalDataTemplate>
<!--Products template-->
<HierarchicalDataTemplate DataType="Products" ItemsSource ="{Binding XPath=Products}">
<WrapPanel>
<TextBlock Text="{Binding XPath=Product}"/>
</WrapPanel>
</HierarchicalDataTemplate>
As well as these lines in the code behind file:
NOTE: I specify the path to the XML files using an OpenFileDialog
System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string fileName = ofd.FileName;
XmlDataProvider dp = this.FindResource("dpNewDS") as XmlDataProvider;
dp.Source = new Uri(fileName);
}
Now when I select the FIRST XML file my treeview binds fine, but when I select to the 2nd one (the one with the XMLNS defined), it does not bind correctly.
Is there something I should change in my XAML when binding to the 2nd XML file?
|
|
|
|
|
Don't say it's urgent. It's not, we really don't care. Did you cross post this, or did you fail to post it in the WPF forum ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
If you don't have an answer to post, why bother to reply? Seriously. And don't refer to "we" when its just you replying, please.
This HAS got to do with XML by the way, as well as WPF. When I post this sort of question in the WPF forums I get told that I should post it in the XML forum, now when I post it here I get told I should post it in the WPF forum.
|
|
|
|
|
Well, I'm sorry that someone told you that, because it seems to me that it has to do with how WPF parses XML, not just XML. So, you'll have more luck in the WPF forum. And I suggest that entirely to try to help you find an answer.
I said 'we' because I'm referring to community standards. It's rude to tell us that your question is urgent. If you can't wait for a free answer, find a way to pay for one.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Can you please specify the path for your XML files. So that we can look into it in broader way
|
|
|
|
|
Hi guys
I use the following to specify the Uri path for the XmlDataProvider dp:
System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string fileName = ofd.FileName;
XmlDataProvider dp = this.FindResource("dpNewDS") as XmlDataProvider;
dp.Source = new Uri(fileName);
}
Now I want to now, what if I don't want to use an OpenFileDialog to specify the path, but instead I want to specify it myself. I know typing in the folder address e.g C:\xmlfile.xml works fine, but I don't want to hard code the path. I want to keep the file in the "bin" folder, how do I specify the path to this folder?
I tried various methods but none seemed to work.
|
|
|
|
|
Hi everybody
I recently got it working to bind an XML file to a treeview using a XmlDataProvider, but my problem is that my XML file does not contain attributes which can be easily bound to. Here's a sample of what my XML looks like:
<Product_x0020_range>
<Product_x0020_range_x0020_id>1</Product_x0020_range_x0020_id>
<Product_x0020_Range>Specials</Product_x0020_Range>
<Products>
<quote_x0020_id>270</quote_x0020_id>
<date>2008-10-14T00:00:00+02:00</date>
<x_x0020_hide_x0020_options_x0020_id>12</x_x0020_hide_x0020_options_x0020_id>
<Product_x0020_range_x0020_id>1</Product_x0020_range_x0020_id>
<Product>QQ CORE 2200 X 800 X 1500 X 600</Product>
<height>0</height>
<breadth_x002F_depth>0</breadth_x002F_depth>
<length_x002F_width>0</length_x002F_width>
<Description_x0020_1>CORE 2200 X 800 X 1500 X 600</Description_x0020_1>
<Description_x0020_2>CORE 2200 X 800 X 1500 X 600</Description_x0020_2>
<wood_x0020_options_x0020_1>1</wood_x0020_options_x0020_1>
<wood_x0020_options_x0020_2>2</wood_x0020_options_x0020_2>
<wood_x0020_options_x0020_3>3</wood_x0020_options_x0020_3>
<frozen_x0020_price>2030</frozen_x0020_price>
<Frozen_x0020_hours>1</Frozen_x0020_hours>
<Prepaired_x0020_for>GILLIAN</Prepaired_x0020_for>
<Percent_x0020_mark_x0020_up>2.5</Percent_x0020_mark_x0020_up>
<Price_x0020_list>false</Price_x0020_list>
</Products>
</Product_x0020_range>
As you can see, ProductRangeID and the ProductRange description are not specified as attributes, but instead as a values between 2 tags each.
The code I'm using in my XAML to bind these are as follows:
<HierarchicalDataTemplate DataType="Product_x0020_range" ItemsSource="{Binding XPath=*}">
<WrapPanel>
<TextBlock Text="{Binding Path=Name}"/>
</WrapPanel>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="Products" ItemsSource ="{Binding XPath=*}">
<WrapPanel>
<TextBlock Text="{Binding XPath=Name}"/>
</WrapPanel>
</HierarchicalDataTemplate>
This does not give me the output I want though. It lists all the Product Ranges in the treeview, but it displays Product_x0020_range as the header for the root treeview items, then when I expand this item, it then displays the actual ID and description of the product range e.g. 1, Specials.
How can I do my bindings so that "Specials" is displayed as the header for the root treeview items?
|
|
|
|
|
So what I'm asking is, how do I bind to the text contained within XML elements, instead of attributes?
|
|
|
|
|
Okay I got it working by setting the Binding of the TextBlock Text to "XPath=Product_x0020_Range". Now it displays the correct description. But when I expand this, it shows the description again within the expanded node. Any help here?
|
|
|
|
|
Hi,
I want to create a tree structure like there is a root element and the root contains left and right nodes,again these nodes contains right and left nodes likewise.Here I want this dynamically.How can insert the nodes,delete the nodes.Please help me in this issue.
Thanks
Denny
|
|
|
|
|
|
I extracted the element <wsu:expires>;2007-10-03T21:12:23Z</wsu:Expires>. I don't know how to encrypt this?
Output should be something like this.
<wsu:Timestamp >
<wsu:Created></wsu:Created>
<xenc:EncryptedData >
<xenc:EncryptionMethod />
<xenc:CipherData >
<xenc:CipherValue </xenc:CipherValue>
</xenc:CipherData>
</xenc:CipherData>
</xenc:EncryptedData>
</wsu:Timestamp>
modified on Thursday, June 4, 2009 3:07 AM
|
|
|
|
|
Hello
I am using client WSDL file, i want to generate proxy class from it.
I am using WSDL.exe to generate that proxy class.
But i am getting this error:
Unable to cast object of type 'System.Xml.XmlElement' to type 'System.Web.Services.Description.ServiceDescriptionFormatExtension'.
So, is there any perfect solution?
|
|
|
|
|
|
I have a problem I'm looking to solve with XSLT, but I'm a bit stumped at how to implement the syntax.
I basically have a XML file with a structure narrowed down to this:
<ITEM>
<NAMEVALUE>
<NAME>From1</NAME>
<VALUE>From1 Value</VALUE>
</NAMEVALUE>
<NAMEVALUE>
<NAME>From2</NAME>
<VALUE>From2 Value</VALUE>
</NAMEVALUE>
<NAMEVALUE>
<NAME>Price1</NAME>
<VALUE>Price1 Value</VALUE>
</NAMEVALUE>
<NAMEVALUE>
<NAME>Price2</NAME>
<VALUE>Price2 Value</VALUE>
</NAMEVALUE>
.
.
.
.
</ITEM>
(I can't change the format of the delivered file).
I would like to transform it into something equivalent to:
<Prices>
<Price from="From1 Value">Price1 Value</Price>
<Price from="From2 Value">Price2 Value</Price>
</Prices>
And I'm quite bugged down in it.
I can most likely fix it using scripts in my XML file and some temporary variables, but I was wondering if it would be possible to either use more pure XSL syntaxt to solve this problem.
|
|
|
|
|
Alsvha wrote: I was wondering if it would be possible to either use more pure XSL syntaxt to solve this problem.
I don't understand how "From1 Value" is related to "Price1 Value" in the XML source?
|
|
|
|
|
They're related due to the name From1 is connected to Price1 and From2 to Price2 and so forth.
It is an unfortunate format, but it is what I have to work with
|
|
|
|
|
Alsvha wrote: It is an unfortunate format
Yes. I can't help you exercise the demons from the people that created that XML nightmare, however Stuart has provided an example for you.
exercise exorcise
modified on Thursday, June 4, 2009 1:45 PM
|
|
|
|
|
The following works (i.e. I've tested it) in Microsoft XSLT - but it. It creates a key containing all 'Price' NAMEVALUE nodes, indexed on the text after 'Price' in the NAMEVALUE/NAME node. This is used in the 'From' NAMEVALUE node template, to establish the linkage between 'From' and 'Price' nodes.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="prices" match="/ITEM/NAMEVALUE[starts-with(NAME/text(), 'Price')]" use="substring-after(NAME/text(), 'Price')"/>
<xsl:template match="/">
<prices>
<xsl:apply-templates select="//NAMEVALUE"/>
</prices>
</xsl:template>
<xsl:template match="NAMEVALUE[starts-with(NAME/text(), 'From')]">
<Price from="{VALUE/text()}">
<xsl:value-of select="key('prices', substring-after(NAME/text(), 'From'))/VALUE"/>
</Price>
</xsl:template>
<xsl:template match="NAMEVALUE"/>
</xsl:stylesheet>
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Now that's some nice XSLT! Great example of using key, get's my 5.
|
|
|
|
|
Thank you so much - I'll try to take a look at it.
|
|
|
|
|
Hi, I'm a bit new to XML schemas and I've run into a scenario that I am unable to discover how to describe in an XML schema. I need to have a shema describe the following two document scenarios (Simplified from my real project)
<root>
<header>
header elements here
</header>
<detailedinfo>
detailed information here
</detailedinfo1>
</root>
<root>
<header>
header elements here
</header>
<differentinfo>
different detailed information here
</differentinfo>
</root>
I actually have several different types of detailed information that I need to be able to optionally have in the XML. I know that I can allow for the different information with a choice, but I can not discover how to get the header information into the schema.
One other thing, the hearer must be optional as well.
Thanks in advance!
|
|
|
|
|
Hi!
Let's say you have an xml file that you want to transform which also includes other XMLs, e.g. something like
<rootnode>
<info>Info<info>
<import file="other.xml"/>
</rootnode>
Is there a standard/easy way to read in and process (i.e. apply the same xsl rules to) the imported xml as well?
Thanks,
Agoston
|
|
|
|