|
Hi,
I have included the degree symbol in a xml file using ° and now i need to parse the contents in the xml file into a html file. After parsing the special character (°) is displayed as ° in html file.
Vb code used for parsing:
-------------------------
dim xmldom
Set xmldom = CreateObject("Msxml2.DOMDocument.4.0")
xmldom.load "C:\Tmp\sample.xml"
If not xmldom is nothing then
xmldom.save "C:\Tmp\sample.htm"
msgbox "Html file written"
End If
Could any one help why the degree symbol is not get included in the html file correctly ?
|
|
|
|
|
|
Hi,
I have included the degree symbol in a xml file using ° and now i need to parse the contents in the xml file into a html file. After parsing the special character (°) is displayed as ° in html file.
Vb code used for parsing:
-------------------------
dim xmldom
Set xmldom = CreateObject("Msxml2.DOMDocument.4.0")
xmldom.load "C:\Tmp\sample.xml"
If not xmldom is nothing then
xmldom.save "C:\Tmp\sample.htm"
msgbox "Html file written"
End If
sample.xml file
----------------
<root>
<specialc>°
Could any one help why the degree symbol is not get included in the html file correctly ?
|
|
|
|
|
In order to include the degree symbol in your XML document, it can be represented as ° .
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Sorry, forgot to tick the ignore HTML box:
Can I get the special xml strings (< & etc) directly instead of being translated?
For example, given the data "<data>RCI></data>", the code:
xmlReader.ReadStartElement("DATA");
data = xmlReader.ReadString();
xmlReader.ReadEndElement();
Gives: "RCI>". Can I get the raw "RCI>" and if so, how?
Thanks
|
|
|
|
|
Try this u will get "RCI>"
xmlReader.ReadInnerXml()
|
|
|
|
|
pass each string in the following function, and you will always get the right result:
Public Function MakeXMLString(ByVal text As String) As String
text = text.Replace("&", "&")
text = text.Replace("'", "'")
text = text.Replace("""", """)
text = text.Replace("<", "<")
text = text.Replace(">", ">")
Return text
End Function
good luck!
|
|
|
|
|
Let say I have this:
<td id="manufacturer{generate-id(model)}"><xsl:value-of select="manufacturer"/> </td>
<td><a href="#" onclick="AddRemoveItem('Add',{generate-id(model)});" >Add</a></td>
The {generate-id(model)} inside AddRemoveItem() function does not appear. Am I putting it wrongly?
|
|
|
|
|
I read somewhere I could pass parameter like this:
$manufacturer = $_POST['manufacturer'];
$cameraType = $_POST['camType'];
$priceRange = $_POST['priceRange'];
$params = array('maker' => $manufacturer,'camType' => $cameraType,'pRange' => $priceRange);
$xsltTransformer=xslt_create();
$htmlOutput=xslt_process($xsltTransformer,"camera.xml","camera.xsl", NULL, array(), $params);
xslt_free($xsltTransformer);
or
$htmlOutput=xslt_process($xsltTransformer,"camera.xml","camera.xsl", $params);
and my xslt will have this:
< xsl:param name="maker">All< /xsl:param>
..so on
Which doesnt work and return always 'All'. I am using Sablotron library for transformation.
How can I pass parameter correctly?
|
|
|
|
|
Hello,
My application receives XML files from users submitted via web. It then reads and loads them in the SQL Server database using a C# routine. The file sizes are like 2/3 megabytes. The web validation (XML schema and other checks like existence of valid data ids etc.) takes long - sometimes 30 sec to 1 min.
What would be a better way to improve performance - possibly not using this C# parser?
I would highly appreciate ideas.
Thanks.
|
|
|
|
|
|
Thanks Mike. It'll be helpful.
|
|
|
|
|
Hello,
I'm using C# 2008 to create XML files where some elements have null text values, as shown in the following code.
nodeUnderTest.InnerText = "";
The problem is that the end tag is being placed on the following line, as shown below where nodeUnderTest is <test>:
<pre><something>
<test>
</test>
</something></pre>
Using C#, how can I force the start and end XML tags to either appear on the same line or merged as shown below?
<test></test>
<test />
Thanks,
Grant
modified on Monday, April 20, 2009 4:01 PM
<div class="ForumMod">modified on Monday, April 20, 2009 4:03 PM</div>
|
|
|
|
|
Don't set the nodeUnderTest.InnerText at all. Just create the element. Also, nodeUnderTest.InnerText=""; is being set to an empty string and not a null value.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
When I set nodeUnderTest.InnerText = null, the start and end tags were once again placed on separate lines.
When I commented out the nodeUnderTest.InnerText line, it placed the tags on the same line, but they were separated by a single space.
I still need to determine how to either force the tags to be appear on the same line with no space in between or as the shortened version <test /> where the start and end tags are inclusive.
Thanks.
|
|
|
|
|
Post some code to show what you are doing.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
I have an application that displays a treeview with the following structure:
+ TreeRoot
+-+ Heading
| +-+ DataElement
| +-+ DataElement
| +-+ Heading
| +-+ DataElement
| +-+ DataElement
+-+ Heading
| +-+ DataElement
. . .
Note the data order is important and must be preserved.
I have stored this in a XML file like this.
<root>
<heading>
<dataelement>First data<\ DataElement>
<dataelement>Second data<\ DateElement>
<heading>
<dataelement>First nested data<\ DataElement>
<dataelement>Second nested data<\ DataElement>
<\ heading>
<\heading>
<heading>
<dataelement>data<\DataElement>
<\heading>
. . .
<\root>
I am able to read and writhe this data to and from the tree and update the xml file.
However I am not able to describe this structure in a Schema.
Is there a method that would be univerally portable to keep this structure.
I would prefer not to use H1, H2, H3 . . . method for the nested headers.
Thanks for the help.
|
|
|
|
|
let say I have this:
<books>
<book>
<title genre="non-fiction">Objects First With Java- A Practical Introduction Using Bluej </title>
<author>David J. Barnes</author>
<author>Michael Kolling</author>
<publisher>Pearson Prentice Hall</publisher>
<year>2006</year>
<price>49</price>
</book>
<book>
<title genre="fiction">Harry Potter and the Half-Blood Prince</title>
<author>J. K. Rowling</author>
<publisher>Thorndike Press</publisher>
<year>2005</year>
<price>29</price>
</book>
</books>
and I want to sum the price if the title genre is fiction and book price is less than 30 (I should have more books for this but will add later).
currently I read somewhere I came up with this:
<xsl:value-of select="sum(/books/book/title[@genre='fiction']/price[number(text())<30])" />
or this:
<xsl:value-of select="sum(/books/book[title[@genre='fiction']]/price[number(text())<30])" />
but it seems I still cant get it right. Anyone could help where I did wrong?
Edited:
I found the problem that I should use '& lt;30' instead of <30. I believe I did use lt before asking.
Anyway, why the< b r / > in my xsl file does not work in FireFox but it is fine with IE?
Many thanks.
modified on Friday, April 17, 2009 8:28 AM
|
|
|
|
|
You were almost there with your second effort:
sum(/books/book[title[@genre = 'fiction']]/price[. < 30])
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Using dot .& lt;30 seems to be working too and less confusing instead of number(text()).
Thanks for your reply.
|
|
|
|
|
Hello,
I'd like to make a project that has DOM support. I'm thinking of using Xerces. What I'd like too is to have a API to access the same DOM implementation both in C++ and JAVA..... I mean, some apps will use it through C++, others in Java, while the rest of the library will be C++. Is Xerces a good solution for that? As I see there are both Java and C++ bindings, will this help achieve what I need?
|
|
|
|
|
AFAIK the two Xerces (C++/Java) implementations are completely separate. It sounds like you have read something that says they are one implementation, could you supply a link to that?
gotchagotcha wrote: What I'd like too is to have a API to access the same DOM implementation both in C++ and JAVA
Why? The whole point is that the DOM is the standard and therefore the API's are mostly identical. Designing your applications with a DAL probably provides a much larger benefit than sharing a DOM implementation.
Also to use native code from Java requires the use of JNI so you can't directly utilize a C++ anything by writing pure Java code. Anyway if you are bent on doing this I suppose you could provide the JNI wrappers for the C++ Xerces DOM. It seems pointless to me but whatever.
|
|
|
|
|
Hi All,
I am writing the following code
"<a href="{@FileRef}" > <xsl:value-of select="@Title" />
</a>"
The problem is that my "FileRef" contains special character in it (like test's.aspx, the single quotes in it).In the browser the URL is shown as
test's.aspx.
Is there any work around for this.
I don't know how to handle the unsafe character in xslt.
Thanks in Advance
Alok....
modified on Wednesday, April 15, 2009 10:39 AM
<div class="ForumMod">modified on Wednesday, April 15, 2009 10:43 AM</div>
|
|
|
|
|
IMHO, I would avoid using "special" characters and white space in a URL since it always gets URL-encoded. In your case, the single quote will be change to %28 . Besides, since XSLT is really XML, you can use " instead of ' . Please note that you can place characters such as a single quote in CDATA sections!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
please help me....
how can i convert data set to xml according to my DTD
R RajaGuru
|
|
|
|