|
My web method returns some XML as a string. I have a fairly simple XSLT file (trying to create HTML SELECT OPTION tags from the XML content). I think both are OK but I cannot figure out how to pass the string of XML to the Transform method and get my desired output streamed out to the web page.
<code>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim myProxyClass As New ServicesMDW.Service
Dim countiesXML As String
Dim xslt As New XslCompiledTransform()
Dim xpathdoc As XPathDocument
Dim xslFileName As String = Server.MapPath("UserControl_StateCounty.xsl")
Try
countiesXML = myProxyClass.GetCountiesForState("06", "P", "Guest")
xpathdoc = New XPathDocument(countiesXML)
xslt.Load(xslFileName)
xslt.Transform(xpathdoc, Nothing, Response.OutputStream)
Catch ex As Xsl.XsltException
Trace.Write("Transform Failed")
Catch ex As Exception
Trace.Write(ex.Message)
End Try
End Sub
</code>
Here is the XSLT file "UserControl_StateCounty.xsl":
<code>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<div id="divCounty">
<label for="ddCounty">Select County</label>
<select id="ddCounty" >
<xsl:for-each select="Counties/County">
<option value="{County_Cd}"><xsl:value-of select='TypeCounty' /></option>
</xsl:for-each>
</select>
</div>
</xsl:template>
</xsl:stylesheet>
</code>
Here is a snippet of the XML returned from web method:
<code>
<Counties> <County> <County_Cd>001</County_Cd> <TypeCounty>Alameda</TypeCounty> <State_cd>06</State_cd> </County> <County> <County_Cd>005</County_Cd> <TypeCounty>AMADOR</TypeCounty> <State_cd>06</State_cd> </County></Counties>
</code>
John
|
|
|
|
|
Hi All
I am trying to generate code from one of my xml schema using Xsd.exe.
it throws the following error:
C:\>xsd C:\statement.xsd /c /l:cs
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Error: Error generating classes for schema 'C:\statement'.
- Group 'value' from targetNamespace='http://www.xyz.com/statement' has invalid definition: Circular group reference.
If you would like more help, please type "xsd /?".
Is there any solution for the problem with Circular group reference?
Gokulan
|
|
|
|
|
All,
what is the equvalent of in xsl i want to break a line what should i have to use....
Thanks
Vikas
|
|
|
|
|
Did you try google?
http://www.xml.com/pub/a/2001/12/05/whitespace.html[^]
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
I use
<xsl:text> </xsl:text>
|
|
|
|
|
Hi ,
Im trying to transform an xml document with a style sheet that includes a vbscript file with vb script functions, using .net 1.1 and vb.net i get the following error when the code block attempts to transform the xml file.
The scripting language 'vbscript' is not supported.
Ive googled with very little help can someone please offer me a solution or advice !!
From my understanding this is .net security kicking in by not allowing server side scripts being included which may contain bad code nice but in this case its not helping me, in this case my intentions are good so i need this script to be trusted
Thank you in advance.
|
|
|
|
|
I am having a weird problem while validating an XML file against its schema. I am setting XmlReaderSettings to xml schema, add the ValidationEventHandler and then create the xml reader. But it throws an exception:
------------------
A first chance exception of type 'System.Xml.Schema.XmlSchemaValidationException' occurred in System.Xml.dll
validate function threw an exception of type 'System.Xml.Schema.XmlSchemaValidationException'
base {System.Xml.Schema.XmlSchemaException}: {"It is an error for both 'length' and either 'minLength' or 'maxLength' to be members of {facets}, unless they are specified in different derivation steps. In which case the following must be true: the {value} of 'minLength' <= the {value} of 'length' <= the {value} of 'maxLength'."}
SourceObject: null
-----------------------
I have validated the same xml file against the same schema using Oxygen XML Editor and XML Spy and these tools consider it a valid document.
Now after that I opened the schema in VS 2005, it underlines the xsd:length attribute and tootip gives the same error. But the above mentioned third party tools consider it valid attribute.
Any thoughts will be highly appreciated
-----
|
|
|
|
|
|
hello gentlemen, im new at web services
all i've acomplished to do is to make the web reference...
the web reference i made of a web service that returns an xml
im sure of that because in the details page when i press invoke it returns a very large xml
my question is how to take that xml from the web service and somehow save it into the computer and transform it to be used by a dataset to feed a datagrid using windows forms in visual basic 2003 language visual basic
i've read a lot about web services but im alittle bit confused about all the xml things
the xml writters readers readxml etc (its simply confusing)
help is apreciated
thanks for your time
an expample of the xml that returns is here:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://services.naves.digmer.com/types/">
<env:Body>
<ns0:getNavesNavegandoResponseElement>
<ns0:result>
<naves>
<nave>
<nodo name="nombre">100PRE MI ROBERT</nodo>
<nodo name="senal_llamada">HC2733</nodo>
<nodo name="id_pais">EQA</nodo>
<nodo name="tb">22.61</nodo>
<nodo name="id_puerto_zarpe">2</nodo>
<nodo name="id_puerto_arribo">1170</nodo>
<nodo name="id_puerto_proximo"></nodo>
<nodo name="fecha_zarpe">10-04-2007 08:00:00</nodo>
<nodo name="fecha_estimada_arribo">09-05-2007 10:00:00</nodo>
<qth>
<nodo name="latitud">-0.8500000000</nodo>
<nodo name="longitud">-80.7000000000</nodo>
<nodo name="rumbo">0</nodo>
<nodo name="velocidad">0</nodo>
</qth>
<nodo name="estado">NAV</nodo>
</nave>
<nave>
<nodo name="nombre">2 MUJERES J.M.</nodo>
<nodo name="senal_llamada"></nodo>
<nodo name="id_pais">EQA</nodo>
<nodo name="tb">1.83</nodo>
<nodo name="id_puerto_zarpe">1</nodo>
<nodo name="id_puerto_arribo">1065</nodo>
<nodo name="id_puerto_proximo"></nodo>
<nodo name="fecha_zarpe">02-04-2007 09:00:00</nodo>
<nodo name="fecha_estimada_arribo">17-04-2007 06:00:00</nodo>
<qth>
<nodo name="latitud">-2.2297222222</nodo>
<nodo name="longitud">-79.8738888889</nodo>
<nodo name="rumbo">0</nodo>
<nodo name="velocidad">0</nodo>
</qth>
<nodo name="estado">NAV</nodo>
</nave>
:
:
'
</naves>
</ns0:result>
</ns0:getNavesNavegandoResponseElement>
</env:Body>
</env:Envelope>
"everything is possible"
|
|
|
|
|
i also get the same error about
System.Xml.dll
somehow the idea to try
dataset1.readxml(file.xml)<br />
datagrid1.datasource = dataset1
only gives me trouble
if i cant load an xml from a file, how is it possible to get it from a web service
and im starting to worry about that
|
|
|
|
|
Will you be so kind to tell me how do you search with xml using aspnet 2003.
Romeo
|
|
|
|
|
What do you mean by search with XML?
If you want to access a specific element or attribute of an XML file use XPath[^].
"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
How to create a dynaic XSD
its very urgent
thank u
kishore kumar Manikonda
Software Developer
|
|
|
|
|
An XML Schema file is an XML file itself, so you can use the usual APIs like XmlDocument or XmlTextWriter .
"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
|
|
|
|
|
what is mean of "OUTER XML CONCEPTS"...
which purpose we r using..
how to use it...
|
|
|
|
|
I am trying to load a list of number in a combobox, it seems to be reading the xml file elements but it is reading my numbers as the index for the combobox
here is my xml file data that is is reading
<Days>21, "21"</Days>
<Days>20, "20"</Days>
<Days>19 19</Days>
<Days>18</Days>
<Days>17</Days>
<Days>16</Days>
<Days>15</Days>
<Days>14</Days>
<Days>13</Days>
<Days>12</Days>
<Days>11</Days>
<Days>10</Days>
all i get is a blank drop down list, if you want to see the code let me know but the code is working to read the other elements and filling text boxes
|
|
|
|
|
Hello,
I am Andrea from Italy.
ToDay I have download this script http://www.codeproject.com/asp/xml_messageboard.asp
and I have trouble.
I f I place html code in this page before the asp script, it return with strange simbol:
<%@ Language=VBScript %>
<%
' View Message
' prevent page caching
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
xslpath = Server.mappath("viewmessage.xsl") '"d:\InetPub\wwwroot\XMLmessageboard\messageboard.xsl"
xmlpath = Application("xmlpath")
Set id = Request.QueryString("id")
set xdoc = Application("xdoc")
set xsldoc = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
'load up XSL doc and perform transformations
xsldoc.async = false
xsldoc.load(xslpath)
set xsltemp = Server.createObject("MSXML2.XSLTemplate")
xsltemp.stylesheet=xsldoc
set xslproc = xsltemp.createProcessor
xslproc.input=xdoc.nodeFromID(id)
xslproc.output=Response
' parameter for message group
xslproc.addParameter "msgid",CStr(id)
xslproc.transform()
%>
why ?
Thanks,
Andrea
|
|
|
|
|
The code is transforming a XML file with XSLT to recreate a HTML document. If you place HTML code before, during or after the code, you will have a malformed HTML document since you will have HTML code outside of scope of the <html> tag. If you want to add HTML code, you must modify the messageboard.xsl document.
|
|
|
|
|
... I can not modify the asp file? or there is not another way to trasform xml ?
|
|
|
|
|
Can you modify the xsl file?
|
|
|
|
|
Yes I can, but I would want to add other code asp ...
|
|
|
|
|
You want to add more ASP code? If the XSL does not change and HTML code concerning the body element and its ancestors, you can place that code in the ASP file. Then, you can add more ASP code before or after the transformed HTML code.
|
|
|
|
|
... kindly, can you give me an example with the post code?
|
|
|
|
|
... the code I should change it so?
my code asp
<%
' View Message
' prevent page caching
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
xslpath = Server.mappath("viewmessage.xsl") '"d:\InetPub\wwwroot\XMLmessageboard\messageboard.xsl"
xmlpath = Application("xmlpath")
Set id = Request.QueryString("id")
set xdoc = Application("xdoc")
set xsldoc = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
'load up XSL doc and perform transformations
xsldoc.async = false
xsldoc.load(xslpath)
set xsltemp = Server.createObject("MSXML2.XSLTemplate")
xsltemp.stylesheet=xsldoc
set xslproc = xsltemp.createProcessor
xslproc.input=xdoc.nodeFromID(id)
xslproc.output=Response
' parameter for message group
xslproc.addParameter "msgid",CStr(id)
xslproc.transform()
my code asp
%>
Andrea
|
|
|
|
|
Yes, just make sure that the HTML, HEAD and BODY elements aren't in the messageboard.xsl.
|
|
|
|