|
Hi guys,
I create a xml file like this by program:
<condition>disp='1'</conditions>
<item>
<disp> 1 </disp>
<otheritem> f</otheritem>
<item>
<item>
<disp> 2 </disp>
<otheritem> w</otheritem>
<item>
<item>
<disp> 3 </disp>
<otheritem> w</otheritem>
<item>
I use xslt to transform this xml file to html.
But I don't want to show some items, such as, when disp='1', I don't want to show it to users.
In here, the condition is variational. Maybe it's disp!='4', maybe it's otheritem = '53g'.
when I show the items with xslt, how to filt these items?
<xsl:for-each select="/items/item[???]">
I try to add the condition to the xml file, and get it in the xslt. But it can't work normally. Can anyone give me any suggestions?
Thanks & regards.
=========================================
Make friends with you all.
My Blog, welcome
???????,????????
|
|
|
|
|
please help!!
I have a class which has three constructors say
class Person
{
Person(string name, int age, string address)
{
//all these value written to an xml file
}
Person(string name, int age, string address, string emailadress)
{
//all these value written to an xml file
}
Person(string name, DateTime dateOfBirth, bool isalive, DateTime dateofExpire)
{
//all these value written to an xml file
}
}
Now what I need to a make a common xml schema for these constructor value where I can represent these items. Please help!!!
Also I have one more problem in one of attribute of an xml item there is complex datatype say
< property id="status" title="Status" type="Choice" >
< choices>
< choice > Draft </choice>
< choice > Approved </choice>
< choice > Active </choice>
< /choices>
</property>
Where status is attribute of an xml element how can I represent this in an xmlschema
Thanx in advance
|
|
|
|
|
Hi,
I want to wite an application with c# .Can i save/reterive an image in/to xml file.Any body can help me with some code.Thanks
Shoukat
|
|
|
|
|
Look at this forum post[^]
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi all,
I have a XML (xsd designed/based). My client gave me the new version of XSD which modified than earlier one. He needs the xml to be generated on this XSD progammatically. So now the query is that Is there any tool using which i can migrate from one version to other version of XSD. when i put my old xml in that tool and new xsd then the output will be modified xml with may be dummy data. this new xml is supporting the new xsd of course!
If anybody can help me in this regard, please help me !!
Regards,
Jitin
|
|
|
|
|
coder_help wrote: If anybody can help me in this regard, please help me !!
You seem to be missing the aspect of conversion wherein something or someone must decide what data goes where. I doubt you will find any tool that will magically make that decision for you.
|
|
|
|
|
I transformed an XML file as follows:
**** original XML ****
<?xml version="1.0" encoding="utf-8"?>
<Data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<pages>
<ele0>
<pageName>Test</pageName>
</ele0>
</pages>
</Data>
******* Transformed XSL *****
<?xml version="1.0" encoding="utf-8"?>
<main-menu-list>
<pageName pageName="Test" />
</main-menu-list>
**** XSL ***
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<main-menu-list>
<xsl:for-each select="//Data/pages/*">
<xsl:element name="pageName">
<xsl:attribute name="pageName">
<xsl:value-of select="pageName"/>
</xsl:attribute>
</xsl:element>
</xsl:for-each>
</main-menu-list>
</xsl:template>
</xsl:stylesheet>
However, I would like to transform any XML document as above without naming a specific element/attribute.
I found this XSL for starters but am having difficulty representing the element value in the attribute:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"/>
<xsl:template match="pageName">
<xsl:element name="{name()}">
<xsl:for-each select="@*">
<xsl:attribute name="{name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Any ideas?
|
|
|
|
|
I'm not sure I understand. You want to transform any element into an element of the same name with an attribute of the same name with the attribute value being the value of the child text node of the original element? I can't begin to understand what problem that solves but you need your match value to be "*" to have it transform "any" element.
|
|
|
|
|
My task is to create xml-files based on different schemas. The schema files are quite big approx 4000 rows. The contents of the files are stored in our database. I know how to validate, but I am puzzled with file creation process. I need information about how to solve it in a time efficient and flexible (schemas may change now and then) way. Is there a best practice way or are there support tools available? I use Visual studio as development platform.
thanks all
|
|
|
|
|
eroi wrote: My task is to create xml-files based on different schemas.
I do not understand your question. How can you create XML files based on schemas? A schema defines the structure of the XML but you also need a data source to generate an XML file don't you?
|
|
|
|
|
Something like the content of the following link is what I am trying to do: http://msdn2.microsoft.com/en-us/library/aa302296.aspx[^]
But I wonder if there are better/alternative ways. Today I create the file using the System.Xml.XmlDocument and adding elements and etc, but it is very time consuming. The content I pick up from our database.
/EROI
|
|
|
|
|
eroi wrote: but it is very time consuming.
What is time consuming?
led mike
|
|
|
|
|
Developing, programming, no problem with performance.
|
|
|
|
|
Hi, I need help please! Don'T really know XSLT
I have an HTML code that works:
I try and add it to an xslt file but it moans about the javascript.
Please Anyone Assist!
The existing xslt have an image ALT used as an tooltip, the problem is that the users have lengthy tooltips & the alt dissapears after a few seconds which they don't want.
I found a workaround for a tooltip which works great in HTML now I'm trying to add the code to the xslt but having the problems of the script. Tried CDate but the code turns gray untill the end of the script but other scripts in the xslt is black.
Your can copy this cope directly in HTML and it works, I'm trying to add this anyware in xslt to just to get it going then i will remove the alt & add onmouseover image like the <a>: I tried to highlight th errors i get (red) as i see in my xslt file but in HTML it works fine, with the CDATA its totally gray.
<html>
<head>
<style type="text/css">
#dhtmltooltip{
position: absolute;
width: 150px;
border: 2px solid black;
padding: 2px;
background-color: lightyellow;
visibility: hidden;
z-index: 100;
/*Remove below line to remove shadow. Below line should always appear last within this CSS*/
filter: progid:DXImageTransform.Microsoft.Shadow(color=gray,direction=135);
}
</style>
</head>
<body>
<div id="dhtmltooltip"></div>
<SCRIPT TYPE='text/javascript'>
<!--<![CDATA[ -->
var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}
function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"
//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}
function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip
<!--]]>-->
</SCRIPT>
<tr>
<td>
<a href="ajax.htm" onMouseover="ddrivetip('JavaScriptKit.com JavaScript tutorials','yellow', 300);" onMouseout="hideddrivetip();">?</a>
</td>
</tr>
</body>
</html>
|
|
|
|
|
hi.. if i have a project done in c# and i want to import that into my wpf project ..
i have 3 tabs.. when i open one of the tab.. the c# project display there .. is that possible???
|
|
|
|
|
Hi all,
I am developing an application in VB.Net, which uses XML file to feed configuration information. Application will need different configuration information during run time which needs to be fetched from XML file. Please let me know to achieve this task what will be the best approach:
Deserialization: Deserialize entire XML file into an object, and keep this object in memory during the entire life of application. Get the configuration information form this object property.
Using XPath query: as and when the configuration information is required by the application, it sends a query to XML file to fetch the required information.
Experts, please comment on this.
Thank you,
Regards, Krishnaraj
|
|
|
|
|
Support for using XML files for application settings is provided in the .NET BCL. You have not stated what type of application you have but this might help[^]
|
|
|
|
|
hi i used to use c# to display my uploaded picture
if (openFileDialog_select_picture.ShowDialog() == DialogResult.OK)<br />
{<br />
pictureBox_contact.Image = Image.FromFile(openFileDialog_select_picture.FileName);<br />
<br />
<br />
pictureBox_contact.SizeMode = PictureBoxSizeMode.CenterImage;<br />
pictureBox_contact.BorderStyle = BorderStyle.Fixed3D;<br />
<br />
}
but how do i do that in wpf.. ?
i cant do pictureBox.Image or .SizeMode....
|
|
|
|
|
You will probably have better luck asking this in the C# forum. Even though WPF uses an XML dialect (XAML) this really isn't an XML question per se.
WPF doesn't have a PictureBox control, instead you need to use the Image control and set the Source property. Take a look at this blog post[^] for more information.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
How to get the value of "hw" and "pos", xml file:
<?xml version="1.0" ?>
<Root>
<w c5="NN1" hw="factsheet" pos="SUBST">FACTSHEET </w>
<w c5="DTQ" hw="what" pos="PRON">WHAT </w>
<w c5="VBZ" hw="be" pos="VERB">IS </w>
<w c5="NN1" hw="aids" pos="SUBST">AIDS</w>
<w c5="NN1" hw="aids" pos="SUBST">AIDS </w>
<w c5="VVN-AJ0" hw="acquire" pos="VERB">Acquired </w>
</Root>
Here is a piece of code:
MSXML2::IXMLDOMDocumentPtr pDoc;
HRESULT hr;
hr = pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));
if (FAILED(hr)) {
MessageBox("err");
return;
}
pDoc->load("d:\\a01.xml");
MSXML2::IXMLDOMNodeListPtr pNodeList;
MSXML2::IXMLDOMNode *DOMNode=NULL;
CString strContest;
try {
pNodeList=pDoc->getElementsByTagName("w");
int j=pNodeList->length;
for(int i=0;i<pNodeList->length;++i) {
pNodeList->get_item(i,&DOMNode);
strContest=(LPCSTR)DOMNode->Gettext();
MessageBox(strContest);
}
} catch(_com_error &err) {
CString strErr=(LPCTSTR)err.Description();
MessageBox(strErr);
}
|
|
|
|
|
You have to use the attributes property (i.e the get_attributes method) and then the getNamedItem on the returned NodeMap, check out the C++ sample of the getNamedItem documentation:
http://msdn2.microsoft.com/en-us/library/ms767592.aspx[^]
it does almost exactly what you need (it retrieves an attribute of the documentElement, but the same applies to a standard node).
Please note that you can also do a more intensive use of the smart pointers to make code more concise.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
|
A little more information would be good to get an answer to this, such as what progamming language? For .NET, you can use the XmlDocument class from the System.Xml namespace.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
XML parser
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
I have a newbie question...
I would like to save the format of a text, i thought writing another file to keep all this info but I thought i could do it with a xml file only, but i don't know how to use XML.
How could i do that every time i save a file i can save its format in the xml file?
thanks all
Luis E Tineo S
|
|
|
|