|
------------------------------
function Go(node){
var str = new String();
str+=node.nodeName+"
";
if(node.hasChildNodes()){
for(i=0;i
|
|
|
|
|
Either your compiler is broken or you did not follow my instructions and tick the box that says 'Display this message as-is (no HTML)'. I suspect the latter. The < in your for loop is finding a > to turn into a tag, and it's being stripped.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Hi All
I have an xml which is passed thru a sytlesheet and in the resultant file, two tags IDValue and IDScheme are not properly output.
Could you please help me out !
Thanks
<b>Enclosed - Source XML </b>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="C:\ExpressPrototypes\Chi Interface Prototype 2\XMLFiles\RegisterPatientResponse.xsl"?>
<gen:RegisterPatientResponse xmlns:gen="http://www.show.scot.nhs.uk/isd/General" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- xsi:schemaLocation="http://www.show.scot.nhs.uk/isd/General CHIRegisterPatientResponse.xsd" -->
<!-- Contains standard patient response header and a patient body which contains the CHI Number -->
<gen:StandardPatientResponseHeader>
<gen:ReturnCode>SUCCESS</gen:ReturnCode>
<gen:ErrorCode>0001</gen:ErrorCode>
<gen:ErrorText/>
</gen:StandardPatientResponseHeader>
<!-- Standard patient response body containing the CHI Number -->
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>1601025017</gen:IdValue>
<gen:IdScheme>CHI</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
</gen:RegisterPatientResponse>
<b>Enclosed Source XSL</b>
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:gen="http://www.show.scot.nhs.uk/isd/General" xmlns:req="http://www.isoftplc.com/Express/Chi/RegisterPatientResponse" xmlns:hdr="http://www.isoftplc.com/Express/Chi/Header" exclude-result-prefixes="gen hdr">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="text()|@*"/>
<xsl:template match="gen:RegisterPatientResponse">
<gen:RegisterPatientResponse>
<xsl:apply-templates/>
</gen:RegisterPatientResponse>
</xsl:template>
<xsl:template match="gen:StandardPatientResponseHeader">
<gen:StandardPatientResponseHeader>
<gen:ReturnCode>
<xsl:value-of select="./gen:ReturnCode"/>
</gen:ReturnCode>
<gen:ErrorCode>
<xsl:value-of select="./gen:ErrorCode"/>
</gen:ErrorCode>
<gen:ErrorText>
<xsl:value-of select="./gen:ErrorText"/>
</gen:ErrorText>
</gen:StandardPatientResponseHeader>
</xsl:template>
<xsl:template match="gen:StandardRegisterPatientResponseBody">
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>
<xsl:value-of select="./gen:IdValue"/>
</gen:IdValue>
<gen:IdScheme>
<xsl:value-of select="/gen:IdScheme"/>
</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
</xsl:template>
</xsl:stylesheet>
The values IDValue and IDScheme are not properly output
|
|
|
|
|
Heya,
either change the XSL to:
...
<xsl:template match="gen:StandardRegisterPatientResponseBody">
<gen:StandardRegisterPatientResponseBody>
<gen:PatientDetails>
<gen:PatientId>
<gen:IdValue>
<xsl:value-of select="gen:PatientDetails/gen:PatientId/gen:IdValue"/>
</gen:IdValue>
<gen:IdScheme>
<xsl:value-of select="gen:PatientDetails/gen:PatientId/gen:IdScheme"/>
</gen:IdScheme>
</gen:PatientId>
</gen:PatientDetails>
</gen:StandardRegisterPatientResponseBody>
...
or, since you seems to make a copy of the stuff use the xsl:copy-of element.
Cheers
/WW
|
|
|
|
|
Hi folks, I have been hearing how good XML is when it comes to creating structured documents. My question is: I have tons of documents (text form), how do I port over to XML in the shortest time?
And, after porting, how do I update, edit it? It's not like SQL which I can code some interface (mainly in browser) to deal with it. I've been wondering this, can any kind soul answer me? Thanks.
--
Wei-Hui
|
|
|
|
|
Lim Wei-Hui wrote:
tons of documents (text form)
I presume there is a standard format that all your txt docs use? Like delimitors for different sections?
Lim Wei-Hui wrote:
how do I update, edit it?
It is actually pretty easy to update XML documents, so I don't think this is an issue.
All you'll need to do is:
load xml file into xmldom
manipulate nodes and or their values
save the xmldom back to the file
Can you perhaps post a snipett from the doc. and also explain a bit more about this application?
Cheers,
Simon
"The day I swan around in expensive suits is the day I hope someone puts a bullet in my head.", Chris Carter.
my svg article
|
|
|
|
|
Hi Simon, thanks for replying me.
My documents are mainly some header files in C/C++ that are filled with typedef and structs. I would like to set up an interface that enable me to select from browser which typedef and structure I wanna include in the new header file and hence generatin' it out as a *.h file.
Of course each typedef and structure has their unique function and properties, I presume (haven't looked into it).
I hope I've made myself clear. Thanks for your help again.
--
Wei-Hui
--
Wei-Hui
|
|
|
|
|
hi,everybody
Did you use "libxml" to parse your xml file ? I need your help .
how do I parse dtd file by libxml ?
after I parse dtd file ,how do I take use of result for parsing xml file ?
such as ,my dtd file is Goodxml2.dtd
-----------
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT bookshell (book*)>
<!ELEMENT book (author, title)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT title (#PCDATA)>
---------------------------------
my xml fils is Goodxml2.xml
-----------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bookshell SYSTEM "GoodXml2.dtd">
<bookshell>
<book>
<author>Du Peng Chao</author>
<title>Today Story</title>
</book>
</bookshell>
----------------------------------------------
how do I parse dtd file by libxml ? then take use of parsing result to parse xml file for get element content ?
thank you very much
|
|
|
|
|
Regardless of what libxml is, I see an error in what you show : a DTD doesn't have headers like <?xml...
|
|
|
|
|
I use the "xml spy ide " tool to generate my dtd file
there has the headers
ant no error reported .
|
|
|
|
|
storein wrote:
ant no error reported
No error reported in what tool ? xml spy ?
Again, a DTD is not written with Xml syntax, so not only the <?xml header is useless, it may do bad things depending on the parser you use (libxml, msxml, expat, .NET xml, ...)
|
|
|
|
|
Yes. of course ,you are right ,
there is no this header .
when you write your program ,how do you use your DTD file that corresponds your xml file ? only validate the xml file ?
DTD file is GoodXml.dtd
-----------
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT bookshell (book*)>
<!ELEMENT book (author, title)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT title (#PCDATA)>
---------------------------------
XML file is GoodXml.xml
-----------------
<!DOCTYPE bookshell SYSTEM "GoodXml.dtd">
<bookshell>
<book>
<author>Du Peng Chao</author>
<title>Today Story</title>
</book>
</bookshell>
----------------------------------------------
do you use DTD file to validate only xml file ?
whether I can parse DTD file first ,get element "bookshell ,book,author,title ",then use
the element to parse xml file ?
in a word ,parse dtd file dynamicly ,parse xml file dynamicly ,then get element content .
thank you in advance .
|
|
|
|
|
I don't understand what you want to do, and as I don't know libxml either, I guess the discussion is in no way of getting a way out. The only thing I can tell you is that you should never parse a DTD yourself. You should rely on an existing xml parser for this purpose.
|
|
|
|
|
|
Just my 2 cents here but why a old DTD format? For my area we only use XSD for new work.
Second what goal are you wanting? If it is to validate the file then use the existing tools. If it is to make a data entry form then I can see some use.
"I will find a new sig someday."
|
|
|
|
|
Thank you reply .
I want to write c program that parse dynamicly dtd file , get the element ,and take use of these element to parse xml file for getting the element't content
such as :
DTD file is GoodXml.dtd
-----------
<!ELEMENT bookshell (book*)>
<!ELEMENT book (author, title)>
<!ELEMENT author (#PCDATA)>
<!ELEMENT title (#PCDATA)>
---------------------------------
XML file is GoodXml.xml
-----------------
<!DOCTYPE bookshell SYSTEM "GoodXml.dtd">
<bookshell>
<book>
<author>Du Peng Chao</author>
<title>Today Story</title>
</book>
</bookshell>
----------------------------------------------
firstly , the program parse GoodXml.dtd file ,get element "bookshell ,book,author,title ",
secondly, use the element to parse xml file ,
get the content "Du Peng Chao" and "Today Story"
of course ,I use libxml ,not write parser myself.
in a word ,parse dtd file dynamicly ,parse xml file dynamicly ,then get element content .
thank you in advance .
|
|
|
|
|
From what you describe I can just parse the XML file and get the tags and data from it. I do not get anything from reading the DTD.
"I will find a new sig someday."
|
|
|
|
|
Now I think I am wrong . because as you say , I can parse the xml file and get tags and data from it ,I need't parse dtd file , Yes ,it is a comprehension error .
OK ,thank you reply , I know how to do it
|
|
|
|
|
Hi, I try to use Jscript and XML together.
For example:
--------------------------------
<books>
...
<book title="Harry Poter">
<book title="Harry Poter">
...
----------------------------------
how can I read title attributes by using XMLDOM object.
And do you refer me any good tutorial about XMLDOM object use in jscript.
karanba
|
|
|
|
|
I like it.
Be sure to replace < with < in your post.
|
|
|
|
|
Here's a snipet from an MSDN example:
doc.LoadXml("<book ISBN='1-861001-57-5'>" +
"<title>Pride And Prejudice</title>" +
"<price>19.95</price>" +
"</book>");
Now, why is ISBN an attribute, not a node, vs. title and price? I've done a brief search to try and explain when something should be an attribute and when something should be a node, and I can't find a good explanation. It seems that price and title are attributes of a book too.
Comments?
PS - I'd like to thank all for answering my previous questions too! It is definitely helpful.
Marc
|
|
|
|
|
You get a lot of personal opinions here. Many say you should never use attributes. I do not agree with that but thought must be used in your placement. Our local guidance usually says for unique machine identifiable info we use attributibutes. For one even though you can have a schema that says you have only one child node of a given name this can be overridden. For an attribute you can only have one.
Now for your question: There is only one ISBN for a book (now I ask is that really true?) For the Title and Price you may want to have the title shown in many languages so you add all that you need and add a language attribute to the title block. Same for price, currencies, specials deal's etc. But they all point to the same book.
Now for the ISBN question. If a book is then printed in a new language does it get a new ISBN? I do not know but if so they may have restricted them selves by this format. However if you are tracking each book the above hold true and is probably their logic.
"I will find a new sig someday."
|
|
|
|
|
Michael A. Barnhart wrote:
machine identifiable
I should have stated info not shown to the standard user.
"I will find a new sig someday."
|
|
|
|
|
Ah. So the "typical" usage of an attribute is to qualify the node, for example, the language attribute qualifies the book title and the currency attribute qualifies the price.
That makes sense, but it seems that there are lots of exceptions, which I guess is why you get a lot of personal opinions.
Well, I like how you put it. It provides some good guidelines as to when to use an attribute or not.
It would seem then that David Stone's comment: You have elements(controls), attributes(properties), and it's all hierarchical(parent controls) would therefore be an inappropriate use of attributes. Properties of a control should be sub-nodes?
What about the concept that something could be an attribute if it is the lowest divisible piece of information? In David's example, something like width could then be an attribute (of course, what kind of width--pixels, dialog units, inches, etc)?
Oh boy.
Marc
Help! I'm an AI running around in someone's f*cked up universe simulator. Sensitivity and ethnic diversity means celebrating difference, not hiding from it. - Christian Graus Every line of code is a liability - Taka Muraoka
|
|
|
|
|
ISBN is a property of the book, and there is a single instance, so it can be an attribute, or an element.
For properties or children that have more than one occurence, relying on elements is necessary. (To be honest, not really too, one could concatenate all element content within a single line, adding a separator in much the same way than CSV files).
All in all, you can think of attributes as a facultative tool to preserve size.
The use of Xml elements increase the overall size of Xml streams, even when they have no children, and that's because of the markers : <, >, /.
After all, everything in Xml could be made available as elements, and only elements.
The trouble is those people from the W3C have messed the thing up about Xml by introducing attributes, headers like ?xml, doctype, ... which are not written using the Xml syntax, and of course that stinking DTD format, which is not expressed in Xml either.
|
|
|
|
|