|
XML is of no intrinsic value to writing games. It may be used as a way to store data, but there will NEVER be a book or article called 'using XML to write games'. XML is not even a language.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
I am trying to use the tokenize function and I have tried many different namespaces but was unsuccessful. With the Xalan namespace, a call to function-available('xalan:tokenize') returns false.
With EXSLT, I get the error: Variable 'ctxN' has not been declared.
What does that mean? This is what I have for my stylesheet element:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"<br />
xmlns:msxsl="urn:schemas-microsoft-com:xslt"<br />
xmlns:str="http://exslt.org/strings" exclude-result-prefixes="str"><br />
<xsl:include href="str.tokenize.msxsl.xsl"/>
And then, when I switch to str.tokenize.template.xsl, I get the error:
Cannot find the script or external object that implements prefix 'http://exslt.org/strings'
What am I doing wrong? I am using Microsoft Visual Studio 2008 .NET. Any ideas?
Thanks!
|
|
|
|
|
Hi all...i'm new to xml...i'm displaying values from xml file to html using the below code...
HTML FILE
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1">
<DataBindings>
<asp:TreeNodeBinding DataMember="Product" ValueField="ID" TextField="Name"></asp:TreeNodeBinding>
<asp:TreeNodeBinding DataMember="Desc" ValueField="Value" TextField="Value"></asp:TreeNodeBinding>
</DataBindings>
</asp:TreeView>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/XML/XmlFile_1.xml">
</asp:XmlDataSource>
</div>
</form>
XML FILE:
<?xml version="1.0" encoding="utf-8" ?>
<!-- This file represents a fragment of Product
store inventory database -->
<Products>
<Product ID="1" Name="a" Price="5">
<Desc Value="5 boxes x 50 Bags"/>
</Product>
<Product ID="2" Name="b" Price="10">
<Desc Value="24oz bottles"/>
</Product>
<Product ID="3" Name="c" Price="15">
<Desc Value="40 kg pkgs"/>
</Product>
</Products>
Now i wanna use a text box in HTML and i need to store them in XML....how can i do that....
modified on Friday, October 9, 2009 11:39 PM
|
|
|
|
|
Did you look at any of this before or after you posted it?
|
|
|
|
|
i searched, but i didt get anything...
|
|
|
|
|
hey all.
I have this code
<albume1>
<file>Mortal.mp3</file>
<file>Seek.mp3</file>
</albume1>
and need function which is written in C#.NET
to do these things
gets name of file as parameter/
void RemoveLine(string name)
{
searchs in albume1 the name lets take for example "Seek.mp3"
found one delete the whole line
<file>Seek.mp3</file>
}
so the final result/save of XML file would be :
<albume1>
<file>Mortal.mp3</file>
</albume1>
I tried with InnerText attribute but InnerText takes whole Textes which appear among the two tags
thanks
modified on Tuesday, October 6, 2009 3:54 PM
|
|
|
|
|
First of all, i would say that you have to remove a node not it's innertext. So you need to find the node.
Second thing, IS all the album node is named as albume1 or is it the name of the Alubum?
anyways you can remove the child node in this way.
XmlDocument _xmlDoc = new XmlDocument();
if (System.IO.File.Exists(xmlDbFilepath))
{
_xmlDoc.Load(xmlDbFilepath);
}
XmlNode albumNode = _xmlDoc.SelectSingleNode("/root/album");
if (albumNode != null)
{
foreach (XmlNode node in albumNode.ChildNodes)
{
if (node.InnerText.trim() == fileName)
{
albumNode.RemoveChild(node);
}
}
}
I hope it will help you.
|
|
|
|
|
thanks for helping i will try the code.
with regards to ur Q.
albume1 is name of the album so there will be also albume2 and albume3
and all those tags are subs.. of main tag which is <albumes>
this how my xml file looks like:
<?xml version="1.0" encoding="utf-8"?>
<albumes>
<albume2>
<file>soso</file>
<file>D:\test.mp3</file>
<file>D:\test.mp3</file>
</albume2>
<koko>
<file>soso</file>
<file>D:\test.mp3</file>
<file>D:\test.mp3</file>
<file>D:\test.mp3</file>
</koko>
<Roro>
<file>D:\test.mp3</file>
<file>D:\test.mp3</file>
</Roro>
</albumes>
with regards to this line :
XmlNode albumNode = _xmlDoc.SelectSingleNode("/root/album");
why have u used root's word?
i have no roots word in there
u meant it as Theory? or what i cannot get it
can you replace the line please after that i gave u clear idea about the xml.
|
|
|
|
|
|
Actually you havn't provided the whole xml so i have taken "root" as placeholder. For your case it would be "albumes". Also in "/root/album" is the placeholder for the album name.
|
|
|
|
|
Thanks a lot.
I believe in ur codes
but in my project actually did not work.
even so its a good code.
am not aware of the reason
by the way i changed the whole idea.
besides removing nodes and staff
i used re-write method.
to be more clear.
I used an array(List) to help
lets say i have album named "Koko" and down to it has 2 songs
blah1
blah2
and wanna delete song named "blah2"
i insert two songs first to an array
when click remove song,, it goes to this array and delete existing song.
and call a function that writes info from this array to xml file.
so xml file will be updated with a new info from that array.
thanks anyway ))
|
|
|
|
|
<BookStore>
<Book>
<Page pname="abcded"/>
<Page pname="def"/>
<Page pname="ghi"/>
<page pname="acd"/>
<page pname="cad"/>
<page pname="amd"/>
</Book>
</BookStore>
How can I select all page elements (xpath query) having pname starting with "a"
Thanks.
|
|
|
|
|
Try //Page[starts-with(@pname, 'a')] (presuming it is Page , not page )
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
I've been looking all over the Internet and my books for an answer to this, but I cannot find it anywhere, I used to be working with SQL and I am new to XML coding.
I’m building a corporate website that is receiving it’s data through an xml adapter. The data is unsorted. I need to sort it in two ways
1. Sorted by date in the gridview
Before it’s sent to the client the xml should be sorted by date, with no further sorting functions in the gridview.
2. Sortable by the user in the gridview
This should be sortable by the user clicking the column in the gridview. Setting allowsorting=”true” expects some coding in the sorting sub. I tried so much that didn’t work
Protected Sub GrvSearchOffers_Sorting(ByVal sender As Object, ByVal e As GridViewSortEventArgs)
End Sub
In both cases I retrieve the xmldata in the code behind file using a dataset. This dataset is bound to the gridview displaying the unsorted data.
Thanks in advance for any help, I'm getting a bit desperate.
Bram
|
|
|
|
|
I think an XSLT stylesheet is your best option for sorting the actual XML. Beyond that, you could read your XML data into the entity classes that I assume exist, sort those, and then view from there.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
How do i auto generate Create, insert, update and delete command from Xml file
|
|
|
|
|
I don't think you do; please clarify this question, as it is not obvious what you are attempting to achieve.
|
|
|
|
|
An xml file is just text. If you want to use an xml data source, I have no idea if the crappy auto generated .NET controls can support that, or if you need to write some DOM code to do it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi, I have a XML column (name = 'xml') in a table 'contact' in my DB which has rows as the following
<Contact xmlns="http://www.focus-solutions.co.uk/focus360/1.0" id="00496bb7-0046-4459-8cf8-002cc5921f4c" documentId="494f4671-efe8-4577-aecc-4424b699a89c">
<Type code="FirstMeeting">First meeting</Type>
<Location code="ClientHome">Client Home</Location>
<PresentationInd>true</PresentationInd>
<OtherAddress>
<HouseNameNumber>1</HouseNameNumber>
<AddressLine1>Royal Terrace Gardens</AddressLine1>
<City>Edinburgh</City>
<Postcode>EH7 5DX</Postcode>
</OtherAddress>
<Date>2009-09-08</Date>
<Time isoTime="15:00:00">
<Hours>03</Hours>
<Minutes>00</Minutes>
<Period>PM</Period>
</Time>
<Duration>
<Hours>01</Hours>
<Minutes>00</Minutes>
</Duration>
<Notes />
<LetterSentInd>true</LetterSentInd>
<Documents>
<Document id="a7b36eec-ed51-4f22-8465-267a893fd8a0" externalId="494f4671-efe8-4577-aecc-4424b699a89c" userAttached="false">
<Type code="ConfirmationLetter">Confirmation Letter</Type>
<Reference>Joe Marton First meeting</Reference>
<CreatedDate>2009-09-18</CreatedDate>
</Document>
</Documents>
<CustomQuestions>
<Question type="HasMeetingTakenPlace">
<Answer>true</Answer>
</Question>
<Question type="ClientContacted">
<Answer>Joe Marton</Answer>
</Question>
</CustomQuestions>
<Valid>true</Valid>
</Contact>
So this is just one row in the table.I am complete beginner when it comes to querying XML datatypes in a table.
I need to be able to list all records in the table CONTACT for which the the value <PresentationInd>true</PresentationInd> is true.
Help appriciated!
Thanks
|
|
|
|
|
Here is the sample for XML Data Processing..
-- Create the table.
CREATE TABLE T (
ProductID int primary key,
CatalogDescription xml)
GO
-- Insert sample data.
INSERT INTO T values(1, '<productdescription productid="1" productname="SomeName">;')
GO
SELECT ProductID,
CatalogDescription.value('(/ProductDescription/@ProductName)[1]', 'varchar(40)') AS PName
FROM T
GO
So for your requirement
SELECT COLUMNNAME.value('(/Contact/PresentationInd)[1]', 'varchar(5)') AS PresentationInd
modified on Monday, September 28, 2009 6:57 AM
|
|
|
|
|
I’m new to XSL and struggling with this for awhile. Hope someone can take a look at my code and provide me with your feedback. The output looks close to what I want, but it’s not quite there yet. I’m looking for certain attributes (id=GUIDs) in ‘task’ element and copy the entire ‘task’ element if the attribute is matched with what I’m looking for. However the namespace cannot be copied correctly. Basically I don’t want the output to have the reference “:det” in taskGroup element and xmlns=http://schemas... in task element. How do I do this? Please see the source xml, xsl, current incorrect output and expected output below. Thank you in advance!
Source XML:
<?xml version="1.0" encoding="utf-8"?>
<taskGroup revocation="false" taskGroupGuid="{a0949a60-006c-4b35-b334-97ca289b06cd}" xmlns="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks">
<tasks>
<task id="{f418cae0-6b68-409b-93f4-a19fa1a5faad}" rank="2" name="1" description="2" tooltip="2" >
<command type="ShellExecute">
<arguments>
<commandLine>www.xxxxxx.com</commandLine>
</arguments>
</command>
</task>
<task id="{91395410-c164-468c-a247-14bbd7ceea88}" rank="5" issueTime="2009-09-15T11:05:42Z" requiresElevation="false" name="3" description="4" tooltip="4" >
<command type="ShellExecute">
<arguments>
<commandLine>www.yyyyyy.com</commandLine>
</arguments>
</command>
</task>
</tasks>
</taskGroup>
...
...
...
XSL:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:det="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<taskGroup revocation="false" taskGroupGuid="{{a0949a60-006c-4b35-b334-97ca289b06cd}}" >
<xsl:call-template name="taskList"></xsl:call-template>
</taskGroup>
</xsl:template>
<xsl:template name="taskList">
<xsl:copy-of select="//det:task[@id='{91395410-c164-468c-a247-14bbd7ceea88}']"/>
</xsl:template>
</xsl:stylesheet>
Current Output (incorrect):
<?xml version="1.0" encoding="utf-8"?>
<taskGroup revocation="false" taskGroupGuid="{a0949a60-006c-4b35-b334-97ca289b06cd}" xmlns:det="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks">
<task id="{91395410-c164-468c-a247-14bbd7ceea88}" rank="5" issueTime="2009-09-15T11:05:42Z" requiresElevation="false" name="3" description="4" tooltip="4" xmlns="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks">
<command type="ShellExecute">
<arguments>
<commandLine>www.yyyyyy.com</commandLine>
</arguments>
</command>
</task>
</taskGroup>
Expected XML Output:
<?xml version="1.0" encoding="utf-8"?>
<taskGroup revocation="false" taskGroupGuid="{a0949a60-006c-4b35-b334-97ca289b06cd}" xmlns="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks">
<tasks>
<task id="{91395410-c164-468c-a247-14bbd7ceea88}" rank="5" issueTime="2009-09-15T11:05:42Z" requiresElevation="false" name="3" description="4" tooltip="4" >
<command type="ShellExecute">
<arguments>
<commandLine>www.yyyyyy.com</commandLine>
</arguments>
</command>
</task>
</tasks>
</taskGroup>
|
|
|
|
|
You have to have the namespace declaration somewhere/somehow - the task element in the output has been copied verbatim from the input, where it lived in the det/http://schemas.microsoft.com/windows/2008/deviceExperienceTasks namespace.
What output do you WANT to see?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I used a namespace reference ":det" in the xls ("xmlns:det="http://schemas.microsoft.com/windows/2008/deviceExperienceTasks"), but I want to see the namespace in the output without the reference. There is also extra namespace appears in the end of the 'task' element which I don't want.
|
|
|
|
|
Why does it make any difference? Semantically, both forms are exactly the same.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi, I've got a XML schema which is split to multiple XSD files. Now we need to merge them into one big XSD file. Anyone knows a good tools I can use to do it? Manually merging would be too cumbersome, and error-prone.
Thanks very much.
|
|
|
|