|
I'd suggest using an XML serializable model. You can use it to read and write the file using XmlSerilaizer and just deal with the model, not the XML.
using System;
using System.Xml.Serialization;
namespace XmlEntities {
[XmlRoot("File")]
public class File {
private Language[] element_language;
[XmlElement("language")]
public Language[] Languages {
get { return element_language; }
set { element_language = value; }
}
}
public class Language {
private System.Int32 attribute_id;
private Entry[] element_entry;
[XmlAttribute("id")]
public System.Int32 Id {
get { return attribute_id; }
set { attribute_id = value; }
}
[XmlElement("entry")]
public Entry[] Entries {
get { return element_entry; }
set { element_entry = value; }
}
}
public class Entry {
private System.String attribute_name;
private System.String attribute_value;
[XmlAttribute("name")]
public System.String Name {
get { return attribute_name; }
set { attribute_name = value; }
}
[XmlAttribute("value")]
public System.String Value {
get { return attribute_value; }
set { attribute_value = value; }
}
}
}
Generated from an XML sample with Skeleton Crew 2.0[^] But you can use xsd.exe if you don't mind slop code.
|
|
|
|
|
Hello There
There are two commands in XSL but both are generating Unknown Error (No output) i-e <xsl:import href="C:\External.xsl"> or <xsl:include href="C:\External.xsl">
Can any one guide me how to use External XSL into any other XSL ?
Also if I need to use Some parameters Like Path Of XML File to External.xsl file then what to do ?
|
|
|
|
|
I'm a little unsure about your question. To import another XSL into yours you do something like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:import href="Generic.xsl"/>
<xsl:output method="xml"/>
I put the import in right after the stylesheet node. Then you can use any of the templates from the Generic.xsl sheet.
Logifusion[ ^]
If not entertaining, write your Congressman.
|
|
|
|
|
<xsl:stylesheet extension-element-prefixes="java" xmlns:java="http://xml.apache.org/xslt/java"
version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:variable name="foobar" select="foobar"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="add[@key=Web.Server]">
<xsl:copy>
<xsl:attribute name="key">
<xsl:value-of select="@key"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:text>hello world</xsl:text>
</xsl:attribute>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I am trying to copy the entire web.config file and just change one value attribute to a particular entry. Here copy all, except if the key = web.Server
Please help
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
-- modified at 9:51 Friday 8th September, 2006
|
|
|
|
|
Hi,
I need to parse the following XML file for the nodes that have parent=1
<folders>
<folder>
<id>1</id>
<name>name1</name>
<parent>0</parent>
</folder>
<folder>
<id>2</id>
<name>name2</name>
<parent>1</parent>
</folder>
<folder>
<id>3</id>
<name>name3</name>
<parent>1</parent>
</folder>
</folders>
I tried to do it like this, but nodes has just 1 item instead of 2.
string query = "/folders/folder[parent='1']";
XPathDocument document = new XPathDocument("folders.xml");
XPathNavigator navigator = document.CreateNavigator();
XPathNodeIterator nodes=navigator.Select(query);
Is there a way to do this?
thanx
|
|
|
|
|
There is nothing wrong with your query.
using namespace System;
using namespace System::Xml;
using namespace System::Xml::XPath;
int main(array<System::String ^> ^args)
{
String^ search = L"/folders/folder[parent='1']/id";
XPathDocument^ document = gcnew XPathDocument(".\\folders.xml");
XPathNavigator^ navigator = document->CreateNavigator();
XPathNodeIterator^ nodes = navigator->Select(search);
while(nodes->MoveNext()) {
Console::WriteLine(nodes->Current->Value);
}
return 0;
}
|
|
|
|
|
|
i have this
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
I am trying to copy the xml document line for line.
But it doesnt show the elements. Just the text within them.
I want an exact copy of the file.
Can someone please help
Nick
--------------------------------------------------------
1 line of code equals many bugs. So don't write any!!
My mad coder blog
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
I would like to learn about how to load attributes from a tag from a *.xml to a dropdownlist in HTML file. When I choose an item in this list, the page will sort and show only items in the xml file that related to that attribute.
Can any body help?
Thanks a lot
-------*------
Learn every day...
|
|
|
|
|
What version of MSXML can be used in Windows NT.
I am using this code for XP, using MSXML2.dll it working
<br />
TESTHR(CoInitialize(NULL)); <br />
TESTHR(docPtr.CreateInstance(TEXT("Msxml2.DOMDocument.3.0")));<br />
<br />
_variant_t varXml((_bstr_t)p_xmlFileName.c_str());<br />
_variant_t varOut((bool)TRUE);
But in NT this is not working. What shall I do?
What "Msxml2.DOMDocument.3.0" should it be?
Pradosh
|
|
|
|
|
Pradosh Tapan Datta wrote: What version of MSXML can be used in Windows NT.
What version[^] is installed?
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
Hi all.
Some time before i pass to use VS 2005.But there is one problem.When i edit an xsd file, intelliscensy work not how in VS 7. So three elements appear every time when i begin typed new element (
|
|
|
|
|
Hi,
I have a problem getting the first and second node from a specific xmlnodelist, and display it.
Basically my xml file looks like this
<br />
'Tag means that there is an xml tag<br />
Tag CompanyList:<br />
Tag PrincipalDetail:<br />
Tag Name: John<br />
Tag Surname: Doe<br />
Tag Telephone: 0000<br />
Tag AddressLine: streets<br />
<br />
<br />
Here is my asp.net code<br />
<br />
<code><br />
Dim xmlDoc As XmlDocument = New XmlDocument<br />
xmlDoc.Load("c:\Company.xml")<br />
<br />
'Dim elem As XmlNode = xmlDoc.DocumentElement("PrincipalDetail")<br />
Dim elemList As XmlNodeList = xmlDoc.SelectNodes("/CompanyList/PrincipalDetail")<br />
Dim elem As XmlNode<br />
<br />
Dim nodeLength As Integer = elemList.Count<br />
Dim i As Integer<br />
Dim isValid As Boolean = False<br />
<br />
For i = 0 To nodeLength - 1<br />
If elemList.Count > 0 Then<br />
strInsertXMLToTXT += elemList(0).InnerText<br />
strInsertXMLToTXT += elemList(1).InnerText<br />
strInsertXMLToTXT += elemList(2).InnerText<br />
End If<br />
Next<br />
<br />
What am I doing wrong?
|
|
|
|
|
Hi,
Doing some xml/excel related work at present.
When I try to save my .xls file as .xml (i.e. save as .xml data format), an error message tells me that Excel cannot save the workbook because it does not contain any XML mappings.
This does not occur on other machines.
Any thoughts please?
|
|
|
|
|
Excel cannot save your workbook in the XML Data if you have not created one or more mapped ranges (mapped range: A range in an XML list that has been linked to an element in an XML map.).
If you have added an XML map to your workbook, follow these steps to map XML elements to your worksheet:
On the Data menu, point to XML, and then click XML Source to open the XML Source task pane.
To map one or more elements to your worksheet, select the elements in the XML Source task pane. To select nonadjacent elements, click one element, and then hold down CTRL and click each element.
Drag the selected elements to the worksheet location where you want them to appear.
If you haven't yet added an XML map to your workbook, or if your data is not contained within an XML list, you can instead save your workbook in the XML Spreadsheet file format.
Regards,
Bhupesh.
|
|
|
|
|
Hi,
U refresh ur os. Because the os are supported to all the markup languages. And that refresh ur Ms-Office. That is solution for ur problem.
|
|
|
|
|
from web.config:
<appSettings>
<add key="script" value="..."/>
</appSettings>
the value attribute contains some code.
like most code it contains lots of illegal xml chars < > " , ...
can I mark this attribute with a cdata tag to let the xml parser ignore these invalid chars?
thanks in advance,
Niko
|
|
|
|
|
No. Perhaps you can base64 encode the data?
led mike
|
|
|
|
|
i am jus about to teach myself voiceXML i bought a book about voiceXML and i have completed reading this book and what to start trying some developmnt and gtting my hands dirty.
i was able to get eclipse with a plugin for VoiceXML. an i found a sample video tutorial that shows you how to develop a simple application.
but i am wondering what do i need.
1. i have IIS on my machine but do i need a different webserver like probly apache tomcat and if so are there any specific configurations that i am going to have to do
2. in the video tutorial i saw the guy use a pc to pc(sip) application to simulate the calling into the voiceXML application that he said he exported to his apache. the example on his pc tp pc phone should that it was dialing dbDemo@123.234.0.1...... so i am assuming i need an application like that but i am not sure of the name of any application that could do that
|
|
|
|
|
look at loquendocafe ,to upload voicexml files
Dios creo un equipo perfecto a los demas los lleno de extranjeros
|
|
|
|
|
I'm trying to get a .txt file from another domain using xml object; this file includes special characters like ñ, á, é, í, ó, ú and so on.
The code I'm using is:
Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP")<br />
xml.Open "GET", "http://domain/file.txt", False<br />
xml.Send<br />
If err.number = 0 then filebody = xml.responseText<br />
set xml = nothing
The problem is that all those chars are converted to "?" symbols!
How can I get rid of this thing and get the original characters back?
Thanks a lot 4 your time!
Toby C
(sorry for cross-posting)
|
|
|
|
|
|
Hi.
I have the following element definition in my schema:
<xs:element name="Object">
<!-- must allow all element names and types -->
<xs:complexType mixed="true">
<xs:attribute name="reserved">
<xs:simpleType>
<xs:restriction base="xs:boolean"/>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
when i use an XML that validates with it and tries to define <TEST> element under it, i get an error on validation:
"<TEST> is not allowed under element <Object>"
i want to be able to add ANY element under this one. how can it do that in the schema?
Thanks.
|
|
|
|
|