|
Hi,
I have the following sample Data.xml
<Company>
<Department>
<dept>Sales</dept>
<dept>Tech</dept>
</Department>
<Branches>
<Location>US</Location>
<Location>IND</Location>
</Branches>
</Company>
I want to add a new node say <dept>HR</dept>
in the Department Section.
Please help me,how we can do this using C#.
|
|
|
|
|
|
Hai
How to write a xsd for the XML like as followa
<xdm:name>
<xdm:firstname>xxxxx</xdm:firstname>
<xdm:middlename>yyy</xdm:middlename> <xdm:lastname>hhhhh</xdm:lastname>
</xdm:name>
xml node name have ful colon
Please help me
Thanks & regards
vicky0000000
|
|
|
|
|
I'd like to use XSLT stylesheets to transform XML data rendered by Reporting Services. Reporting Services handled the stylesheets alright till I tried to import some external templates into the stylesheets. The error message was 'Cannot load XSLT specified at file name. Resolving of external URIs was prohibited.'.
Does anyone know how to make Reporting Services load the external XSLT templates without error?
Many thanks
|
|
|
|
|
Hello,
I was trying to load data from xml files to SQL Server tables.
I am using XMLTextReader to read from the files. my code's working and loading information to two tables. Except, few fields.
They show no values when read - even though the file contains values for them.
I notice all of them are either unsignedByte or unsignedInt type in the xml schema.
I changed them to strings just to test, but it's doing the same.
I think the datatype is not making any difference, but these elements don't have any attributes and the values are directly in the tags.
So, could be I'm missing something. Here's part of my code:
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
if (reader.Name.ToLower().Equals("decimals"))
{
dec = reader.Value;
}
.....
break;
case XmlNodeType.Text:
...nothing
break;
case XmlNodeType.EndElement:
break;
}
}
Any idea, what's wrong?
Thanks.
modified on Monday, August 11, 2008 4:42 PM
|
|
|
|
|
Respected Members,
I am in final year of engineering. We are suppose to create a project this year. I gave it a lot of thought but am short of ideas. Can anyone please help me out. Topics like Smart building, Mobile Messenger, and couple of other were rejected by my professor. The project should be big and should be completed within 7-8 months. Technology i am interested in is Java, .Net, XML and then others. Please help me.
Thank you.
kashyap
|
|
|
|
|
I am using LINQ To XSD to parse through an SVG XML file.
var s = svg.Load("rect.xml");
In order to select all rect objects i do
var q = from x in s.rect
select new { x };
In order to select all circle objects i do
var q = from x in s.circle
select new { x };
Can you tell me a query which would give me both rect and circle objects simultaneously.
Thanks in Advance
|
|
|
|
|
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
|
|
|
|