|
Jeremy Pullicino wrote:
Also, has anyone ever heard of XML query language?
This[^] might be of some help to you.
You can find a few references to XQuery implementations in this article[^].
HTH (to some extent)
Zdenek
"It's never too late to have a happy childhood." [Tom Robbins]
|
|
|
|
|
Don't about many Schema authoring tools. I use XML Spy for XML, XSD etc.
You may want to consider using XSLT for extracting data. If you design your code to apply an XSL to extract data from the XML then you have the flexibility of changing the XSL or creating additional XSLs for extracting different parts of the XML database wityhout having to change your code. Just an idea....
|
|
|
|
|
Thanks about the XML Spy tip, I will make sure to download a copy of it today.
I am worried about XSL for extracting data since performance is an issue for me (this database is read many times every second, from multiple threads, 24hrs a day).
I was thinking of dynamically creating a schema with the fields I will want, and then extracting the data into that schema - however, I am stil learning about XML, so this might be too advanced for me right now.
Thanks for the tips though
XML is truly great.
Jeremy Pullicino
Professional C++ Developer
Done any hacking lately?
|
|
|
|
|
The fastest way to extract data from an XML document is to use SAX (Simple API for XML)[^]. All major vendors provide an implemetaion, but it is not a standardized API (a standards body does not control the API) - it is a de fecto standard.
SAX uses a streaming model where the XML parser notifies your applicaiton whenever it reads a part of the document and provides the details to you in plain text. There's a good article, part of which describes the SAX programming model at the 'other' site[^].
SAX scales well, but if you're still concerned about performance then you can just read the XML directly usinng file I/O and parse it yourself - that's as efficient as it gets but is difficult to maintain.
Jeremy Pullicino wrote:
dynamically creating a schema with the fields I will want
No need to do this - see my other post about getting data from an XML document. That post uses the DOM, which may end up being too slow for your needs. Again, you can use SAX bu then extracting the relevant data is left an an excercise for you or you can od the do-it-yourself route and again have to deal with that issue but with the benefit of muh better performance.
Erik Westermann
Author, Learn XML In A Weekend (Fall 2002)
|
|
|
|
|
Jeremy Pullicino wrote:
I am designing an XML database and need some pointers.
Just quickly have a look at TeXtML[^] for an actual XML Database. Also they maky have whitepapers and links to resources on XML databases.
Jeremy Pullicino wrote:
Also, has anyone ever heard of XML query language?
Yes, read about it at W3C and Google has plenty of links. FYI XSL is used for transforming XML while XQuery is for querying. Though in reality they are very similar and people chop and change between them.
Paul WatsonBlueGrassGroup.com Cape Town, South Africa
|
|
|
|
|
Thanks for the tips especially the links.
The xml database looks good - their site gave me many tips on how XML could be used in databases.
Jeremuy.
Jeremy Pullicino
Professional C++ Developer
Done any hacking lately?
|
|
|
|
|
Paul Watson wrote:
Anybody have any clue as to how to pause an animation in SVG?
Figured it out eventually, call the following method in your SVG doc to pause document.rootElement.pauseAnimations(); and to unpause/resume document.rootElement.unpauseAnimations(); .
Bloody hell if I may say so. All the other leads I followed were complex masterpieces of JavaScript, and that works with just one line. Doh!
|
|
|
|
|
Is there any FREE XML editors like XMetaL 3.0??
XMetaL 3.0 is too expensive for me!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
lol
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Why LOL?
And why is my message gone!?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
does anyone know how to tell the parser to ignore special characters in element attributes?
say i have an element:
<br />
<setting name="CommandLine" value="notepad.exe "C:\Documents and Settings\moralja\My Documents\text\text.txt""></setting><br />
this will not parse correctly because of the quote marks inside the value attribute.
just encoding the quotes with " works, but i am going to have possibly thousands of entries, i would rather have some way, like the CDATA thing, to tell the parser to ignore the data altogether
any ideas?
-John
|
|
|
|
|
John Morales wrote:
just encoding the quotes with " works, but i am going to have possibly thousands of entries, i would rather have some way, like the CDATA thing, to tell the parser to ignore the data altogether
I may be wrong but the answer is no. If you think about it having quotes like that in the attribute value breaks the whole parsing of the element.
I would recommend you move that attribute to an element e.g.:
<setting name="CommandLine">notepad.exe "C:\Documents and Settings\moralja\My Documents\text\text.txt"</setting>
It actually makes more sense that way too.
And if you think that will be a pain with thousands of entries, you could always write a simple XSL file which does it for you in a couple of minutes
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Simon Walton wrote:
"You come across a lot of people who call themselves realists, when they are actually pessimists attempting to look intelligent."
|
|
|
|
|
Hello;
I have trouble with XML. I have XML document like following;
root
A id="97033536"
B id="09417"
C id="09418"
D
E M18 /E
/D
/C
/B
B id="09417"
C id="09419"
D
E M18 /E
/D
/C
/B
/A
/root
I want to get data in 2 rows like;
97033536 09417 09418 M18
97033536 09417 09419 M18
How can i get this result in Visual Basic with DOM?
Thanks...
Ahmet Orkun GEDiK
|
|
|
|
|
One way is to create an XSL and then transform the XML. This can be done by creating two DOM Documents. Load the XML in one and the XSL in one. call TranformNode for the XML by passing the XSL. The XSL could look something like:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes">
<xsl:template match="/">
<xsl:apply-templates select="/A">
<xsl:template match="A">
<xsl:for-each select="B">
<xsl:value-of select="/A/@id">
<xsl:text>
<xsl:value-of select="/A/@id">
<xsl:apply-templates select="C">
<xsl:template match="C">
<xsl:text>
<xsl:value-of select="@id">
<xsl:apply-templates select="D">
<xsl:template match="D">
<xsl:text>
<xsl:value-of select="E">
I like this approoach because if you wish to chnage the format of your data later on all you have to do is change the XSL and your code remains the same.
|
|
|
|
|
Hello;
I have trouble with XML. I have XML document like following;
<root>
<c id="09418">
<d>
<e>M18
<c id="09419">
<d>
<e>M18
I want to get data in 2 rows like;
97033536 09417 09418 M18
97033536 09417 09419 M18
How can i get this result in Visual Basic with DOM?
Thanks...
Ahmet Orkun GEDiK
|
|
|
|
|
Hey Guys,
I am using ASP to load some data from a xml file via xsl. Now i need to sort this data, i know i could use the xsl:sort element but i need a dynamic one, which the user can change. So the user will have the possibilty to sort the data in different ways. I already tried to pass a param to xsl and put it to <xsl:sort> but it didnt worked.
Isnt it possible to pass a sort statement in selectnodes ?
Is there any such function ?
Any suggestions ??
thanks
Sonu
da sonu
|
|
|
|
|
If you are using DOM then try the following. Based on the user's selections create an XSL with the appropriate sort and then apply it to your XML using the DOMDoc object.
|
|
|
|
|
I am using DOM, but i am not very familiar with that. Do you have any example code which might help me ?
da sonu
|
|
|
|
|
Hi,
try to put this code:
<xsl:sort order="ascending" data-type="text" select="//records/*[name() = $OrderField]"/>
Where the parameter $OrderField contains the name of the field to order.
Pau
|
|
|
|
|
hola,
i have this xml recordset which looks like this
<DataSet>
<User>
<ID>JoeG</ID>
<FNAME>Joli</FNAME>
<LNAME>Gantz</LNAME>
<SSN>400-00-0000<SSN
</User>
<User>
<ID>Joe4</ID>
<FNAME>Joseph</FNAME>
<LNAME>Gour</LNAME>
<SSN>500-00-0000<SSN
</User>
<User>
<ID>Joe4</ID>
<FNAME>Joseph</FNAME>
<LNAME>Gour</LNAME>
<SSN>500-00-0000<SSN
</User>
</DataSet>
Basically I am trying to find a way to transform this xml into something that will have two or however many users in a page element so the output would be something like this.
<DataSet>
<page>
<User>
<ID>JoeG</ID>
<FNAME>Joli</FNAME>
<LNAME>Gantz</LNAME>
<SSN>400-00-0000<SSN
</User>
<User>
<ID>Joe4</ID>
<FNAME>Joseph</FNAME>
<LNAME>Gour</LNAME>
<SSN>500-00-0000<SSN
</User>
</page>
<page>
<User>
<ID>Joe4</ID>
<FNAME>Joseph</FNAME>
<LNAME>Gour</LNAME>
<SSN>500-00-0000<SSN
</User>
<User>
<ID>Joe90</ID>
<FNAME>Joseph90</FNAME>
<LNAME>Ninety</LNAME>
<SSN>500-00-0000<SSN
</User>
<page>
</DataSet>
any one have any ideas as to how i can achieve this? I can get a page attribute around every user, but i would like to be able to put it around every X number of users, if anyone has any ideas i would really appreciate the help. sorry for the length of this post.
thanks
|
|
|
|
|
I just pasted in a snippet from a similar problem solution. The requirement here was to sort items before gouping them between DIV tags. It may shed some light on the grouping you need.
XML:
<?xml version="1.0"?>
<list>
<item at="d">d</item>
<item at="e">e</item>
<item at="i">i</item>
<item at="k">k</item>
<item at="l">l</item>
<item at="a">a</item>
<item at="b">b</item>
<item at="c">c</item>
<item at="j">j</item>
<item at="f">f</item>
<item at="g">g</item>
<item at="h">h</item>
<item at="a">a</item>
<item at="b">b</item>
<item at="c">c</item>
<item at="f">f</item>
</list>
XSL:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:param name="group">5</xsl:param> <!-- grouping size-->
<xsl:variable name="items" select="count(//item)"/> <!-- total number of items-->
<xsl:template match="list">
<HTML>
<BODY>
<xsl:apply-templates select="item">
<xsl:sort select="@at" order="ascending"/>
</xsl:apply-templates>
</BODY>
</HTML>
</xsl:template>
<xsl:template match="item">
<xsl:choose>
<xsl:when test="position() mod $group =1">
<!-- Begin new group with gn = group # -->
<xsl:variable name="gn" select="concat('g', (position() + 4) div 5)"/>
<!-- DIV id="g#" -->
<xsl:text disable-output-escaping="yes"><DIV id="</xsl:text>
<xsl:value-of select="$gn"/><xsl:text disable-output-escaping="yes">"></xsl:text>
<p><xsl:value-of select="position()"/>
<xsl:apply-templates/></p>
</xsl:when>
<xsl:when test="position() mod $group =0">
<!-- End group -->
<p><xsl:value-of select="position()"/>
<xsl:apply-templates/></p>
<!-- /DIV -->
<xsl:text disable-output-escaping="yes"></DIV></xsl:text><hr />
</xsl:when>
<xsl:when test="not(position() mod $group =0) and position() = $items">
<!-- last item in sorted list-->
<p><xsl:value-of select="position()"/>
<xsl:apply-templates/></p>
<!-- /DIV -->
<xsl:text disable-output-escaping="yes"></DIV></xsl:text>
</xsl:when>
<xsl:otherwise>
<p><xsl:value-of select="position()"/>
<xsl:apply-templates/></p>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
HTH,
Zdenek
"I would have written a shorter letter, but I didn’t have the time." [Blaise Pascal]
|
|
|
|
|
Hi all,
Trying to select some nodes (in script code),
i tried running this objNode.selectNodes("//NodeType[contains(@SomeAttribute,'SomeText')]")
when the browser (i.e. 6) runs the script, I get
msxml3.dll: Unknown method.
//NodeType[-->contains('@SomeAttribute'<--,'Test')]
Any ideas? According to the references, the contains function is implemented by MsXML3, is it not valid in this context???
|
|
|
|
|
I believe it is the context you have shown. Yes contains is valid in MSXML3.
If you insist in finding evil in me you will find it, whether it is there or not.
|
|
|
|
|
Hi guys, not well versed in XML here..
*** Update -- After reading a document on well formed XML, I realized that ampersands in XML attributes need to appear as & or the numeric code. Please Ignore this post. Thanks! ****
When I try to load the following XML string into a XmlDocument object (or IE for that matter)
<text>
<text3 pageUrl="cgi-bin/ubb/forumdisplay.cgi?action=topics&forum=General+NSX+Discussion&number=1&DaysPrune=1" />
</text>
I get the following error: [From IE]
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
A semi colon character was expected. Error processing resource 'file:///C:/VSProjects/WinForumProjects/WinForumInstallDirectory/ServerContentTest.xml'. Line 2, Position 65
The error occures right after the '&forum=' part of the attribute.
It would seem to be trying to parse the attribute as HTML or something. How can I get the object to ignore the actual values of the attribute?
Thanks
Jeff
|
|
|
|
|
Can you modify your post and turn off the html. Can not see the XML.
If you insist in finding evil in me you will find it, whether it is there or not.
|
|
|
|