|
if you're using MSXML, there is a method to load an XML file given a filename, not the file's contents... look it up in the MSXML SDK
- Roman -
|
|
|
|
|
Try this:
<nobr>Dim xml
Set xml = CreateObject("MSXML2.DOMDocument")
If Not WScript.Arguments.Count = 1 Then
WScript.Echo "Usage: cscript loadxml.vbs <xml-file.xml>"
WScript.Quit 0
End If
If Not xml.load(WScript.Arguments(0)) Then
WScript.Echo "The XML file couldn't be loaded:"
WScript.Echo " Error: " + xml.parseError.reason + _
" Error code: 0x" + Hex(xml.parseError.errorCode)
WScript.Echo " in File """ + xml.parseError.url + """"
WScript.Echo " @ row " + CStr(xml.parseError.line) + ", col " + CStr(xml.parseError.linepos)
If Not xml.parseError.srcText = "" Then
WScript.Echo
WScript.Echo xml.parseError.srcText
WScript.Echo String(xml.parseError.linepos - 1, "-") + "^"
End If
WScript.Quit -1
Else
WScript.Echo "XML file loaded sucessfully."
End If
' Sucessfully loaded DOM tree is now available in the xml var
WScript.Echo xml.xml
How to use
Save the code above as 'loadxml.vbs'
Type in your console 'wscript //H:cscript' to use the console version of your wscript host.
Goto to the subdirectory with your xml data and the script.
Type 'loadxml anyfile'
Voilá!
The function used to load the file is 'load' . Returns true/false wether it could load the file or not.
Good night everybody I need some sleep... zzzzzz zzzzzz
|
|
|
|
|
How'd you get that beautiful syntax highlighting?
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
I do it by hand . But I'm writing on a tool for highlighting to HTML code wich I will publish as an article .
Guess what I can already render XML to HTML! (no XSLT, cause it reads also comments, PIs etc.) All ya need is VBS and MSXML 3. But I still need a few weeks .
|
|
|
|
|
Has anyone else ever run across the need to generate an "empty" XML Document based on a Schema? I am using XSD schemas to define the state behind a VB form, using XPath expressions to implementing binding between nodes in the document and controls on the forms. I would like to generate a blank document when I load the form, so that all my XPath expressions are valid, even if they return no value.
Any ideas?
Thanks!
|
|
|
|
|
Hello,
I want to render XML on server side using JSP. How do I do it? Please give me some tips.
Thanks
Hitesh
|
|
|
|
|
hi,
What exactly do u mean by render XML ? Do u want to parse the XML and display the contents onto the browser ? If so, u can use the xerces parser which is an open-source from IBM-Apache. You can get it at http://xml.apache.org. Get the JAR - xerces.jar.
Rgds,
Sharad Ganesh
|
|
|
|
|
just use XSL
- Roman -
|
|
|
|
|
In case I want to create a xml schema to map with file directory tree structure, I tried the following schema:
<xs:element name="Manifest">
<xs:complexType>
<xs:sequence>
<xs:element ref="Manifest" maxOccurs="unbounded" />
<xs:element ref="Directory" maxOccurs="unbounded" />
<xs:element ref="File" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="Directory">
<xs:complexType>
<xs:sequence>
<xs:element ref="Directory" maxOccurs="unbounded" />
<xs:element ref="File" maxOccurs="unbounded" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="File">
<xs:complexType>
<xs:attribute name="name" type="xs:string" />
</xs:complexType>
</xs:element>
However, this schema will not allow me to generate a dataset in .NET because I use "file" and "directory" node recursively. I'd like to know how to solve this problem so that I can get a dataset out of it. Thanks in advance.
Sakda Chaiworawitkul
|
|
|
|
|
I need to POST XML data (via an ASP application) to an entity who has provided me a spec that seems a bit incomplete and their tech support is of no help. The spec says (to summarize) that "the user system (my app) will transmit the XML data through an HTTPS URI using a digital certificate".
Is it evident whether the application will use a server or a client certificate? Since my server is POSTing data to their server I would assume that I need a client certificate. However, I'm being told that I need a server certificate. If that's the case, how do I forward my server certificate to the URI I'm POSTing to.
Am I insane or incredibly naive? Can you even tell from the little information I've (been) given? Any additional links or resources would be appreciated. I've dug up very little info on Server to Server XML/SSL stuff.
|
|
|
|
|
Welcome
I have XML file:
<br />
<doc><br />
<field><br />
<name> myName</name><br />
<value> some value</value><br />
</field><br />
<field><br />
<name> otherName</name><br />
<value> other value</value><br />
</field><br />
</doc><br />
I have created XSL file:
<br />
<xsl:template match="/"><br />
<!-- transform fields --><br />
<xsl:for-each select="field"><br />
<xsl:choose><br />
<!-- i want get data from myName field --><br />
<xsl:when test="cd[name='myName']"><br />
<xsl:value-of select="value"/> <xsl:when><br />
<xsl:choose> <br />
</xsl:for-each><br />
</xsl:template><br />
unfortunately it doesn't create output file as:
some value
What is wrong?
|
|
|
|
|
Change the select attribute of the <xsl:for-each> element to either "doc/field" or "//field". <field> is not the root element; it's a child element.
Change the test attribute of the <xsl:when> element to contain the value "name=' myName'".
|
|
|
|
|
thx
(there was no space in oryginal
but correct version of test shoud look like
<br />
xsl:when test="name='myName'"<br />
|
|
|
|
|
I've seen this issue noted a few other places on the web, but so far no good solutions have been found.
I have an XSL file I'm using to transform some XML. This XSL file has existed for a long time now and has always worked on version of IE <= 5.5. Some of our clients are now moving to an IE6 environment and I've found that the new version of the XML parser included with IE6 messes up when performing the transform.
Specifically, when the transform attempts to output a textarea block, with code similar to this:
<DIV>
<TEXTAREA size="40," style="width:100%">
<xsl:attribute name="FIELD_TYPE">s</xsl:attribute>
<xsl:attribute name="DATA_TYPE">T</xsl:attribute>
</TEXTAREA>
</DIV>
The closing textarea tag is never output to the HTML when using the XML parser included with IE6. In IE <= 5.5 however this works just fine.
Has anybody else experienced similar problems, or have a suggestion for a solution? It would be appreciated! Thanks!
|
|
|
|
|
I think you can fix this by putting <xsl:text> </xsl:text> at the end of the attributes.
This should force it to insert a space into the text area, which in turn will split the <textarea/> shortcut into <textarea> </textarea>. The only problem is that the text box will have a space in it already for the user.
There may be another way to do this, I've never run into the problem myself.
|
|
|
|
|
Shouldnt you be using xsl:element to do this? xsl:element
Don't have time to test it but I assume something like this:
<xsl:element name="textarea">
<xsl:attribute name="FIELD_TYPE">s</xsl:attribute>
<xsl:attribute name="DATA_TYPE">T</xsl:attribute>
</xsl:element>
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
|
|
|
|
|
Hello all, I am having a bit of a problem with databases. Right now I have an application that stores data into an access database. But when the database goes over 2 gigs the application crashes out and it starts over writting the header file. Please give me some suggestions with using other database collectors, that would be a great help. Thanks
|
|
|
|
|
Hi,
I'm currently using the XML DOM from VC++ in order to load / manipulate / save XML files. I like to format my XML files nicely with tabular indents and so on, in order to form a readble document. However, the parts of the document modified from within VC are just written in "one-huge-line"-style. No nice linebreaks and tab indents... How do I do that ? The IXMLDOMNodePtr->xml property hasn't got a put method, so I can't manually append a linebreak directly. Any ideas folks ?
Thanks a lot in advance ;o)
Best regards
/Jan
|
|
|
|
|
|
yeah - well.. sort of. Thats "my" thread as well - as you've probably seen.
However, I can't find anything in the helping link about how to format the XML file - not the data output. Or I'm just missing something important here ;o)
Anyway, could you be a bit more specific about how I fix it ? the problem is that
<sometag>
<child1>
<subitem1>hello</subitem1>
<subitem2>world</subitem2>
</child1>
<child2>
<subitem1>hello</subitem1>
<subitem2>xml</subitem2>
</child2>
</sometag>
after updating child 2 data is turned into
<sometag>
<child1>
<subitem1>hello</subitem1>
<subitem2>world</subitem2>
</child1>
<child2><subitem1>hello</subitem1><subitem2>xml</subitem2></child2>
</sometag>
- which is pretty annoying. And I just can't find any way of telling the XML document object/nodes how to physically dump the data.
Maybe that was more clear - or maybe I've just misunderstood the entire concept. Who knows ?
/Jan
|
|
|
|
|
There is a 'whitespace' element in the DOM, I've never used it since it costs performance to use.
see http://www.xml.com/pub/a/2001/12/05/whitespace.html
|
|
|
|
|
Allright, I may be completely off track here - but the link you refer to deals with the problems of showing the data from the XML file using a stylesheet, and getting line breaks in the resulting "view".
What I want, is linebreaks in my XML file. When I generate this data structure :
<parent>
<child>
<data1>bla</data1>
<data2>bla</data2>
</child>
</parent>
from VC++, the _file_ looks like this :
<parent><child><data1>bla</data1><data2>bla</data2></child></parent>
- which, of course, is correct - but not what I want.
What do you think ? completely off track and unable to understand the link you gave me ;o) ?
Thanks anyway.
/Jan
|
|
|
|
|
there is property of xmlwriter than creates/preserves space.
personally I allways turn it off.
|
|
|
|
|
whoops, yea, posted wrong link! My bad.
You definately are looking for the whitespace setting. I cant find the link I was going to give you now, though.
|
|
|
|
|
The problem you are facing is true if you read the xml in a text editor. But any xml editor should automatically reorganize the display of your data in the "neat" way. I am assuming this is your objective. Unless you wish to read it in a simple text editor and yet have it formatted. In which case.... hmmmm... too much effort, when there are so manty xml editors and tools available. Including IE which will display your XML in the "neat" way.
|
|
|
|