|
Great, thanks.
One more question - what if I dont know how many columns the table is going to have? I think I might be able to hack something together with mxlns:script, unless anyone has a better idea?
Thanks
Dave Ratti
|
|
|
|
|
as you guessed you will have to scripting to do this - version 1 of xsl is pretty bare bones...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Ok, thanks for your time; you were very helpful
Dave ratti
|
|
|
|
|
When i search a certain xml-file using "selectNodes("//ROOT/BLA")" and i receive the found nodes. Is it possible to get iterate through those found nodes and retrieve their current position in the xml-tree? (remember that this is DOM and not XSLT, so "position()" and all that crap won't work).
Any help is greatly appriciated.
|
|
|
|
|
by position I presume you mean name - you could use:
XmlNodeList results = document.SelectNodes(""
foreach (XmlNode result in rtesults)<br />
{<br />
Console.Write("found {0} value = '{1}'", GetNodeName(result), result.value);<br />
}<br />
<br />
string GetNodeName(XmlNode node)<br />
{<br />
string result = node.LocalName;<br />
<br />
if (node.Parent != null)<br />
result = GetNodeName(node.Parent) + "/" + result;<br />
<br />
return result;<br />
}
if you want the position then just change the above function to count previousSiblings:
<br />
string GetNodePosition(XmlNode node)<br />
{<br />
int previousSiblings = 0; <br />
for (XmlNode previous_node = node.PreviousSibling; previous_node != null; previous_node = previous_node.PreviousSibling)<br />
previousSiblings++;<br />
string result = previousSiblings.ToString();<br />
<br />
if (node.Parent != null)<br />
result = GetNodeName(node.Parent) + "/" + result;<br />
<br />
return result;<br />
}
hope this helps
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
yeah...i thought i would have to write my own function to calculate the current position. I was hoping i overlooked something and that it was possible to retrieve the index/position directly from a found node. Thanks though, for your reply.
|
|
|
|
|
I am attempting to create a generic xml schema file that defines element type restrictions. That file is then imported into my additional xml schemas, which make use of the defined types. Here is what I have.
General Formatting File
<br />
<?xml version="1.0" encoding="utf-8" ?><br />
<xs:schema id="GeneralFormatting" <br />
targetNamespace="http://localhost/XMLWebServices/GeneralFormatting.xsd"<br />
elementFormDefault="qualified"<br />
xmlns:gns="http://localhost/XMLWebServices/GeneralFormatting.xsd"<br />
xmlns:xs="http://www.w3.org/2001/XMLSchema"><br />
<br />
<!-- Define format restriction --> <br />
<xs:simpleType name="UserName"><br />
<xs:restriction base="xs:string"><br />
<xs:pattern value="([a-zA-Z0-9])*"></xs:pattern><br />
<xs:whiteSpace value="preserve" /><br />
</xs:restriction><br />
</xs:simpleType><br />
</xs:schema><br />
XML Schema
<br />
<?xml version="1.0" encoding="utf-8" ?><br />
<xs:schema id="WTNManagement_XSD" <br />
targetNamespace="http://localhost/XMLWebServices/Management.xsd" <br />
elementFormDefault="qualified" <br />
xmlns:tns="http://localhost/XMLWebServices/Management.xsd"<br />
xmlns:xs="http://www.w3.org/2001/XMLSchema"><br />
<br />
<xs:import <br />
namespace="http://localhost/XMLWebServices/GeneralFormatting.xsd" <br />
schemaLocation="http://localhost/XMLWebServices/GeneralFormatting.xsd" /><br />
<br />
<!-- definition of elements --><br />
<xs:element name="Management" id="Management"><br />
<xs:complexType><br />
<xs:sequence><br />
<!-- File Sequence number, must be unique --><br />
<xs:element name="SeqNum" type="xs:integer" /><br />
<!-- User making request --><br />
<xs:element name="UserName" type="xs:UserName" /><br />
</xs:sequence><br />
</xs:complexType><br />
</xs:element><br />
</xs:schema><br />
This code isn't working could someone point me in the right direction.
Thanks
Jason W.
|
|
|
|
|
You shouldn't be using the xs: prefix for the UserName type in the second schema, as the xs is for the schema namespace. You probably should define another xmlns for the imported namespace ie xmlns:gf="http:....GeneralFormatting.xsd"
and then have <xs:element name="UserName" type="gf:UserName">
|
|
|
|
|
Something like this?
Generic Formatting XML Schema
<?xml version="1.0" encoding="utf-8" ?><br />
<xs:schema id="GeneralFormatting" <br />
targetNamespace="http://localhost/XMLWebServices/GeneralFormatting.xsd"<br />
elementFormDefault="qualified"<br />
xmlns:ns="http://localhost/XMLWebServices/GeneralFormatting.xsd"<br />
xmlns:xs="http://www.w3.org/2001/XMLSchema"><br />
<br />
<!-- Define format restriction --> <br />
<xs:simpleType name="UserName"><br />
<xs:restriction base="xs:string"><br />
<xs:pattern value="([a-zA-Z0-9])*"></xs:pattern><br />
<xs:whiteSpace value="preserve" /><br />
</xs:restriction><br />
</xs:simpleType><br />
</xs:schema><br />
Additional XML Schema
<?xml version="1.0" encoding="utf-8" ?><br />
<xs:schema id="WTNManagement_XSD" <br />
targetNamespace="http://localhost/XMLWebServices/Management.xsd" <br />
elementFormDefault="qualified" <br />
xmlns:tns="http://localhost/XMLWebServices/Management.xsd"<br />
xmlns:gns="http://localhost/XMLWebServices/GeneralFormatting.xsd" <br />
xmlns:xs="http://www.w3.org/2001/XMLSchema"><br />
<br />
<xs:import <br />
schemaLocation="http://localhost/XMLWebServices/GeneralFormatting.xsd" /><br />
<br />
<!-- definition of elements --><br />
<xs:element name="Management" id="Management"><br />
<xs:complexType><br />
<xs:sequence><br />
<!-- File Sequence number, must be unique --><br />
<xs:element name="SeqNum" type="xs:integer" /><br />
<!-- User making request --><br />
<xs:element name="UserName" type="gns:UserName" /><br />
</xs:sequence><br />
</xs:complexType><br />
</xs:element><br />
</xs:schema>
Thanks
Jason W.
|
|
|
|
|
Here are the details of the error message I’m getting.
<br />
Type ‘http:
Hope that helps.
Jason W.
|
|
|
|
|
In your first schema you should change the xmlns:gns="http://localhost/XMLWebServices/GeneralFormatting.xsd" to xmlns="http://localhost/XMLWebServices/GeneralFormatting.xsd" so that all types declared are in that namespace, otherwise you would have to put the gns prefix on all type names...
|
|
|
|
|
Does anybody know where i could find an amazon.com rss file or any other book store rss files.................thanks
Da Intern
|
|
|
|
|
Hi
I'm trying to generate an xml browseroutput using classic ASP, VBScript and Set objXML=server.CreateObject("MSXML.DOMDocument")
I've addes some elements. But In an allready created element, how do I get the childnodes.length? It should be something like num=objXML.firstChild.childnodes.length??? but I don't know the correct syntax.
Can somebody please help? /xaphod
|
|
|
|
|
All efforts at generating a £ sign in the output HTML have failed. Any suggestions?
|
|
|
|
|
I am not sure about this but have you tried &<m>pound; ?
Paul Watson Bluegrass Cape Town, South Africa
Roger Wright wrote:
Personally, I'm seeking a red-headed, double-breasted mattress thrasher
|
|
|
|
|
£ -> £
£ -> £
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I would hope anyone can help me understand a certain problem I am currently having with a small piece of code. I would be very grateful if anyone could give me some ideas on how I could structure my XSL template to produce an output similar to the following table given the attached Test.xml source. I seem to be using for-each and the priority attribute but cant pinpoint where to place it correctly.
View the Test.xml source at :
http://www.angelfire.com/pro/atbgmxsl/Test.xml
Required result in table format is :
ASXCode Company Name Company Statistics/Interim Dates Annual Balance Sheet/Cash
RWS Rothbury Wines Limited -- 99,000
OCO Oriel Communications Limited 12/2002 97,065
NRL Newland Resources Limited 12/2002 95,143
MCL M2M Corporation Limited 12/2002 95,033
SUP Supersorb Environment NL 12/2002 94,328
|
|
|
|
|
Just a quick shot at it
<table>
<xsl:for-each select="root/ResultSet/Record">
<tr>
<xsl:for-each select="Column">
<td><xsl:value-of select="." /></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
|
|
|
|
|
I’m creating my first web service and running into the following error.
A first chance exception of type 'System.Net.WebException' occurred in system.dll
Additional information: The remote server returned an error: (401) Unauthorized.
The error occurs in the Reference.vb file when I try to retrieve a string value from a function in the asmx file. Here is some of the code from the Reference.vb file.
<br />
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://localhost/XMLWebServices/ReturnValue", RequestNamespace:="http://localhost/XMLWebServices ", ResponseNamespace:="http://localhost/ XMLWebServices ", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _<br />
Public Function ReturnValue() As String<br />
Dim results() As Object = Me.Invoke("ReturnValue", New Object(-1) {})<br />
Return CType(results(0), String)<br />
End Function<br />
The web method in the asmx file looks like the following.
<WebMethod()> Public Function ReturnValue() As String<br />
ReturnValue = "Value"<br />
End Function<br />
All suggestions are greatly appreciated.
Jason W.
|
|
|
|
|
Must define Credentials
<br />
Dim ws As New localhost.WebS()<br />
ws.Credentials = System.Net.CredentialCache.DefaultCredentials<br />
Jason W.
|
|
|
|
|
im building a web page and i want to be able to search an xml file
please help
thanks
Da Intern
|
|
|
|
|
You'll need to ask a more detailed question if you want help.
What do you need help with?
|
|
|
|
|
i have an xml file that a user creates and i want them to be able to search the whole xml file with a text box i am doing it in asp.net vb
if you could help me i would greatly appreicate it
Thanks
Da Intern
|
|
|
|
|
The first problem is you are using VB.NET
You still haven't said what the user is searching. Nodes, attributes, text???
Do some research on XPath.
|
|
|
|
|
lol.......yea i don't like it that much either but im tryin to learn it
I'm searching for text in individual elements
im a c# person
Da Intern
|
|
|
|