|
I got it
var s = XDocument.Load("rect.xml");
var q = from x in s.Descendants()
select new { x };
XNamespace ns = "http://tempuri.org/svg11-flat-20030114";
foreach (var itm in q)
{
if (itm.x.Name == ns + "rect")
{
rect re = (rect)itm.x;
Console.WriteLine(itm.x.Name.ToString());
}
if (itm.x.Name == ns + "desc")
{
rect re = (rect)itm.x;
Console.WriteLine(itm.x.Name.ToString());
}
}
|
|
|
|
|
Hi,
I have an XML File that looks like this:
<cases>
<case>
<caseid>1-111222
<notes>
<note>
<notecreated>30/07/2006
<notecontent>Some Description here...
<note>
<notecreated>31/07/2006
<notecontent>Another Description here...
How can I loop through the abovementioned XML file and list all the NoteContents for the specific CaseId in a GridView? The Above XML has two notes related to the CaseId.
Many Thanks!!!!
Illegal Operation
|
|
|
|
|
This bloody website stripped my XML elements!! Please let me know if you want to see the elements then I will mail it to you seeing that Code project is becoming more like a Microsoft type operation!!
Illegal Operation
|
|
|
|
|
<?xml version="1.0"?>
<nodes>
<node id="001">information</node>
</nodes>
Did you have "Auto-encode HTML when pasting?" checked?
Also, your question seems to be more of a .NET question than a XML question.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi,
I've had people e-mail and open XML files (in Vista) and have them view/revert back to the original install file/data.
- Open XML file in Notepad, the data shown is the original install data.
- E-mail XML file, the data is reverted to original install data.
- Open same XML file in Internet Explorer, the file shows up-to-date data.
I run Vista and I don't have this problem. Can anyone shed some light on this issue?
thanks,
Ron
|
|
|
|
|
Ron, I guess you posted this here because the file happens to be XML. I can assure you that there is nothing specific to XML technology that would account for this. Moving on.
myNameIsRon wrote: revert back to the original install file/data.
- Open XML file in Notepad, the data shown is the original install data.
You provided no information that would enlighten us about this "install", so once again, that doesn't tell us anything useful. You also provided no information about how this "original" file has been modified so listing all the ways you open it and see the original data without providing any clue about how it is supposedly modified, wait for it, doesn't tell me anything useful.
Based on what you posted I can not eliminate the users as the problem in every one of your scenarios.
myNameIsRon wrote: - Open XML file in Notepad, the data shown is the original install data.
User opened the wrong file.
myNameIsRon wrote: E-mail XML file, the data is reverted to original install data.
User emailed the wrong file.
myNameIsRon wrote: Open same XML file in Internet Explorer, the file shows up-to-date data.
Same as what? That statement doesn't even have enough information to understand. If you meant the same XML file they emailed in the previous step, then the first point is still valid, they sent the wrong file.
led mike
|
|
|
|
|
HI Friends,
I have a requirement to combine two xml files having different schemas to produce one xml file .Plz find the xml structures below:
The input XML is in the form
<EMPLOYEE>
<EMPFNAME>ANIL</EMPFNAME>
<EMPLNAME>JOSHI</EMPLNAME>
<EMPCODE>213</EMPCODE>
<MANAGEREMPCODE>211</MANAGEREMPCODE>
<SALARY>5000</SALARY>
<DEPT>FINANCE</DEPT>
</EMPLOYEE>
Assume that for each Employee in the company there is a XML of the structure above lying in a source folder.We have to read all the XMLs and create a single XML of the structure as below.
<COMPANY>
<DEPT NAME='FINANCE'>
<MANAGER>AJIT MAHUT</MANAGER>
<EMPLOYEE>ANIL JOSHI</EMPLOYEE
<EMPLOYEE>SRIKANTH SINGH</EMPLOYEE>
<EMPLOYEE>KAMAL ADNAN/EMPLOYEE
</DEPT>
<DEPT NAME='MIS'>
<MANAGER>SAM PITRODA</MANAGER>
<EMPLOYEE>ANIL KAPOOR</EMPLOYEE>
<EMPLOYEE>MANGAL PANDEY</EMPLOYEE>
<EMPLOYEE>R MADHAVAN</EMPLOYEE>
</DEPT>
</COMPANY>
How will I do this? How can we do this using ADO.net ?
Plz direct me.
Regards
A Sunil
|
|
|
|
|
Hi all!
I have created an XLS file but I am confused over a particular part of the language syntax.
If I want to sort by an element attribute I can do the following (and it works):
<xsl:sort-by select="@columnName" order="ascending" data-type="text" /> I want to add a paramater which allows me to input which column is to be sorted by. So I tried the following:
<xsl:param name="sortColumn" />
<!-- Other XSL stuff goes here... -->
<xsl:sort-by select="$sortColumn" order="ascending" data-type="text" /> But this did not work, so I tried the following which also did not work:
<xsl:param name="sortColumn" />
<!-- Other XSL stuff goes here... -->
<xsl:sort-by select="@$sortColumn" order="ascending" data-type="text" /> Could someone please advise me on how to do this?
To offer some clarity the input XML documents are structured as follows:
<root>
<entry columnA="value1" columnB="value2" columnC="value3" />
<entry columnA="value4" columnB="value5" columnC="value6" />
<entry columnA="value7" columnB="value8" columnC="value9" />
</root>
Many thanks!
Lea Hayes
modified on Sunday, August 3, 2008 9:30 PM
|
|
|
|
|
Hi all,
I have finally worked out how to achieve what I need. For those interested the syntax to get the value of an attribute by paramater is:
@*[name() = $sortBy] where $sortBy is the name of the paramater.
Hope this is of use to someone!
Lea Hayes
|
|
|
|
|
I've a xml file which contains some spaces that i need to display in html when transform using xsl
sample xml file
<root>
<child name="The quick brown fox jump over the lazy dog"/>
</root>
As you see in the above sample xml, it contains lots of spaces that i need to display same in html. how do i do that?
The issue is in html it render as
The quick brown fox jump over the lazy dog.
instead of
The quick brown fox jump over the lazy dog.
Is there any way by which modifying the xsl gives me the same result. Any help is highly appreciated.
|
|
|
|
|
Replace each space with ?
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Assume that i cannot modify xml file. How to replace spaces with & nbsp; in xsl..
any function? please give me an xsl example...
Thanks in advance.
|
|
|
|
|
As Perspx said. You may be able to do it with the translate function, I haven't tried it.
Otherwise, maybe you could perhaps insert pre or div tags around the text.
|
|
|
|
|
Hi,
This is the first time I've used XSL and I have got some of what I want, but I cannot get it to do everything I need, and I am not sure how good the XSL I have created is performance wise.
I need the XSL to first sort records in the reverse order to what they are stored in the XML file. Then I need to select from a particular record to another. Here is the XSL I have created, but as soon as I added the pagination part it stopped giving output.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="fromRecord" select="0" />
<xsl:variable name="toRecord" select="2" />
<xsl:template match="node() |@*">
<xsl:copy>
<xsl:apply-templates select="node() |@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="log">
<xsl:for-each select="row[position() >= number($fromRecord) and position() <= number($toRecord)]" >
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates>
<xsl:sort select="position()" order="descending" data-type="number"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Any help would be fantastic!
Lea Hayes
|
|
|
|
|
Hi again,
I have finally come up with the following which appears to do what I need. Is this the most efficient way of doing this? Or is there a simpler or more generic way?
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="no"/>
<xsl:strip-space elements="*"/>
<xsl:param name="fromRecord" />
<xsl:param name="toRecord" />
<xsl:template match="/">
<log>
<xsl:for-each select="log/entry">
<xsl:sort select="position()" order="descending" data-type="number"/>
<xsl:if test="position() >= number($fromRecord) and position() <= number($toRecord)">
<entry>
<xsl:attribute name="type">
<xsl:value-of select="@type"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="@title"/>
</xsl:attribute>
<xsl:attribute name="message">
<xsl:value-of select="@message"/>
</xsl:attribute>
<xsl:attribute name="logged">
<xsl:value-of select="@logged"/>
</xsl:attribute>
</entry>
</xsl:if>
</xsl:for-each>
</log>
</xsl:template>
</xsl:stylesheet>
Many thanks,
Lea Hayes
|
|
|
|
|
lhayes00 wrote: Is this the most efficient way of doing this?
Might be given the nature of the XML you appear to be working with. A more standard approach might be to have specific information in the XML rather than using Position() that you can query and possible sort against. That solution might be more standard and could perform better as well.
led mike
|
|
|
|
|
I downloaded the SVG schema from w3c website but when i applied the command
xsd SVg.xsd /t:lib /l:cs /c
I got the error. What is wrong ?
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.1432]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: If ref is present, all of 'simpleType', 'form', 'type
', and 'use' must be absent. Line 344, position 6.
Schema validation warning: If ref is present, all of 'simpleType', 'form', 'type
', and 'use' must be absent. Line 845, position 6.
Schema validation warning: If ref is present, all of 'simpleType', 'form', 'type
', and 'use' must be absent. Line 1878, position 6.
Warning: Schema could not be validated. Class generation may fail or may produce
incorrect results.
Error: Error generating classes for schema 'SVG'.
- Schema with targetNamespace='http://www.w3.org/2000/svg' has invalid syntax.
If ref is present, all of 'simpleType', 'form', 'type', and 'use' must be absen
t. Line 344, position 6.
- If ref is present, all of 'simpleType', 'form', 'type', and 'use' must be ab
sent.
If you would like more help, please type "xsd /?".
|
|
|
|
|
I need some assistance,
I have an XML file with records that I need to display on a Gridview. This XML file must only display records relevant to a user's Username and Password, in other words if Administrator logs in than only Administrator records can be seen.
Can someone please assist or just point me in the direction as to where I might find helpful information about this scenario?
Thank you!!
Illegal Operation
|
|
|
|
|
Would it not be easier to use some form of database?
Regards,
--Perspx
"The Blue Screen of Death, also known as The Blue Screen of Doom, the "Blue Screen of Fun", "Phatul Exception: The WRECKening" and "Windows Vista", is a multi award-winning game first developed in 1995 by Microsoft" - Uncyclopedia
|
|
|
|
|
Hi, I'm looking to convert my visual studio (version 8) .vcproj file ( xml v1.0 ), in a way that I can exclude .cpp files from the build and add .cpp files to the build.
As I understand it XSLT should be a neat way of doing this, but being an XML newbie I wanted to ask some basic questions first.
- 1) Any good code C# / C++ or whatever projects or whatever of parsing the .VCPROJ XML format?
- 2) Alternatively can XSLT do this easily?
- 3) Can I get XSLT to spit out what it finds without me having to describe the format of the .vcproj file? You see I don't really care about it's format, I just know I want certain .cpp files excluded from building, and some .cpp files added and have the rest of the file be replicated as it was.
- 4) If 3) can work, is it easy enough to have the XSLT have an exclusion list, i.e. .cpp files I want to leave alone.
- 5) What is the best way of doing this if not using XSLT?
NB. this is for automating a 'unity build' which removes .cpp files form the build in favour of master .cpp files that actually #include the .cpp files!
Thanks in advance,
Tortoise.
|
|
|
|
|
writing it as we speak in C#, chosen NOT to use XSLT since I need to spit out the '#include file.cpp' to a .cpp, as well as write a new .vcProj... but maybe there is a way with xslt transformations.
|
|
|
|
|
|
Unity build..
1) In visual studio exclude all you .cpp from the build.
2) #include all your .cpp files into a new .cpp file and add this .cpp to the build.
3) Compile, link ( note the speed difference ).
|
|
|
|
|
Thanks I now found a reference to it on this blog[^] (another blog using a horrible font what's up with that? )
CodeTortoise wrote: since I need to spit out the '#include file.cpp' to a .cpp, as well as write a new .vcProj
I don't believe it will do that but you could just have two XSLT's, one for each output file and run them both. The answer to all the rest of your can XSLT do this and that is yes. You can create just about any Text output using XSLT. That said, since UB is a development activity rather than a production build activity writing your C# utility to do this seems a perfectly fine choice.
led mike
|
|
|
|
|
create callery by use C# and xml and flash
|
|
|
|