|
|
Well the thing is it is proper XML, it's just not very suitable for converting to HTML.
Get the sender to fix it. Or pass it through a filter of some sort.
|
|
|
|
|
HTML5 now makes the quotes around the attribute optional. It seems like a good idea, because they're just bloating the file most of the time. Of coarse, it's not official xml then, but who cares if it's just an internal file.
|
|
|
|
|
i was mading xml file for rss.
but I can see only 3 elements in rss reader program.
what is problem?
I think that xml format is fine.
="1.0"
<rss version="2.0">
<channel>
<title>회사명</title>
<link >http://nhn.com</link >
<language >ko</language >
<copyright >Copyright (c) by KoreaZinc, Inc. All rights reserved</copyright >
<pubDate >2011-08-08 오전 10:36:09</pubDate >
<lastBuildDate >2011-08-08 오전 10:36:09</lastBuildDate >
<description >회사명 보도자료 Rss 입니다.</description >
<image>
<title>회사명 보도자료 소식</title>
<url>http://nhn.com</url>
<link>http://nhn.com</link>
</image>
<item>
<title>회사명 회장</title>
<link>http://naver.com</link>
<description>출처:한국경재 회사명 회장</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>회사명 창업</title>
<link>http://daum.net</link>
<description>출처:메일신문 회사명 창업</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>1</title>
<link>http://daum.net</link>
<description>출처:메일신문1 1</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>2</title>
<link>http://daum.net</link>
<description>출처:2 2</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>3</title>
<link>http://daum.net</link>
<description>출처:3 3</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>4</title>
<link>http://daum.net</link>
<description>출처:4 4</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>5</title>
<link>http://daum.net</link>
<description>출처:5 5</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>6</title>
<link>http://daum.net</link>
<description>출처:6 6</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>7</title>
<link>http://daum.net</link>
<description>출처:7 7</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>8</title>
<link>http://daum.net</link>
<description>출처:8 8</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>9</title>
<link>http://daum.net</link>
<description>출처:9 9</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
<item>
<title>10</title>
<link>http://daum.net</link>
<description>출처:10 10</description>
<author > </author >
<pubDate>2011-08-08T10:34:42+09:00</pubDate>
</item>
</channel>
</rss>
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
This is a long shot, but could it have anything to do with you mixing the fonts? Note that there happen to be 3 items before the titles switch to Roman/ASCII characters.
Barring that possibility, perhaps if you indicate which 3 items are showing, that would help.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Hi
I know I have seen this somewhere before, but I cannot find it again. I need an example of calling an xsd file from within another xsd. This is quite useful where a number for xml files are being generated, but where there is large common areas between these xml files being validated. In that scenario, it is useful to have an xsd that validates the parts common to all xml files, then have separate smaller xsd validation files for the parts of the xml that are specific to each xml file.
Thanks
|
|
|
|
|
Try something like:
<xs:import namespace="http://myNamespaces/types" schemaLocation="types.xsd" />
Ger
|
|
|
|
|
I use an xslt in order to "translate" an xml file which includes HTML fields:
<xsl:for-each select="$currentPage/*">
<xsl:sort select="order">
<li class="item">
<xsl:if test="self::BasicContent">
<h2><xsl:value-of select="@nodeName"/></h2>
<xsl:value-of select="text"/>
</xsl:if>
......
......
the text field is html field and it's displayed in the browser like this:
<p>texttexttexttexttext</p>
What should I do in order to make it being displayed as the following:
texttexttexttexttext
???
|
|
|
|
|
i all,
now i want to work with XML file in my dialog based application,please help me to create a xml file that contains some details about application and please help me how to read and update this xml file in my application.
i have no idea about XML file.
if possible please provide me any sample or example fot this.
i am waiting for ur valuable suggestions.
please help me for this.
thanks in advance.
|
|
|
|
|
Please don't cross post; enter your question in one forum only.
The best things in life are not things.
|
|
|
|
|
I am receiving an XML file with data like below;
<meterref>00895289</meterref>
<readingdate>14/12/10</readingdate>
<reading>2</reading>
<readingdate>28/09/10</readingdate>
<reading>0</reading>
<readingdate>23/08/10</readingdate>
<reading>0</reading>
<readingdate>02/03/10</readingdate>
<reading>9</reading>
<meterref>00895298</meterref>
<readingdate>02/12/10</readingdate>
<reading>275</reading>
<readingdate>22/09/10</readingdate>
<reading>274</reading>
<readingdate>02/06/10</readingdate>
<reading>274</reading>
<readingdate>02/03/10</readingdate>
<reading>274</reading>
<meterref>00895995</meterref>
<readingdate>02/12/10</readingdate>
<reading>425</reading>
<readingdate>22/09/10</readingdate>
<reading>420</reading>
<readingdate>02/06/10</readingdate>
<reading>411</reading>
<readingdate>02/03/10</readingdate>
<reading>404</reading>
<meterref>00896005</meterref>
<readingdate>02/12/10</readingdate>
<reading>185</reading>
<readingdate>22/09/10</readingdate>
<reading>182</reading>
<readingdate>02/06/10</readingdate>
<reading>178</reading>
<readingdate>02/03/10</readingdate>
<reading>174</reading>
Now obviously I can read down from the top and see which readings go with which meter. I think that xsl cannot easily do that.
So my question is, can I work with this data without too much messing about, or should I just go to the provider of the xml and tell them to do it properly?
Thanks in advance for any help or advice.
Every man can tell how many goats or sheep he possesses, but not how many friends.
|
|
|
|
|
Although the example you gave does not exploit XML to its fullest potential, it's a welcome departure from entirely unmarked text files with pipes used as separators.
I've seen XML that encodes list indexes in tag names, like this:
<item3>78</item3>
<item1>34</item1>
<item0>12</item0>
<item2>56</item2>
So I don't think your situation is quite as bad
I think that your answer greatly depends on what you are planning to do with this data, and how hard it would be for the provider to change their code to generate a more XML-like XML for you. If your provider is a utility company in the United States, you will almost certainly be better off just working with the flawed format. Otherwise, you risk spending countless hours convincing them to change the format for you, and then ending up working with that flawed format anyway 
|
|
|
|
|
I need to present the data in a single field in a meaningful way for a user;
Meter Ref: 00895289
Reading Taken 14/12/10, Reading 2
Reading Taken 28/09/10, Reading 0
Meter Ref: 00895995
Reading Taken
And so on.
The provider is actually a company that my company owns, although the work is being done for another company that we own. I can make them do anything, it is just at some point there will be an argument about cross charging that goes away if I do the work instead.
Every man can tell how many goats or sheep he possesses, but not how many friends.
|
|
|
|
|
I would definitely ask them to make reading items meters' children, rather than siblings. While they are at it, I'd ask them to put dates and values into attributes too. Depending on the technology that they use, it could be as simple as ten-line change on their end.
Doing the work on your end invites maintenance headache, with a potential of costing your company a lot more. Especially if someone inherits this project from you, and needs to implement enhancements.
|
|
|
|
|
dasblinkenlight wrote: I'd ask them to put dates and values into attributes too
I don't think that is a good idea.
|
|
|
|
|
Why? The most complete treatment of the attribute-vs-element question[^] that I was able to find mentions the principle of structured information, saying that "If the information is expressed as an atomic token, use attributes." I've been intuitively following that rule for many years, because it is easy to remember, it results in consistent schemas, lends itself nicely to use in automated schema generators, and makes resulting documents more compact. That's why I think that using attributes in this case is desirable.
|
|
|
|
|
From that same document and from the single principle (of the several) that you are referring to.
"Attributes are designed for expressing simple properties of the information represented in an element."
As an example a font is a property of the text of a book. So the font is an attribute. The text is not. Notice as well that the text itself is a element value.
So exactly how would you structure the data of the OP such that an element value has attributes which are properties?
Besides the principles (plural) of that link which I also use I can only note that in my experience attributes also suffer from a lack of easy display and no way to comment values (xml comments.)
|
|
|
|
|
Notice as well that the text itself is a element value.
A text that does not represent a value of an enumeration should always be in an element, because of the mandatory attribute normalization in XML.
So exactly how would you structure the data of the OP such that an element value has attributes which are properties?
Like this:
Personally, I would prefer the markup below as more consistent, but the one above is perfectly OK.
<pre lang="xml">
<meter ref="00895289">
<reading date="14/12/10" value="2"/>
<reading date="28/09/10" value="0"/>
<reading date="23/08/10" value="0"/>
<reading date="02/03/10" value="9"/>
</meter>
<meter ref="00895298">
<reading date="02/12/10" value="275"/>
<reading date="22/09/10" value="274"/>
<reading date="02/06/10" value="274"/>
<reading date="02/03/10" value="274"/>
</meter>
in my experience attributes also suffer from a lack of easy display and no way to comment values (xml comments.)
I tend to disregard display concerns, as XML is not specifically a presentation-oriented language. As far as inability to comment attributes goes, I think that humans should not be exposed to reading and writing XML so much as to need comments. There was an excellent post on the subject[^] ten years ago, which I think is even more applicable today.
|
|
|
|
|
Second example is inconsistent with the link since the attributes do not act on anything.
First is just odd.
dasblinkenlight wrote: I tend to disregard display concerns...
The link you posted specifically lists readability as a principle.
|
|
|
|
|
Reformating as blocks rather than sequential would seem a bit more friendly.
|
|
|
|
|
I have an xhtml file that is valid and im running a simple xslt sheey against him only to be able to catch the body element and it dosent work.
The xml:
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<a name="top"></a>
</body>
</html>
The xslt:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
>
<xsl:output method="xml" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="node()"/>
</xsl:template>
<xsl:template match="body">
here
</xsl:template>
</xsl:stylesheet>
|
|
|
|
|
Change your xml as shown below.
<html xmlns="http://www.w3.org/1999/xhtml"> --- > <html>
This name space reference is creating issues.
Thanks,
Nagaraj
|
|
|
|
|
I have a string in an XML file and I want to display each letter (or number) in a different box (div ). So I made the div tag and I want to display one letter (or number) in it.
Currently I have this code:
...
<!-- text to itterate over -->
<xsl:variable name="text">name person</xsl:variable>
<xsl:call-template name="loop">
<xsl:with-param name="text" />
</xsl:call-template>
...
<xsl:template name="loop">
<xsl:param name="text" />
<xsl:param name="count">1</xsl:param>
<xsl:if test="not(count = string-length($text))">
<div class="fillIn">
<xsl:value-of select="substring($text, $count, 1)"/>
</div>
<xsl:call-template name="loop">
<xsl:with-param name="count" select="$count + 1" />
<xsl:with-param name="text" select="$text" />
</xsl:call-template>
</xsl:if>
</xsl:template>
Any advice on what I can improve? Because this isn't working.
Thanks in advance!
|
|
|
|
|
1. Use $test as a constant.
2. Rename your param $text to something else, e.g. $sub_text and select="$text" (without this you have an empty string
3. Your if test is incorrect. count does not have a '$' in front of it.
"not($count = string-length($text))"
4. The last parm $text should be renamed to $sub_text and select attrib set to "substring($text, $count + 1)" since you should be chopping off the first character and passing it to the next recursion.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
modified on Tuesday, June 7, 2011 7:55 PM
|
|
|
|
|
Hello mates,
I am new to XSL and would like to transform a NewML G2 format XML into another XML.
For example I have:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
- Structure: NML2 SNI Text
-->
<!-- ========================================================= -->
<newsMessage xmlns="http://iptc.org/std/nar/2006-10-01/" xmlns:rtr="http://www.reuters.com/ns/2003/08/content" xmlns:x="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<header>
<transmitId>tag:123.com,0000:newsml_N19279043:609406403</transmitId>
<priority>3</priority>
<destination>ABX</destination>
</header>
<itemSet>
<newsItem conformance="power" guid="tag:reuters.com,0000:newsml_N19279043" standard="NewsML-G2" standardversion="2.1" version="609406403" xml:lang="en">
<itemMeta>
<itemClass qcode="icls:text" rtr:msgType="S"/>
<provider literal="reuters.com"/>
<versionCreated>2011-05-20T05:00:27.000Z</versionCreated>
</itemMeta>
<contentMeta>
<urgency>3</urgency>
<infoSource literal="Reuters" role="cRole:origProv"/>
<subject qcode="N2:BNK"/>
<headline>My Headline</headline>
<by>ABC</by>
</contentMeta>
<contentSet>
<inlineXML contenttype="application/xhtml+html" wordcount="881">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title/>
</head>
<body>
<p>Paragraph A</p>
<p>* Paragraph A</p>
</body>
</html>
</inlineXML>
</contentSet>
</newsItem>
</itemSet>
</newsMessage>
I would like my result XML to be something like:
<?xml version="1.0" encoding="UTF-8"?>
<MyData>
<MyTransmitId>tag:123.com,0000:newsml_N19279043:609406403</MyTransmitId>
<MyHeadline>My Headline</MyHeadline>
<MyContent>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title/>
</head>
<body>
<p>Paragraph A</p>
<p>* Paragraph A</p>
</body>
</html>
</MyContent>
</MyData>
I come out with the following XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt">
<xsl:output method="xml" indent="yes" encoding="utf-8" />
<xsl:template match="/newsMessage">
<MyTransmitId>
<xsl:value-of select="header/transmitId"/>
</MyTransmitId>
<MyHeadline>
<xsl:value-of select="itemSet/newsItem/contentMeta/headline"/>
</MyHeadline>
<MyContent>
<xsl:value-of select="itemSet/newsItem/contentSet/inlineXML"/>
</MyContent>
</xsl:template>
</xsl:stylesheet>
However it transforms to something not quite right.
What is wrong with my XSL?
Thank you very much.
|
|
|
|