|
Thank you, I had tried that, but it didn't seem to work.
I ended up doing this:
string root = "\\Program Files\\SmartDeviceApplication1\\";<br />
DataRowView drv = (DataRowView)ca_id.SelectedItem;<br />
<br />
ca_bildurl.Image = new Bitmap(System.IO.Path.Combine(root,drv.Row["im"].ToString()));
I now have another problem - the SelectedItem doesn't seem to work, but at least the first image is being shown. Thanks for your reply, though!
|
|
|
|
|
Hai,
I have grouped the paragraph styles of same type using the following method.
<!-- match paragraph nodes that are part of a Bullet list -->
<xsl:template match="w:p" mode="insideBulletList">
<!-- output this bullet item paragraph -->
<li><xsl:apply-templates /></li>
<!--go to next one-->
<xsl:apply-templates
select="following-sibling::*[1][self::w:p/w:pPr/w:pStyle[@w:val='BulletList']]"
mode="insideBulletList" />
</xsl:template>
My Wordml contains the following paragraph styles
w:p[w:pPr/w:pStyle[@w:val="para1"]
w:p[w:pPr/w:pStyle[@w:val="para2"]
w:p[w:pPr/w:pStyle[@w:val="para3"]
I want to group the above 3 different styles under one parent node like
<newnode>
<para1>38293</para1>
<para2>sdjfkj</para2>
<para3>eiruwio</para3>
</newnode>
I brought the above output using <xsl:for-each select="*" group-starting-with=""> method. But I want the above output using <xsl:template match> method so that it will maintain the position.
anybody help me!!!!!!!!!
|
|
|
|
|
Input XML:
---------
<artbody>
<section id="s1">
<heading1 level="1">INTRODUCTION</heading1>
<para>xxx <b>xxx</b> xxxxxxxxxxxxxxxxxxx</para>
<subsect id="s1-1">
<heading2 level="2">Linkends</heading2>
<para>This paragraph contains fixed figure <fx1>, <fx2>, <fx3>.</para>
<para>This paragraph contains linkend type for Bibliography (numbered) (type=bib): [<link type="bib" linkend="">3</link>], [<link type="bib" linkend="">4, 7</link>], [<link type="bib" linkend="">7–12</link>], [<link type="bib" linkend="">14-18</link>], [<link type="bib" linkend="">3, 5, 7–12</link>] and [<link type="bib" linkend="">6, 8, 15-17</link>].</para></subsect1>
<subsect1 id="s1-5-1">
<heading3 level="3">Question and Answer</heading3>
<quest>What's you name?</quest>
<answer>Pradeep</answer>
<quest>How old are you?</quest>
<answer>62</answer>
<quest>So, what are you doing now?</quest>
<answer>Just chatting with an idiot</answer> </subsect>
</subsect>
<subsect1 id="s1-5-1">
<heading3 level="3">poem</heading3>
<stanza></b>What's you name?<b></stanza>
<stanza></b>Pradeep<b></stanza>
</subsect>
<para>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</para>
<para>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</para>
</section>
</artbody>
Style Sheet:
-----------
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml"
xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint"
xmlns ="urn:schemas-microsoft-com:office:office"
exclude-result-prefixes="aml w wx o v">
<xsl:output method="xml"
indent="yes"
omit-xml-declaration="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="*">
<xsl:choose>
<xsl:when test="artbody">
<xsl:copy>
<xsl:for-each-group select="child::node()" group-adjacent="self::quest or self::answer">
<xsl:choose>
<xsl:when test="current-grouping-key()">
<b> <quanta></b>
<xsl:apply-templates select="current-group()"/>
</quanta>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="current-group()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each-group>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Questions:
---------
1. I would like to group 'quest' & 'answer' under 'qanda'
2. I would like to group 'stanza' under 'poem'
I want to read each element dynamically and should group the orphan nodes such as quest & stanza under another parent element. But, with your suggestion, I could group one at a time. I couldn't do it in a loop. When I tried, I am getting duplicate of orphan nodes and all the attribute values are discarded.
If you could help us to design a xslt that groups "quest & answer" and "stanza" dynamically and retains all other elements untouched.
I sincerely appreciate your help in this regard.
Thanks & Regards,
-Rocxy
|
|
|
|
|
Sorry, very stupid question, but.... how do I specify paths in XML?
In other words, I want to specify a "root directory" for image files.
Thanks!
|
|
|
|
|
Could you use something like the base tag in XHTML?
|
|
|
|
|
Hi Friends,
In my application I am using XML as database and my application is web based applicaton.
I want the user to be able to export data in xml file to a excel sheet.
I tried with various codes and samples but no one worked.
If any one have some thing ragarding this problem plz let me know.
Thank u all in advance.
Chetan Ranpariya.
|
|
|
|
|
I have the following XML
-----------------------------------
<fname>aaaaa</fname>
<surname>xxxx</surname>
<fname>bbbbb</fname>
<surname>yyyyy</surname>
<fname>ccccc</fname>
<surname>zzzzz</surname>
-----------------------------------
I want the following output
-----------------------------------
<authorgrp>
<author>
<fname>aaaaa</fname>
<surname>xxxx</surname>
</author>
<author>
<fname>bbbbb</fname>
<surname>yyyyy</surname>
</author>
<author>
<fname>bbbbb</fname>
<surname>yyyyy</surname>
</author>
</authorgrp>
------------------------------
Anyone can help??????????????????
-- modified at 1:59 Thursday 29th December, 2005
|
|
|
|
|
Try this...
<xsl:template match="/">
<authorgrp>
<xsl:for-each select="fname">
<author>
<fname><xsl:value-of select="."/></fname>
<surname><xsl:value-of select="../surname[position()]"/></surname>
</author>
</xsl:for-each>
</authorgrp>
</xsl:template> I haven't tested it, but it should get you close.
Michael Flanakin
Web Log
-- modified at 9:55 Thursday 29th December, 2005
|
|
|
|
|
I want to store an xml file in sqlserver using asp
xml file should be used as an input paramenter for a stored procedure
suneel
|
|
|
|
|
I want function in one namespace to create instance of class defined in
another namespace.
(more detailed - I try to make independent "Seralizer" dll, to be used
by different application, each calling it from its own class which
defines the application configuration)
I failed to make it work.
Notify that in the Seralizer source I dont know the definition of the
class I get.
Foe example, how do I make lines like below working?
public void Deserialize(Type cfgType)
{
myType obj = Activator.CreateInstance(cfgType);
XmlSerializer serializer = new XmlSerializer( cfgType);
FileStream stream = new FileStream("some file...", FileMode.Open,
FileAccess.Read);
cfgType configuration = (cfgType)serializer.Deserialize(stream);
}
thanks
Michael Lev (mlev)
|
|
|
|
|
hello
I am making DOm msxml parser .
My current compiler in visual C++ 6
but it crashes while loading xml file in loadxml() method.
if any one know how to overcome this error kindly help me ?:->
mast
|
|
|
|
|
How can i get the value in an xml file when i specify the name in the xml file..Please provide me the code to do this in C#.NET..
Thanks..
|
|
|
|
|
I'm studying computer science and I'm in 400 level. I have a project to be submitted in 3month time and I should get the review and some of the designs ready for January. My project is to design a Software Like you cvtmovie but this time around it would convert any movie compres it and probably keep it in an archive untill its demanded for. This should aid the applications of large video user to be able to keep voluminuous video. I can cope with any prog language if i understand the problem being defined. I need to start from somewhere but I dont know how.
God Bless
|
|
|
|
|
I have an xml file which contains schedules for all employees. How do I extract data from this file for a specific employee? Below is a snippet of the code, but this loads all employees.
DataSet allSchedulesDs = new DataSet();
// get schedules
allSchedulesDs.ReadXml(myFilepath + "AllSchedules.xml");
scheduleCount = allSchedulesDs.Tables["ALLSCHEDULES"].Rows.Count - 1;
for (int j = 0; j <= scheduleCount; j++)
{
// check all xml file for badge number input
if ((string)allSchedulesDs.Tables["ALLSCHEDULES"].Rows[j][0] == textBoxBadgeId.Text.PadLeft(5, '0'))
// record found set up for display
{
// this gets all schedules need to limit display to just this badge number
scheduleList.DataSource = allSchedulesDs.Tables["ALLSCHEDULES"].DefaultView;
scheduleList.DataBind();
}
}
|
|
|
|
|
Hi everyone,
I first would like to warn you that I'm a newbie programmer. So if I have left out important code for you guys to determine what I'm doing wrong, let me know.
I am making a PocketPC application using C# and an XML file as a database. I would like to display the corresponding JPG image in a PictureBox, or somewhere on the main page.
A sample of my xml file. The bolded line is the picture reference.
<fragenkatalog><br />
<ca_id>4</ca_id><br />
<ca_titel>head ap</ca_titel><br />
<ca_bildurl1>kopf_ap.jpg</ca_bildurl1><br />
<ca_disabled>0</ca_disabled><br />
<ca_alter>999</ca_alter><br />
<ca_sex>n</ca_sex><br />
</fragenkatalog>
This is what I have, which doesn't work.
<br />
ca_bildurl.DataBindings.Add("Image",dt,"ca_bildurl1");
The ID is chosen from a ListBox, and the corresponding data is displayed on the screen.
Any help would be appreciated! Thanks!
M.
-- modified at 21:09 Friday 30th December, 2005
|
|
|
|
|
Please repost your XML with < and > instead of the < and > symbols.
Michael Flanakin
Web Log
|
|
|
|
|
Ok, it's changed. Sorry about that.
|
|
|
|
|
Trouble using sql:relation/sql:relationship in xsd file ...
Hi ...
I am attempting to use the sql:relation annotation and am having some troubles. I have used it successfull with the MS Sample (Customer / Order) where all the data is contained in elements (example below).
<code><ROOT>
<Customers>
<CustomerID>1111</CustomerID>
<SynchID>700</SynchID>
<CompanyName>Sean Chai</CompanyName>
<City>NY</City>
<Order OrderID="1" />
<Order OrderID="2" />
</Customers>
</ROOT>
In the xml that I am having trouble with the data is contained in attributes. In the code below I get the following
error when executing the bulk insert.
Any comments ?
Thanks !!
Chris
//////////////////////////////////////////////////////////////////////////
// error message
<?xml version="1.0"?><Result State="FAILED"><Error><HResult>0x80004005</HResult><Description><![CDATA[Schema: the parent/child table of the relationship on 'surface' does not match.]]></Description><Source>Schema mapping</Source><Type>FATAL</Type></Error></Result>
//////////////////////////////////////////////////////////////////////////
// xsd file
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
<xsd:annotation>
<xsd:appinfo>
<sql:relationship name="MacgowanTest_Atmospheric_Surface"
parent="MacgowanTestRWISRawAtmospheric"
parent-key="SystemId RpuId"
child="MacgowanTestRWISRawSurface"
child-key="SystemId RpuId" />
</xsd:appinfo>
</xsd:annotation>
<xsd:element name="site" sql:relation="MacgowanTestRWISRawAtmospheric" >
<xsd:complexType>
<xsd:sequence>
<xsd:element name="sensors" sql:relation="MacgowanTestRWISRawSurface"
sql:relationship="MacgowanTest_Atmospheric_Surface">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="surface" sql:relation="MacgowanTestRWISRawSurface"
sql:relationship="MacgowanTest_Atmospheric_Surface" >
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string" sql:field="SensorId"/>
<xsd:attribute name="datetime" type="xsd:date" sql:field="ObsDateTime" />
<xsd:attribute name="surfacecondition" type="xsd:string" sql:field="SurfaceCondition"/>
<xsd:attribute name="surfacetemp" type="xsd:string" sql:field="SurfaceTemperature"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="sysid" type="xsd:string" sql:field="SystemId"/>
<xsd:attribute name="rpuid" type="xsd:string" sql:field="RpuId"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>
//////////////////////////////////////////////////////////////////////////
// xml data file
<?xml version="1.0"?>
<odot_rwis_site_info>
<site id="200000" number="1" sysid="200" rpuid="0" name="1-SR127 @ SR249" longitude="-84.554946" latitude="41.383527">
<atmospheric datetime="12/05/2005 03:48:00 PM" airtemp="-490" dewpoint="-800" relativehumidity="73" windspeedavg="11" windspeedgust="19" winddirectionavg="265" winddirectiongust="295" pressure="65535" precipitationintensity="None" precipitationtype="None" precipitationrate="0" precipitationaccumulation="-1" visibility="2000" />
<sensors>
<surface id="0" datetime="12/05/2005 03:48:00 PM" name="North Bound Driving Lane" surfacecondition="Dry" surfacetemp="1900" freezingtemp="32767" chemicalfactor="255" chemicalpercent="255" depth="32767" icepercent="255" subsurfacetemp="450" waterlevel="0">
<traffic datetime="12/05/2005 03:48:00 PM" occupancy="0" avgspeed="82" volume="21" sftemp="1900" sfstate="255">
<normalbins>
<bin datetime="12/05/2005 03:48:00 PM" binnumber="0" bincount="7" />
<bin datetime="12/05/2005 03:48:00 PM" binnumber="1" bincount="0" />
</normalbins>
<longbins>
<bin datetime="12/05/2005 03:48:00 PM" binnumber="2" bincount="0" />
<bin datetime="12/05/2005 03:48:00 PM" binnumber="3" bincount="0" />
<bin datetime="12/05/2005 03:48:00 PM" binnumber="4" bincount="1" />
<bin datetime="12/05/2005 03:48:00 PM" binnumber="5" bincount="0" />
</longbins>
</traffic>
</surface>
<surface id="1" datetime="12/05/2005 03:48:00 PM" name="Bridge Deck Simulator" surfacecondition="Other" surfacetemp="-60" freezingtemp="32767" chemicalfactor="255" chemicalpercent="255" depth="32767" icepercent="255" subsurfacetemp="-999999" waterlevel="0" />
</sensors>
</site>
<site id="200001" number="2" sysid="200" rpuid="1" name="2-Hardin County Garage" longitude="-83.6148588" latitude="40.6305358">
<atmospheric datetime="12/05/2005 03:49:00 PM" airtemp="-590" dewpoint="-900" relativehumidity="75" windspeedavg="9" windspeedgust="22" winddirectionavg="303" winddirectiongust="299" pressure="65535" precipitationintensity="None" precipitationtype="None" precipitationrate="0" precipitationaccumulation="-1" visibility="2000" />
<sensors>
<surface id="0" datetime="12/05/2005 03:49:00 PM" name="Bridge Deck Simulator" surfacecondition="Other" surfacetemp="-410" freezingtemp="32767" chemicalfactor="255" chemicalpercent="255" depth="32767" icepercent="255" subsurfacetemp="300" waterlevel="0" />
</sensors>
</site>
</odot_rwis_site_info></code>
|
|
|
|
|
I am not too hot on XML etc, and would appreciate a little help.
I have a large XML document and would like to know if it is possible to find a node within the document that has a specific value, (not attribute), with the .SelectNode( ... ) function? All that I have read so far leads me to believe that I will have to loop through the document searching for a node with a specific value rather than being able to home in on it with a clever XPath expression!
|
|
|
|
|
If you have
<doc>
<node>1</node>
<node>2</node>
</doc>
then the XPath expression node[text()='1'] should select the node with text contents of '1' (i.e. the first node in that document)
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
That's not completely true. You'll have to already be in the doc element, for that to work. If you're not already traversing thru the XML, you'll need to specify the absolute path to a property you want. You can do this by typing /doc/node . That will give you the value within the node element. If you have attributes, they need to be preceded with the at (@) symbol.
http://www.w3schools.com/xpath/default.asp[^]
Michael Flanakin
Web Log
|
|
|
|
|
Hi
I have lot of config data in a table which I want to put in .config file.
Is there any tool using which I can save the data into customized xml file?
Please advice. Thanks
Pankaj
|
|
|
|
|
May be you should place your data in a table and use the forXML T-SQl extension.
This can be done on MS SQL and SQL Anywhere.
The other option is to put it ina Access tbale and export in XML format.
|
|
|
|
|
I'm fairly new to XML and I'm just wondering if there is any difference between using elements or attributes to store data in an XML file. From a programatic view is is better to use one or the other for having to read in the file and such? Are there any performance differences? Is one more flexible than the other?
Any information on the topic is very appreciated.
- Aaron
|
|
|
|
|
There are no rules about when to use attributes, and when to use child elements. My experience is that attributes are handy in HTML, but in XML you should try to avoid them. Use child elements if the information feels like data.
Some of the problems with using attributes are:
.attributes cannot contain multiple values (child elements can)
.attributes are not easily expandable (for future changes)
.attributes cannot describe structures (child elements can)
.attributes are more difficult to manipulate by program code
.attribute values are not easy to test against a Document Type
.If you use attributes as containers for data, you end up with documents that are difficult to read and maintain.
Try to use elements to describe data. Use attributes only to provide information that is not relevant to the data.
Sushant Mathur
Ocwen Financial Sol. Pvt. Ltd,
Bangalore,
INDIA.
-- modified at 3:17 Wednesday 14th December, 2005
|
|
|
|