|
Hi,
I have one XML file that I read from sql 2005 db. I have too XSD file with the structure of XML file.
I need to deal XML versioning because is posible that the version of the XML file that I read from DB could change. I need too read the XML file according to the structure that i find in XSD file.
the XML file seems like this
<Parametri><XSD_INFO><XSD_VERSION VALUE="1.0.3.3"/><XSD_TYPE VALUE="0"/> ...
the XSD file is named Parameters_v1_0_3_3
How can I do?
Thanks.
Helen.
|
|
|
|
|
|
Hi,
I'm generating an xml dynamically and want to use xsl as a template (and therefore not generated dynamically).
Here is an example of such xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="Template.xsl"?>
<PeopleList order="1">
<item>
<Name>John</Name>
</item>
<item>
<Name>Doe</Name>
</item>
</PeopleList>
<KidList order="2">
<item>
<Name>Alex</Name>
</item>
<item>
<Name>King</Name>
</item>
</KidList>
Template.xsl looks like this:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
<html>
<body>
<h2>My List</h2>
<xsl:apply-templates select="KidList"/>
<xsl:apply-templates select="PeopleList"/>
</body>
</html>
</xsl:template>
<xsl:template match="PeopleList">
<p> People List </p>
</xsl:template>
<xsl:template match="KidList">
<p> KidList </p>
</xsl:template>
</xsl:stylesheet>
Result will be (the order was decided according xsl:apply-templates and not according the xml) :
My List
Kid List
People List
In the xml, PeopleList can come before KidList or after it and the order is matter - I want one xsl file that can display them in the right order.
I added an "order" attribute but still don't know if it can help and how.
Any suggestions?
|
|
|
|
|
Have you tried changing this:
<br />
<h2>My List</h2> <br />
<xsl:apply-templates select="KidList"/> <br />
<xsl:apply-templates select="PeopleList"/> <br />
to this:
<br />
<h2>My List</h2> <br />
<xsl:apply-templates select="PeopleList"/> <br />
<xsl:apply-templates select="KidList"/> <br />
Mark's blog: developMENTALmadness.blogspot.com
Funniest variable name:
lLongDong - spotted in legacy code, was used to determine how long a beep should be. - Dave Bacher
|
|
|
|
|
Thanks for replying, but this is not the solution. The xml is built dynamically so sometimes KidList will be before PeopleList and sometimes not (I can't change the xsl so I need it to be generic). The solution is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="Lists"/>
</body>
</html>
</xsl:template>
<xsl:template match="Lists">
<h2>My List</h2>
<xsl:for-each select="*">
<xsl:variable name="TemplateName" select="."/>
<xsl:apply-templates select="$TemplateName"/>
</xsl:for-each>
</xsl:template>
<xsl:template match="PeopleList">
<p> People List </p>
</xsl:template>
<xsl:template match="KidList">
<p> KidList </p>
</xsl:template>
</xsl:stylesheet>
|
|
|
|
|
If you can't control the order of KidList and PeopleList then the result your solution will always be the order of the xml document. If KidList is first in the Xml then it will be first in your output.
If you need it to be more generic then you will need to do this:
<br />
<xsl:for-each select="*"><br />
<xsl:sort select="@order" data-type="number" /><br />
<xsl:variable name="TemplateName" select="."/><br />
<xsl:apply-templates select="$TemplateName"/><br />
</xsl:for-each><br />
<br />
That is assuming you are still using the "order" attribute in your xml that was in your first post. Otherwise you'll have to sort by the name of the element in descending order (PeopleList then KidList).
<br />
<xsl:for-each select="*"><br />
<xsl:sort select="." data-type="text" order="descending" /><br />
<xsl:variable name="TemplateName" select="."/><br />
<xsl:apply-templates select="$TemplateName"/><br />
</xsl:for-each><br />
Mark's blog: developMENTALmadness.blogspot.com
Funniest variable name:
lLongDong - spotted in legacy code, was used to determine how long a beep should be. - Dave Bacher
|
|
|
|
|
Mark J. Miller wrote: If you can't control the order of KidList and PeopleList then the result your solution will always be the order of the xml document.
Maybe I didn't explain clearly, but that is what I wanted: maintain the xml order.
I thought to add the "order" attribute for sorting, but had no idea how to use it. Your code is a great help and I will use it for sure. Thanks
|
|
|
|
|
Hello, i am serializing an arraylist and it gives such an output
<HISDepartments>
<HISDepartments>
<Aktif>69</Aktif>
<StandartDepartmentCode>213</StandartDepartmentCode>
</HISDepartments>
<HISDepartments>
<Aktif>69</Aktif>
<StandartDepartmentCode>213</StandartDepartmentCode>
</HISDepartments>
</HISDepartments>
Arraylist has 2 items, and i want an output like this
<HISDepartments>
<Aktif>69</Aktif>
<StandartDepartmentCode>213</StandartDepartmentCode>
</HISDepartments>
<HISDepartments>
<Aktif>69</Aktif>
<StandartDepartmentCode>213</StandartDepartmentCode>
</HISDepartments>
i dont want the outer tag
how can i do that can someone help?
|
|
|
|
|
aliaskain wrote: i dont want the outer tag
Without the outer tag it's not valid XML. If you are new to using XML I strongly suggest you study the subject to gain an understanding of it before you try to use it in software projects.
led mike
|
|
|
|
|
im sorry that i did not write the whole xml here
it has an outer tag like
<Abc>
......
</Abc>
in this tag it writes those that i wrote first
i wanted to say it writes 1 more tag <HISDepartments>
under Abc i want other elements
|
|
|
|
|
As part of my program I should create a XML file and it should contain a URL. That URL is containing '&' sign. Whenever I put '&' sign in XML file, Internet exploerer is not taking it and showing error
Following is a simple XML file
<pharmacy name="PChek.com" country="Canada">
<drugs>
<drug name="APO-DILTIAZ CD" unit="CAPSULE" affiliateid="https://www.interna.com/cgi-bin/ncommerce3/input?ProductName=DILTIAZ CD&groupid=RPC" ndc="" />
</drugs>
</pharmacy>
Once I open this XML file in the IE, it gives following error "
A semi colon character was expected. Error processing resource
If I remove the & sign from the url, then XML file is opening and working fine
How to solve this problem? Please let me know
|
|
|
|
|
you show encode "&" to "&" in xml
then your problem would be solved.
------------------------------------------------------------
Logiclabz
modified on Thursday, March 26, 2009 3:11 AM
|
|
|
|
|
Replace & with &
<pharmacy name="PChek.com" country="Canada">
<drugs>
<drug name="APO-DILTIAZ CD" unit="CAPSULE"
affiliateid="https://www.interna.com/cgi-bin/ncommerce3/input?ProductName=DILTIAZ
CD&groupid=RPC" ndc="" />
</drugs>
</pharmacy>
|
|
|
|
|
I am so new to the topic of XML I am sure that I will be asking the questions wrong (I feel like the South end of a horse facing North just framing my question). I have searched for a simple examples of code and have not found any simple or direct enough to meet my ability.
I am working in Excel 2003 Pro and have a multi-sheet spreadsheet that I would like to export a fixed range of data from to an XML file (this file will be used in an Xcelsius dashboard).
The data will always be on the same sheet and of the same range, though the number of records may vary from tiem to time. I could export the data to a CSV file if this would help. I would like the export to take place on a regular schedule.
Can anyone help point me at a code example?
Many thanks in advance.
a
|
|
|
|
|
abesimpson wrote: I feel like the South end of a horse facing North just framing my question
Maybe you are. I mean when I want to learn about something new to me I don't try to do it from the perspective of my project needs. I go find a tutorial or book on the subject and read it for what it is, not try to find something in it that pertains to my current project.
For tutorials on XML I recommend TopXML and www.w3schools.com web sites. For working with Excel I recommend the MSDN documentation.
led mike
|
|
|
|
|
Hi,
I originally posted this in the ASP.NET forum, to no reply and thought I would try this forum. Apologies if I am in the wrong place.
Is it possible to auto populate a word document or word document template from ASP.NET 2.0 and also have this document emailed automatically to a user? I am able to populate a word document from a datasource using xml and xslt.
I am also able to seperately email a word document as an attachment but it is the combination of creating the word document using xslt/xml and have this automatically emailed to a user that I am having difficulty with.
I'm guessing it probably can't be done and the word document would need to be saved by the user and emailed independently.
Can anyone clarify?
Thanks.
|
|
|
|
|
|
malarpm wrote: Can any body help me on this please?
Help you with what? Read these posting guidelines[^]. Pay attention to item #11.
led mike
|
|
|
|
|
Hello All.
I have xml file which has several tables, there are several users who will be accessing this file, before i was locking the whole file so that others can just read it cannot edit. Now i want to lock only the particular table which a particular client is accessing and the rest of the tables are free to be edited .. Is this possible using C#.net ??
Thanks in advance
Ron
|
|
|
|
|
Ron.S wrote: Is this possible using C#.net ??
No, it's not possible using anything because it's just part of a file and File Systems don't provide that feature. At least none I have ever heard of.
led mike
|
|
|
|
|
No it's not possible to do this because the file system (NTFS) laks support for locking sections of files. AFAIK, there isn't a file system on this earth that supports this.
It sounds like you're treating an XML file as a small database, when in fact, you need full database support. It looks like in order to implement this requirement, you're going to have to rewrite your data access layer to use a full database, such as SQL Server Express or SQL Server Mobile.
|
|
|
|
|
I want to make a query that works like 'LIKE' in SQL
I want to retrive nodes that starts with 'X' or any starting string
Or containg 'X'
I write this XPath:
Message[Contains(@Title,'5')]
But it's wrong!!
how can I do??
plz help me
<code>
<Message MessageID="1" Title="Title1" Icon="Information" Buttons="Ok">
<Parts Part="part333333" />
<Parts Part="part333333" />
<Parts Part="part333333" />
</Message>
<Message MessageID="2" Title="Title2" Icon="Information" Buttons="Ok">
<Parts Part="part333333" />
</Message>
<Message MessageID="3" Title="Title3" Icon="Information" Buttons="Ok">
<Parts Part="part33XXXX3333" />
<Parts Part="YYpart53" />
</Message>
<Message MessageID="4" Title="Title4" Icon="Information" Buttons="Ok">
<Parts Part="YYpart53" />
</Message>
</code>
|
|
|
|
|
Masterhame wrote: how can I do??
Well you can only do what XPath supports. Also you might find that the latest XPath standards are not fully supported by many of the XPath implementations so you need to check the specific engine you are using to determine what standard it supports.
led mike
|
|
|
|
|
Hi,
I'm fairly new to using XML properly. I'm trying to write and XSD schema but I'm having trouble understanding namespaces.
Say my schema begins with...
< ?xml version="1.0"?>
< xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.w3schools.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">
(without the spaces after the < signs)
and each element in the schema begins with < xs:whatever>
As I understand it, the xmlns:xs="" part identifies a source for what each of the fundamental identifiers mean, such as "element", "attribute", "simpleType", or whatever. targetNamespace="" identifies where the xsd i'm writing will be located, and xmlns="" identifies what the default namespace is (ie. if i dont put "xs:" at the beginning of things).
That's just my basic understanding that may be wrong. This is all very well, but what if the machine being used doesn't have an internet connection? How does it look up the basic types (element, attribute, etc)? Can I specify an offline source, maybe provided in Windows or the .NET framework (this is where I'm using the XML).
And once i've done this, how do I need to start an XML document that uses the schema (ie. what combination of "xmlns" things do i need to put in the root node tag?).
I realise I may have entirely missed the point of namespaces here. Any help would be greatly appreciated!
Thanks in advance!
Graeme
|
|
|
|
|
Hi all,
Assume we have 2 XML documents with the following contents:
1st
<vehicle type="car">
<doors>4</doors>
</vehicle>
2nd
<vehicle type="motorbike">
<wheels>2</wheels>
</vehicle>
Is there a way, to validate this 2 documents against a single XSD file, or I have to use seperate schemas? What I'm trying to accomplish is to determine each vehicle's elements according to vehicle's "type" attribute.
Thanks in advance,
|
|
|
|