|
Yep. You can bet I immediately looked up <xsl:element> and its related tags on MSDN as soon as I saw this! Thanks again!
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
or even
<xsl:choose><br />
<xsl:when test="test"><br />
<b>Your Content</b><br />
</xsl:when><br />
<xsl:otherwise>Your Content</xsl:otherwise></xsl:choose>
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
I did say 'the politically correct way'....;P
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
This is precicsely what I was trying to avoid.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
an even better way would be (xhtml & css2):
<span><br />
<xsl:if test="test"><br />
<xsl:attribute name="style">font-weight: bold</xsl:attribute><br />
</xsl:if><br />
Your Content<br />
</span>
hope this helps
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Yep. That's what I'm doing. Thanks!
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
|
sorry.. this is the XML example
<node><br />
<a ..../><br />
<c ..../><br />
<c ..../><br />
<a ..../><br />
<a ..../><br />
<a ..../><br />
<d ..../><br />
<d ..../><br />
</node>
|
|
|
|
|
<node>
<a ..../>
<c ..../>
<c ..../>
<a ..../>
<a ..../>
<a ..../>
<d ..../>
<d ..../>
</node>
|
|
|
|
|
node.selectNodes("*/*[name() != '" + myVar + "']").length
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Does anyone know how to put a carriage return/linefeed sequence in an XML quoted string? I tried
&
&
<br/> , etc. Help would be much appreciated.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
An quoted string can have carriage returns. There is no escaping sequence for it, so that's why
etc. don't do anything.
To answer your question, I need to know if you are just editing an Xml file by hand, or trying to tweak an xml file writer.
If you are editing by hand, then just add carriage returns. It's compatible with the Xml snytax rules.
Otherwise, depending on the language you are using to generate the xml file, make sure to add \r and\n to exported strings.
|
|
|
|
|
This is what I had thought, but when I do it that way, my whole XML file's display goes nuts.
I am just doing an XML file by hand with an XSLT transform.
Thanks for your help!
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Can i change the msxml parser version that internt explorer use to load the xml document? if yes, how?
eg. IE6.0 use MSXML3.0 SP2, how can i force it to use other version, like MSXML4.0?
|
|
|
|
|
There are two ways to use xml in Internet Explorer
- loading a document with .xml as file extension. The MSXML parser version used to parse the xml file, transform it using a xslt stylesheet, is hardcoded. You must upgrade Internet Explorer to use a different MSXML parser.
- writing JScript/VBScript code to create a COM instance of the MSXML parser within a web page. Since it's up to you to pass the progid of this object, you can choose whichever MSXML parser that might be installed. For instance, "Msxml2.DOMDocument.4.0" instead of "Microsoft.XmlDOM".
A sample JScript[^] code.
|
|
|
|
|
I was building the following code and I get this error,
"The call is ambiguous between the following methods or properties: 'string.String(char[])' and 'string.String(sbyte*)'"
FileStream strmSettings;
XmlDocument xmlDoc = new XmlDocument();
XmlNode nSetting;
string filePath =new String(null);
strmSettings = File.Open("options.xml", FileMode.Open);
xmlDoc.Load(strmSettings);
nSetting = xmlDoc.SelectSingleNode("/options");
if(nSetting != null)
filePath = nSetting.InnerText;
strmSettings.Close();
string fileName = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";
XmlTextWriter writer = new XmlTextWriter(filePath + fileName, null);
What does this non sense mean?
/\ |_ E X E GG
|
|
|
|
|
This is the line that does it:
string filePath =new String(null);
There are many different versions (overloads) of the String constructor, each of which take different arguments. The compiler can't figure out which one to use.
Either do:
string filePath = "";
OR
string filePath =new String();
OR
string filePath;
The way you have it, compiler can't figure out whether it's (char)null or (sbyte)null.
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
I've got it under control now... thanks...
/\ |_ E X E GG
|
|
|
|
|
string filePath = null;
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Ok, so I've got this little C# app that updates my asp.net weblog. I plan on passing it on to other people I know, but then I came across a problem...
The files are outputted to the "entries" folder (name by the year, month, day, hour, minute, but thats irrelivant...) located on my hard drive in... (the location is in bold below). So, my problem was that, what if they wanted to change the location of the entries folder... you know... export the files somewhere else on the hard drive.
string fileName = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";<br />
XmlTextWriter writer = new XmlTextWriter("<big>C:/inetpub/wwwroot/weblog/entries</big>/"+ fileName, null);
SO, then I put togeather a little options form (options.cs) with a text box to enter the location on the drive, and then you click 'OK' and then it is saved to "options.xml". (see the code below...)
private void buttonOK_Click(object sender, System.EventArgs e)<br />
{<br />
XmlTextWriter writer=new XmlTextWriter("options.xml", null);<br />
writer.Formatting=Formatting.Indented;<br />
writer.WriteStartDocument();<br />
writer.WriteStartElement("Options");<br />
{<br />
string entryFile=textBoxEntryFile.Text;<br />
writer.WriteStartElement("entryFile");<br />
writer.WriteString(entryFile);<br />
writer.WriteEndElement();<br />
}<br />
writer.WriteEndElement();<br />
writer.WriteEndDocument();<br />
writer.Close();<br />
Form.ActiveForm.Close();<br />
<br />
}
This is what the options.xml file looks like....
?xml version="1.0"?><br />
<Options><br />
<entryFile>C:\inetpub\wwwroot\weblog\entrys\</entryFile><br />
</Options>
Now, I need this...
XmlTextWriter writer = new XmlTextWriter("<big>C:/inetpub/wwwroot/weblog/entries</big>/"+ fileName, null);
...instead of saveing it evertime.... unconfigurable.... to "C:/inetpub/wwwroot/weblog/entries", but rather save the entries to what ever file it says in the "options.xml" file.
WHEW!... i hope that made sense... im not familar with the XmlTextReader (assuming that what is to be used...) stuff... thanks for all the help possible.
/\ |_ E X E GG
|
|
|
|
|
So what do you not know about this? How to write it to XML?
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
uh... i want change the following code...
XmlTextWriter writer = new XmlTextWriter("C:/inetpub/wwwroot/weblog/entries/"+ fileName, null);
you see.... the bolded path... that's static... you can't change it, unless you edit the code in vs.net...
Now, I want it to get the path from an xml file, I already made(options.xml)... it looks like this...
<xml version blah blah blah...><br />
<path>path goes here</path>
do you think you can help?
/\ |_ E X E GG
|
|
|
|
|
private System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
xml.Load("url");
<br/>
System.Xml.XmlNode xmlnode = xml.SelectSingleNode("descendant::root/path");
<br>
XmlTextWriter writer = new XmlTextWriter(xmlnode.InnerText + fileName, null);
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|
|
Is this right?
System.Xml.XmlDocument xml = new System.Xml.XmlDocument();<br />
xml.Load("C:/Documents and Settings/Alex Egg/Desktop/Visual Studio Projects/RecordTimesheets/bin/Debug/options.xml"); <br />
<br />
System.Xml.XmlNode xmlnode = xml.SelectSingleNode("descendant::root/path"); <br />
<br />
string fileName = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";<br />
XmlTextWriter writer = new XmlTextWriter(xmlnode.InnerText + fileName, null);
isim not sure what this is about ("descendant::root/path");
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote:
xml.Load("C:/Documents and Settings/Alex Egg/Desktop/Visual Studio Projects/RecordTimesheets/bin/Debug/options.xml");
But then you are hard-coding this path. Maybe you can keep the XML file in the assembly path.
eggie5 wrote:
I don't get this part....
//get the xml path
//where root is the root element
System.Xml.XmlNode xmlnode = xml.SelectSingleNode("descendant::root/path");
here you are getting a node named "path" which is a child of the node named "root". The "descendant::" means you're starting from the top, and the path after "descendant::" specifies the path of the node you want to get.
***************[XML file section]*********************
<root>
<path>c:\somefolder\…</path>
</root>
***************[/XML file section]*********************
"Do unto others as you would have them do unto you." - Jesus
"An eye for an eye only makes the whole world blind." - Mahatma Gandhi
|
|
|
|