|
|
Could you post as sample of the xml you are parsing and a snippit of the code you are having trouble with? I need this info to give you a more specific answer.
|
|
|
|
|
If you are trying to serialize an XmlNodelist or an XmlNode, I believe you cannot do this. You must create your own Serializable Object to hole your node data and store it in a serializable collection. Then you can pass the collection to or from your web service.
|
|
|
|
|
yeh i got the ans. i was trying to serialize Xmlnodelist but this cant b done cuz dsnt hav thatAdd method or somthin
thanks
|
|
|
|
|
i m calling a web method through ma client which returns a xmlnodelist but it is not working and returns the following error
To be XML serializable, types which inherit from IEnumerable must have an implementation of Add(System.Object) at all levels of their inheritance hierarchy. System.Xml.XmlNodeList does not implement Add(System.Object).
i cant understand where does this error leads to???
Warm Regards
Bia
|
|
|
|
|
This is not a XML/XSL question. Try one of the .NET forums (VB.NET, C#, .NET Framework)
led mike
|
|
|
|
|
It says you CANNOT serialize a XmlNodeList!
|
|
|
|
|
Hello,
I created a XSL file to convert a XML file to another XML.
I am running this in Asp.Net but this is not working.
----- ORIGINAL XML -----
<?xml version="1.0" encoding="utf-8" ?>
<siteMap
xmlns="http://schemas.microsoft.com/ASPNet/SiteMap-File-1.0" >
<siteMapNode>
<siteMapNode
url="~/Contacts.aspx"
title="Contacts"
description="Contacts Description"
changefreq="daily"
lastmod="2006-11-01T20:25:42+01:00"
priority="0.4"
google="true" />
<siteMapNode
url="~/Message.aspx"
title="Message"
description="Message Description"
changefreq="daily"
lastmod="2006-11-01T20:25:42+01:00"
priority="0.2"
google="false" />
</siteMapNode>
</siteMap>
----- What XML result should be (Domain Parameter =
"http://www.domain.com") -----
<?xml version="1.0" encoding="UTF-8"?>
< urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
< url>
< loc>http://www.mydomain.com/Contacts.aspx</loc>
< changefreq>daily</changefreq>
< lastmod>2006-11-01T20:25:42+01:00</lastmod>
< priority>0.4</priority>
</url>
</urlset>
----- XSL -----
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:dk="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8"
indent="yes"/>
<xsl:param name="Domain"/>
<xsl:template match="dk:*"/>
<xsl:template match="@*|text()|comment()"/>
<xsl:template match="/">
<xsl:element name="urlset">
<xsl:apply-templates select="//dk:siteMapNode[@google='true']"/>
</xsl:element>
</xsl:template>
<xsl:template match="dk:siteMapNode">
<xsl:element name="url">
<xsl:element name="loc">
<xsl:value-of select="$Domain" />
<xsl:value-of select="substring(@url, 3)"/>
</xsl:element>
<xsl:element name="lastmod">
<xsl:value-of select="@lastmod"/>
</xsl:element>
<xsl:element name="changefreq">
<xsl:value-of select="@changefreq"/>
</xsl:element>
<xsl:element name="priority">
<xsl:value-of select="@priority"/>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Could someone, please, tell me why is this not working?
And is there a software or web site where I can test a XSL conversion?
Thanks,
Miguel
|
|
|
|
|
Your schemas did not match:
Original XML: xmlns="http://schemas.microsoft.com/ASPNet/SiteMap-File-1.0"
XSLT: xmlns:dk="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"
Notice ASPNet <> AspNet!
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:dk="http://schemas.microsoft.com/ASPNet/SiteMap-File-1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:param name="Domain" select="'http://www.mydomain.com/'"/>
<xsl:template match="/dk:siteMap">
<xsl:element name="urlset">
<xsl:apply-templates select="dk:siteMapNode/dk:siteMapNode[@google='true']"/>
</xsl:element>
</xsl:template>
<xsl:template match="dk:siteMapNode">
<xsl:element name="url">
<xsl:element name="loc">
<xsl:value-of select="$Domain" />
<xsl:value-of select="substring(@url, 3)"/>
</xsl:element>
<xsl:element name="lastmod">
<xsl:value-of select="@lastmod"/>
</xsl:element>
<xsl:element name="changefreq">
<xsl:value-of select="@changefreq"/>
</xsl:element>
<xsl:element name="priority">
<xsl:value-of select="@priority"/>
</xsl:element>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
|
|
|
|
|
ok, so correct me if wrong, but a properly formatted XML file does not care about the order of its elements, correct?
<element1-name>John</element1-name><br />
<element2-country>US</element2-country>
would be parsed the same if it were listed as
<element2-country>US</element2-country><br />
<element1-name>John</element1-name>
This 2nd question regarding schema. If I had a .XSD schema file that I wanted to reference, is the following "header" in my .XML file correct?
<br />
<?xml version="1.0" encoding="UTF-8" ?><br />
<br />
< PointOfContact xmlns:xsd="http://www.w3.org/2001/XMLSchema" <br />
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br />
xsi:noNamespaceSchemaLocation="PointOfContact.xsd"><br />
How do I make the location "relative" (with the dot dots..)?
Thanks!
|
|
|
|
|
http://www.w3schools.com/
They've got alot of XML tutorials. Go through them
ASBESTOS-Greetings
LiquidE
|
|
|
|
|
Hi i have the following code in my xml...
<LogoPath>C:\Reports\GR_Logo.jpg</LogoPath>
How do i call this in the <img src=????/>
Thank you in advance.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
You can take value of LogoPath tag in a xsl:variable and then assign that varible to src attribute of img tag like
|
|
|
|
|
Thanks, that worked like a charm. but i didn't use it exactly like you did. I only said... <img src="{LogoPath}"/>
This used the tag caled LogoPath.
Would you by any chance know how to embed this image into the html? Say i send this html that gets generated to someone else, and that person doesn't have the image in the path specified...
Thank you for your time.
Nico
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
You can use XSLT to create HTML page of your XML data
and image should be there..means path you have specified...same like in HTML we have imgae in the source location... hope i have replied answer of your question correctly
|
|
|
|
|
Yes thank you, i understand what you mean. I can display the picture, but if i want to send the html (that was generated by the xml and xsl) i need to send the image along with it otherwise it won't display. How do i embed an image so that the image is part of the html in the end?
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
I have a XSchema document and an instance document. Validation of the instance document against the Schema works fine.
My problem is that I'm unable to select nodes from the xml-document. Namespace delarations are shown below.
For instance
XmlNodeList nodeList = xmlDoc.DocumentElement.Select("//Command")
returns 0 nodes.
Xml header:
<?xml version="1.0" ?>
<Commands xmlns="http://nn.taurus.dk/NN"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://nn.taurus.dk/NN">
... rest of xml-document
Schema header:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://nn.taurus.dk/NN"
targetNamespace="http://nn.taurus.dk/NN"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
... rest of XSchema-document
Can anybody tell me what is wrong with either namespace declarations or my select-statement ?
If I remove most of the namespace stuff and only that, the statement
XmlNodeList nodeList = xmlDoc.DocumentElement.Select("//Command")
returns the expected result.
Headers from the files where the Select statement works, are shown below.
Xml header
<?xml version="1.0" ?>
<Commands xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Customer.xsd">
Schema header:
<?xml version="1.0" encoding="utf-8"?>
< xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
|
|
|
|
I think the problem is that the Command elements are inside the "http://nn.taurus.dk/NN" namespace (declared as default on the Commands element) but this doesn't reflect in the XPath expression.
Try using an Select overload which takes a XmlNamespaceManager . Pass an instance with registered pair "someprefixname" and "http://nn.taurus.dk/NN" and change the XPAth expression to "//someprefixname:Commands".
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
hi,
I am new in ASP.NET , i heard about "diffgram" i have very small information about diffgram(used to get data from the DataSet).
Is anybody tell me some more detail about diffgram and their effective use with small example(if possible).
Thanks,
honey.
|
|
|
|
|
A DiffGram is an XML format that is used to identify current and original versions of data elements. The DataSet uses the DiffGram format to load and persist its contents, and to serialize its contents for transport across a network connection. When a DataSet is written as a DiffGram, it populates the DiffGram with all the necessary information to accurately recreate the contents, though not the schema, of the DataSet, including column values from both the Original and Current row versions, row error information, and row order.
Reference Link: http://www.techinterviews.com/?p=78[^]
|
|
|
|
|
Hi all,
what is the code snippet for getting the image path on the xml to be able to display it on the html but it needs to be embedded into the html file.
"Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
|
|
|
|
|
Hi i have xml file stored in the database and I want to deserialize the xml file from database and want to retrieve the all nodes and child nodes of the xml file stored in database. can anybody help me please
Be +ive
|
|
|
|
|
In case the XML file is stored as plain text in the database, you could just query it and create a DOM representation using XmlDocument.LoadXml method.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
|
Please tell me about following?
What is difference between Declaration Element or Processing Instruction.
Is Declaration Element is necessary for XML file. It should be first element.
Which one is root element in an XML file.
How many times a Processing Instruction can be in an XML file.
What is meant by "Content" in an XML file.
Thanks.
|
|
|
|