|
It could be much more easy if you go ahead with XSL sort .
|
|
|
|
|
Two questions
I have an xml file which does not contain end tags, Any idea how i can append end tags keeping the parent child relation intact. Sample tags listed below
<parent1>
<tag1></>
<tag2></>
<tag3>
<tag4></>
</>
</>
Anyone has an FPML import app?
|
|
|
|
|
I don't know any FPML import apps.
However, I can answer a question for you: If you have a file with tags that don't contain end tags, then you don't have an XML file.
If you have a half-baked, XML-like file with something like what you have listed in your post, <parent1><tag1></><tag2></>... , then you can do the following:
Initialize a stack
Open an input stream from your file
Open an output stream for the result
While you have not reached the end of the input stream
Read a character
Write the character to the output stream
If the character is "<"
Read the next character
If the character is a letter, then
Keep reading until you reach a ">", saving the characters
Push that string onto a stack
Write that string to the output stream
Else if the character is a "/"
Write a "/" to the output stream
Pop the top string from your stack and write it to the output stream
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I need to use XML with BORLAND C++. How to read data? How to insert data? Please, help me!!!
|
|
|
|
|
|
I need to read a XML file into C#, do som processing on the data and then write it out in a flat text file.
An example of the xml file can be found here[^]
I have played around with XmlTextReader but can't get my head around as to how i get the data into C# in a way so i can use it
|
|
|
|
|
XmlTextReader won't help you processing the Document. Try XmlDocument, or XmlDataDocument.
XmlDocument x = new XmlDocument();
x.Load(@"myfilepath");
then you can use XPath to find nodes, change them, etc.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Could DataSet.ReadXml() be of any use to you?
---
http://sprdsoft.cmar-net.org - We Sprd You Softly
Our site features contents and several images. All of this is very weird.
In the end, war is not about who's right, it's about who's left.
|
|
|
|
|
i got it working using XmlDocument and XPath.
Tnx!
|
|
|
|
|
i am having a XML file and i have to apply differenr stuff on two different tags means if tag1 exists then add
<tag name="1"></tag>
and if tag2 exist then <tag name="2"></tag>
I have tried using
<xsl:if test="tag1">
<tag name="1"></tag>
</xsl:if>
but its not working,plz tell me other way to do this.
Sushant Mathur
Ocwen Financial Sol. Pvt. Ltd,
Bangalore,
INDIA.
-- modified at 8:06 Wednesday 23rd November, 2005
|
|
|
|
|
this should work. Maybe the problem is somewhere else (not test the right node, not the right namespace, etc..)
alternativaly, you can replace this with a matching structure
...
...
<xsl:apply-templates>
...
...
</xsl:template>
<xsl:template match="tag1">
<tag name="1"></tag>
</xsl:template>
<xsl:template match="tag2">
<tag name="2"></tag>
</xsl:template>
Denevers
-- modified at 15:42 Saturday 10th December, 2005
|
|
|
|
|
Does anyone know of a component for .NET that will produce an XML Signature as per the W3C standards: http://www.w3.org/TR/xmldsig-core/[^]
Also, it must be able to run on the .NET Compact Framework.
My: Blog | Photos
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious
|
|
|
|
|
I have an xml file like this:
======================= a.xml====================
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="a.xsl"?>
<cricket>
<player id="1" age="23">
<name prefix="mr">Hung</name>
<catches>250</catches>
<no_100>23</no_100>
<no_50>34</no_50>
</player>
<player id="2" age="24">
<name prefix="mr">Thanh</name>
<catches>234</catches>
<no_100>13</no_100>
<no_50>54</no_50>
</player>
<player id="3" age="25">
<name prefix="ms">Tuan</name>
<catches>432</catches>
<no_100>11</no_100>
<no_50>33</no_50>
</player>
<player id="4" age="20">
<name prefix="mr">Hoa</name>
<catches>333</catches>
<no_100>50</no_100>
<no_50>20</no_50>
</player>
<player id="5" age="21">
<name prefix="ms">Dzuy</name>
<catches>32</catches>
<no_100>34</no_100>
<no_50>26</no_50>
</player>
</cricket>
=================================================
and an xsl to display this xml file like this:
========================== a.xsl =====================
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html>
<head>
<title>Test</title>
</head>
<body>
<table>
<tr>
<th>Player</th>
<th>No. of 50's</th>
<th>No. of 100's</th>
<th>No. of catches</th>
</tr>
<xsl:for-each select="cricket/player" order-by="name">
<tr>
<td><xsl:value-of select="name" /></td>
<td><xsl:value-of select="no_50" /></td>
<td><xsl:value-of select="no_100" /></td>
<td><xsl:value-of select="catches" /></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
=======================================================
The output will be like this:
Player 50's 100's Catches
Dzuy 26 34 32
Hoa 20 50 333
Hung 34 23 250
Thanh 54 13 234
Tuan 33 11 432
Now I would like to display the information of players include the id of them, like this:
ID Player 50's 100's Catches
1 Dzuy 26 34 32
2 Hoa 20 50 333
3 Hung 34 23 250
4 Thanh 54 13 234
5 Tuan 33 11 432
but I dont know how to read the attributes from player element. Any suggestion?
If I want to sort or use if statement depend on attribute (age>23 or id must be under 4 ect...), how to do that?
And how can I read attributes of elements that is read inside for-each statement, for example, attribute prefix of name element
If I want to show total number of players, how to do that?
|
|
|
|
|
<xsl:for-each select="cricket/player" order-by="name">
<tr>
<td><xsl:value-of select="@id" /></td>
.....
</tr>
and by using
<xsl:variable name="get-age" select="@age" />
and then apply IF statements on it.
for more info on using attributes go to this link:
http://www.xml.com/pub/a/2002/04/03/attributes.html
Sushant Mathur
Ocwen Financial Sol. Pvt. Ltd,
Bangalore,
INDIA.
|
|
|
|
|
Dear friends,
I want to bouild a dyanamically changing menu .Please help me on this matter. Help me please. I need a detailed complete prototype for it .
Please reply asap.
Thank you and regards
shaji
|
|
|
|
|
I am presently taking a "Crash Course" on XML in a book with that name. It tells me that in order to show a non-xml file in an XML document, I must declare, in the DTD :
1. an empty element; 2. an entity attribute for that element; 3. an entity declaration including an NDATA clause; 4. a notation, and
in the XML document, 5, an empty element consisting of the entity name and another name='filename'
Another book, XML in a Nutshell calls this way of putting a photo in an XML document "a complicated confusing mistake that should never have been included in XML in the first place" (p. 53), a sentiment that makes good sense to me.
Unfortunately, the Nutshell book neglects to explain a less complicated alternative. Can any of you tell me the most efficient manner of doing this?
DJS8
|
|
|
|
|
Can any one help me regarding Cascading Style Sheets(CSS2.0)
I need a CSS2.0 parser WRITTEN IN C++
please help me
Thanks & Regards
Gaurav Bajaj
|
|
|
|
|
I'm using C# (.NET 2.0 framework)..
Is it possible to force an XML file that doesn't reference an XSD schema to be validated against a specified XSD schema?
Here is a code segment I'm using:
XmlSchema schema = XmlSchema.Read(
new StringReader(MySchemaStringTextBox.Text),
ValidationCallback);
XmlReaderSettings readerSettings = new XmlReaderSettings();
readerSettings.Schemas.Add(schema);
readerSettings.ValidationType = ValidationType.Schema;
readerSettings.ValidationFlags = XmlSchemaValidationFlags.None;
XmlReader configReader = XmlReader.Create(new StringReader(MyXmlTextBox.Text), readerSettings);
XmlDocument config = new XmlDocument();
config.Load(configReader);
config.Validate(new ValidationEventHandler(ValidationCallback));
ValidationCallback never gets called, unless a schema is actually specified in the XML file.
Thanks in advance!
r -€
|
|
|
|
|
when I put an in an xsl file, the whole page becomes blank.
Please show me how to use this in an *.xsl file, or use a ' '(white space)
for example: this code is inside *.xsl file
....
....
|
|
|
|
|
Hey whenever you want to use HTML entities in your XSLT use attribute disable-output-escaping=YES and then & amp; before nbsp;in tag <XSL:text>.
check this as below:
<xsl:text disable-output-escaping="yes">&nbsp;</xsl:text>
Sushant Mathur
Ocwen Financial Sol. Pvt. Ltd,
Bangalore,
INDIA.
|
|
|
|
|
i have a xml looks like this
(?xml version="1.0" encoding="utf-8"?)
(?xml-stylesheet type="text/xsl" href="style.xsl"?)
(EventLog)
(Log Date="11/6/2005")
(Event)11:50:57 PM : Start Monitoring Machine: dunbshy(/Event)
(Event)11:53:54 PM : System is Successfully Loaded(/Event)
(Event)11:53:55 PM : Start Monitoring Machine: dunbshy(/Event)
(/Log)
(Log Date="11/7/2005")
(Event)12:15:33 AM : System is Successfully Loaded(/Event)
(/Log)
(/EventLog)
how do i use xsl to put all those event into a table according the it's Log Date? something liket this:
Date = 11/6/2005
11:50:57 PM : Start Monitoring Machine: dunbshy
11:53:54 PM : System is Successfully Loaded
11:53:55 PM : Start Monitoring Machine: dunbshy
Date = 11/7/2005
12:15:33 AM : System is Successfully Loaded
|
|
|
|
|
Hope this code will work for you...
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="EventLog/Log">
<b>Date =<xsl:value-of select="@*"/></b><br />
<xsl:for-each select="Event">
<xsl:value-of select="."/><br />
</xsl:for-each>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Sushant Mathur
Ocwen Financial Sol. Pvt. Ltd,
Bangalore,
INDIA.
-- modified at 6:23 Monday 14th November, 2005
|
|
|
|
|
I have two different applications one for each company.
These companies are partners and need to interchange data all time betweent their apps.
Could someone give me a Guideline as to what i need to do make these apps. interchange data using XML
Both apps were created in c#
Thanks
Kourvoisier
|
|
|
|
|
- Figure out the information that needs to get exchanged.
- Write a DTD or schema describing the XML document structure that will hold the data to get exchanged.
- Create objects/methods in the two applications to read/write XML documents conforming to the standard that you developed in the last step.
- Figure out how the applications will communicate with one another: files, messages, TCP/IP sockets, etc.
- Implement the ability for the applications to exchange those XML documents over your chosen channel.
- Profit.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I currently have a bunch of XML files that represent different "file types" in my project. For example, one defines the project heirarchy, another defines a template, etc.
When the user chooses to load a new template, I don't want them to try to load in a project definition file by mistake. I only want them to see template files.
My solution thus far has been to define a unique windows extension for each "file type". Eg. ".tmpml" for template, ".prjml" for project, etc. Using a filter in the OpenFileDialog ensures that the user only sees compatible files.
But these aren't real, registered windows extentions and if a user tries to open one up from Windows Explorer, it will not be recognised as an XML file. There also may be conflicts with other applications that may use the same file extension.
Ideally what I'd like to do is to have all these files stored with the standard ".xml" extension, but have a way of differentiating them in the OpenFileDialog.
I can't think of any way to do this short of writing my own OpenFileDialog, but I don't want to go there... Is there any way to write a custom filter that looks at the file contents rather than just the extension?
|
|
|
|