|
Hello,
I got the following in my XML Settings file:
<configuration>
<appSettings>
<add key="CAPTURE_DEVICE" value="@device:pnp:\\? pci#ven_109e&dev_036e&subsys_13eb0070&rev_11#4&1b02cb0b&0&10f0#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global" />
</appSettings>
</configuration>
I want to read the value of the capture device from the xml file into a string variable. But due to the "&" the value = "...." doesnt seem to be a valid string. Is there a way to handle this?
thx in advance,
best regards
dominik
|
|
|
|
|
& has to be escaped as &
|
|
|
|
|
It's a good thing he came here to find that out. It's not like there is a freely available documented standard on the internet that contains that information... wait
|
|
|
|
|
Thanks for your answer!
But is there a way to get a valid string without manually editing the original string and replacing every & with &amp;?
regards
Dominik
-- modified at 4:29 Friday 27th July, 2007
|
|
|
|
|
No because having an unescaped & is what makes it invalid XML.
|
|
|
|
|
Hi,
I am a newer to XML and Visual C++.
Could You please say, How is the Data from XML file is read/ or written to through Visual C++ program??
Gyan
|
|
|
|
|
There are two Microsoft solutions: MSXML and XmlLite. You can find documentation and samples on http://msdn2.microsoft.com/en-us/default.aspx[^] or just use a search engine such as Google.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Can Some please help me.
How can we update a value which has the same parameter name in the same section using vc++
<rootelement>
<param1>Param Value
<param1>Param Value
<rootelement>
Now i want to update both the param values but both the parameters has the same parameter name. So how can we update these values??
Thanks
|
|
|
|
|
You can use document order. To locate the first "Param1" element, the XPath is: /RootElement/Param1[1] and the second is: /RootElement/Param1[2] .
George
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi,
well I\m a completely newbie in XML and I've been given a task to put a filtering capability on an XML document in .NET application. So I'm looking at XPath for that. Now I wanna populate a combo box with all the names of the XML elements i.e tags so that I can populate the treeView on that basis.
Now to populate that combobox I was thinking if I can make an XPath Query that can give me the unique namesof the tags. Is this possible that way or do I have to get all teh elements first and then filter out the unique ones
thanks in advance
Rocky
|
|
|
|
|
Say I have this XML Document:
<?xml version="1.0" encoding="UTF-16"?>
<?xml-stylesheet type="text/xsl" href="MyXsl.xsl"?>
<page>
<para>
Test paragraph.
</para>
<para>
Test <link href="codeproject.com">link</link>.
</para>
</page>
In XSLT, how would you change <link href into <a href ?
I have this so far...
<xsl:template match="/">
...
<xsl:for-each select="//para">
<xsl:call-template name="paragraph"/>
</xsl:for-each>
...
</xsl:template>
<xsl:template match="//para" name="paragraph">
<p>
<xsl:value-of select="."/>
</p>
</xsl:template>
Thanks! I've tried Google, but couldn't find anything useful.
|
|
|
|
|
I hope the following will give you some ideas:
<?xml version="1.0"?>
<page>
<para>
Test paragraph
</para>
<para>
A good place to find source code is <link href="http://www.codeproject.com">CodeProject</link>
</para>
</page>
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/page">
<xsl:apply-templates select="para"/>
</xsl:template>
<xsl:template match="para">
<p><xsl:apply-templates select="child::text() | link"/></p>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="."/>
</xsl:template>
<xsl:template match="link">
<a href="{@href}"><xsl:value-of select="."/></a>
</xsl:template>
</xsl:stylesheet>
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
|
Hi,
Is it possible to read a xml schema file (.xsd) and generate the xml file based on that schema file? if so, could you please give me the sample code in VB.NET that can do this?
Thanks,
sridhar.
|
|
|
|
|
I have extracted some Outlook contacts to Access table and I now I want to create a xml document that has the below structure.
I'm thinking of loading the data to a recordset and then to stream it to an XML document. The problem is how could I define the structure I need for my xml document. Could the xml Microsoft XMLDOM object have as parameter a xml style sheet file....or what?
Thank you
Leonidas Kallis
KundenListe>
Kunde>
KundenDaten>
Anschrift>
AdrAnrede s="Κύριος"/>
AdrName s="Παππας"/>
AdrVorname1 s="Ιωάννης"/>
AdrStadt s="Δρυός"/>
AdrPostfach s="234242"/>
AdrTel1 s="210 4428686"/>
AdrLand s="GR"/>
AdrPlz s="84400"/>
/Kunde>
/KundenDaten>
Kunde>
KundenDaten>
Anschrift>
AdrAnrede s="Κυρία"/>
AdrName s="Τρίμμη"/>
AdrVorname1 s="Αγαθή"/>
AdrStrasse s="Γαμβέττα 43"/>
AdrStadt s="Θεσσαλονίκη"/>
AdrTel1 s="2310 677933"/>
AdrTel2 s="697 χχχ χχχχχ"/>
AdrTelefax s="2310 988290"/>
AdrLand s="GR"/>
/Kunde>
/KundenDaten>
/KundenListe>
-- modified at 4:15 Tuesday 24th July, 2007
|
|
|
|
|
Hi guys - i have a schema which i would like to use to generate an empty node hierachy. Currently the way the system operates is to have an initial hierachy, and the first node in each collection is the template node, which is then cloned and the result used as the new instance. This approach is causing maintainability problems however.
I have the schema, so i know what should be in the node. I just want to create a node from it.
Does anyone know how this can be done?
cheers
Tris
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
Hi,
How can i create XML file using MSXML DOM node.
Regards
|
|
|
|
|
you can use xmldocument to create the xml file.
All The Best
Sathesh Pandian
|
|
|
|
|
Hi,
Dim dom As New Xml.XmlDocument
dom.LoadXml("<root>")
Dim root As Xml.XmlElement = dom.DocumentElement
Dim Elem As Xml.XmlNode = dom.CreateNode(Xml.XmlNodeType.Element, "item", "")
Elem.InnerText = "XYZ"
root.AppendChild(Elem)
MsgBox(dom.DocumentElement.OuterXml)
dom.Save("dom.xml")
for more details go to http://msdn2.microsoft.com/en-us/library/system.xml.xmldocument.aspx[^]
hope this helps
|
|
|
|
|
I am trying to remove some unwanted elements from a source XML document using XSLT and JAXP and create a new XML document in which those unwanted elements are not present. My XSLT works fine and removes the desired elements when there is no XMLNS attribute defined in root node of XML document. But the same java code & XSLT doesn't removes those elements when XMLNS attribute is set in root node of source XML document.
In following example, I am trying to remove "outstation" elements from XML doc.
Sample XML:
<?xml version="1.0" encoding="UTF-8"?>
<Contacts version="110000000" xmlns="http://www.contacts.com/transform">
<Messenger>
<yahoo>
<id name="abc">abc21@yahoo.com</id>
<id name="xyz">xyz21@yahoo.co.in</id>
</yahoo>
<msn>
<id name="abc">abc21@hotmail.com</id>
<id name="xyz">xyz21@msn.com</id>
</msn>
</Messenger>
<Phone>
<local>
<no name="abc">12345678</no>
<no name="xyz">12345670</no>
</local>
<outstation>
<no name="abc" country="india">08012345678</no>
<no name="xyz" country="india">08012345670</no>
</outstation>
</Phone>
</Contacts>
Sample XSLT:
<?xml version = '1.0' encoding = 'UTF-8'?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding ='UTF-8' indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="outstation">
</xsl:template>
</xsl:transform>
Java code snippet:
public static void main(String[] args) throws Exception
{
....
....
Source xmlSource = new StreamSource(srcFile);
Source xsltSource = new StreamSource(xsltFile);
StreamResult result = new StreamResult(resFile);
TransformerFactory transFact =
TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer(xsltSource);
trans.transform(xmlSource, result);
...
...
}
Is there anyway to solve this problem, other than using DOM?
-- modified at 8:59 Wednesday 18th July, 2007
|
|
|
|
|
Well strangely I am reply to my posted query ..
In the given example, it is expected that template in the XSLT, <xsl:template match="outstation"> </xsl:template>, should remove all occurrence of "outstation" elements from the XML document.
This XSLT will work fine for any XML document which doesn't has a "DEFAULT NAMESPACE" declared in root element. In given example, I have declared a default namespace in root element as 'xmlns="http://www.contacts.com/transform"'. Because of the default namespace, the expanded name of element is pair of URI name and Element name (URI name here is "http://www.contacts.com/transform"). So the template defined in XSLT for "outstation" element will fail to match any <outstation> element in XML file.
As the namespaces link the XML & XSLT through a URI. So the solution to this problem is to add a namespace prefix with the namespace name "http://www.contacts.com/transform" in the xslt file and then use the prefix in the XPath statements as shown below:
Solution is in XSLT:
<?xml version = '1.0' encoding = 'UTF-8'?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:txf="http://www.contacts.com/transform">
...
...
...
<xsl:template match="txf:outstation">
</xsl:template>
</xsl:transform>
|
|
|
|
|
please tell me how to compile or convert html to XML. Please tell me How compilation differs from convert. Thanks
|
|
|
|
|
I don't understand exactly what you are talking about? Nevertheless, HTML and XML are related markup languages and are usually text files. XHTML is a strict form of HTML since it obeys an XML type-schema. Once you have your document in XHTML, you can transform it to another XML document using XSLT.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hi,
Im quite new to xpath in .Net. I have an XML-structure shown below that contain measurements(diameters,areas etc) The one below includes two different measurements of an Bi diameter and also the mean value. I now want to extract the mean value.(the <value>5.0</value> tag.
As mentioned ,the file consists of many different measurements using the same strucutre. With the following expression I manage to extract the value but then I also get all the following mean values from all of the other calculations. How do I extract ONLY that node. I would really appriciate some help thanks!
Expression:
//item/item/concept[@codValue='11820-8']/following-sibling::item/value[@codValue='R-00317']/following::value
<item valType="CONTAINER">
<concept codValue="125005"> MeasureGroup</concept>
<item valType="NUM" relType="CONTAINS">
<concept codValue="11820-8">Bi Diameter</concept>
<value>4.9</value>
</item>
<item valType="NUM">
<concept codValue="11820-8">Bi Diameter</concept>
<value>5.1</value>
</item>
<item valType="NUM">
<concept codValue="11820-8">Bi Diameter</concept>
<item valType="CODE">
<value codValue="R-00317">Mean</value>
</item>
<value>5.0</value>
</item>
</item>
|
|
|
|
|
I hope this works:
/item/item[item/value[@codValue='R-00317']]/value
or
/item/item[item/value='Mean']/value
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|