|
Hi guys!
I'm looking for a way to find out if there's an assembly redirection for a given assembly in an app.config file.
Let's say I have ClassLibrary1 version 1.2.0.0 and I want to find out if my app.config file already contains an assembly redirection for version 1.0.0.0 to 1.1.0.0.
I'm afraid my XPath knowledge is not up to this task - I don't know how to combine conditions from different nodes.
I have this XML snipplet:
<dependentAssembly>
<assemblyIdentity name="ClassLibrary1" publicKeyToken="..." culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
and I want to get the dependentAssembly node with an assemblyIdentity child with @name='ClassLibrary' AND a bindingRedirect child with @oldVersion='1.0.0.0'
Is this possible with XPath and if so, how?
Thanks in advance
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Looks as if I was just missing a small step - I think I can answer my own question
For those interested: An XPath finding only the nodes I wanted is
//assemblyIdentity[@name="ClassLibrary1"]/../bindingRedirect[@oldVersion="1.0.0.0"]/..
Nevertheless - if someone else knows a better way I'm always willing to learn.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I have a question about a SAX parser versus a DOM parser in terms of memory usage...
I know that in terms of memory usage a SAX parser uses significantly less memory because of it's event based nature. However, in this example of a Model based SAX parser (see link below) it looks like this still reads the entire XML document into memory because of the way it creates instances of any classes that it needs to and builds lists of the objects. It seems to me that this would still be reading the entire document into memory like a DOM parser would. I may be wrong of course which is why I'm posting here...
Any insite would be greatly appreciated...
http://www.onjava.com/pub/a/onjava/excerpt/learnjava_23/index2.html?page=1[^]
|
|
|
|
|
Josh Owen wrote: However, in this example of a Model based SAX parser
Josh Owen wrote: It seems to me that this would still be reading the entire document into memory like a DOM parser would.
The example may well be doing that, but that is not the authors point, this is:
What may be harder to see is how one could use SAX to build a real Java object model from an XML document.
His example is how one could use a the SAX Parser to serialize the XML into a Java Object Model. What that model might be is completely up to you, and therefore does not have to be the entire document. Neither would it have to represent the XML, Node Types and Names etc., but rather your objects.
Was that what you were asking?
|
|
|
|
|
Sure I understand that his point is to show how to build a Java Object Model using the SAX parser but my question is that he says this:
"The primary motivation for using SAX instead of the higher-level APIs that we'll discuss later is that it is lightweight and event-driven. SAX doesn't require maintaining the entire document in memory."
Then goes on to give that example when I'm fairly certain that example uses the same amount of memory a DOM parser would. But I may be wrong? So that's what I am trying to clarify. Do you think that example does actually use the same amount of memory as a DOM parser would?
Thanks for the quick response...
|
|
|
|
|
Josh Owen wrote: Do you think that example does actually use the same amount of memory as a DOM parser would?
I don't know, it is certainly possible. I don't understand the significance of that. The authors point, and it is a well known one, is that SAX parsers use less memory and are faster than DOM parsers. I have never studied the implementation of these parsers but the significant difference is that a DOM parser generates a DOM where a SAX parser does not. It is this generation of a DOM that consumes so much more memory and requires more processor instructions.
However if you use a SAX parser to create the same information as a Document Object Model does then you would be re-creating the DOM parser scenario at which point there is no benefit in using SAX. The authors point is, if your model does not need the entire document structure then using SAX to generate your own model will be faster (and use less memory) than generating a DOM and pulling the information out of it to build your model.
Does that help?
|
|
|
|
|
Thanks, yeah I have no issue with what the author's point is. I understand what the differences between SAX and DOM are. I was going to recreate a DOM parser I had created as a SAX parser but I need the ability to jump around a little bit which is why I was going to use this Java Object Model. But once I started reading about it I was thinking that this may all be for naught because even though I'm using SAX it is stil storing everything in memory and therefore using the same amount of memory as a DOM parser.
Thanks for the response
|
|
|
|
|
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
|
|
|
|