|
Thanks goblinTech,
It's getting there - output am getting is
Heading
Heading
Hello,
How
are
you?
I
am
a
Developer.
I will keep trying.
Thanks for your help.
|
|
|
|
|
You would find this so much easier if your xml was actually xml rather than just having a .xml extension and being a mixture of xml, html and plain text.
I would just tell the client to supply proper input if they want proper output. But then I tend to work for captive clients which makes life a lot easier.
Every man can tell how many goats or sheep he possesses, but not how many friends.
|
|
|
|
|
You are absolutely right. I just tried placing proper p tags and tried Bassam Abdul-Baki's solution and that works like a charm.
It's just this
<p/> , that's causing problem.
I just wanted to give it a go, if it's easily doable before I go back to my boss and suggest him to ask the client to provide proper XML and I have already wasted enough of my time.
Will try for another 30 mins and then no chance.. 
|
|
|
|
|
Even if you get it to work, you should let your boss know that the XML was not well-formed so that they fix it for future usage. The tags in XML are there for a reason. You shouldn't have to say I want the text after the empty tag when technically the empty tag was meant to be just empty.
|
|
|
|
|
just read the specification and it's written
DATA FORMAT
Available in XML valid against a Datapharm DTD
I am not sure how it's valid against DTD, when it's not well formed. 
|
|
|
|
|
|
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.
|
|
|
|