Discussion Locked

XML Forum (Continued)

0 helpful
16 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Welcome to the XML Forum. This is the place to post your XML questions, share your best techniques, and express your opinion on topics that impact IT development.

We also encourage you to post your comments about the XML TechMail.

If you haven't subscribed to the XML TechMail, there is no better time to take advantage of our free e-newsletter. Visit our e-newsletter subscription center to subscribe to this valuable TechMail today:

http://builder.com.com/techmails.jhtml?repID=u001

Also, don't miss the discussion from the previous XML Forum. Use the link below to catch up on earlier member comments. (Note: Due to a technical glitch, you'll need to delete the space after jhtml?.)
http://builder.com.com/forumdiscuss/thread_detail.jhtml?thread_id=119011

16 replies

by oezeilo

I have an HTML table (I set datapagesize=10)bound to an XML data island (with about 100 nodes). I also have navigation (First, Prev, etc) buttons for browsing the XML data 10 rows at a time. How do I determine which page I'm currently looking at, and how many pages there are (using JavaScript? I want to be able to say "Page X of Y pages", where X represents the current page, and Y is the number of pages.
Thanks.

by dlparker

I have an input doc "in.xml" is an XML document that conforms to the "IMS Global Learning Consortium, Inc. (IMS) ". The "IMS Question & Test Interoperability Specification" provides proposed standard XML language for describing questions and tests.
The "mattext" node will have text from such languages as: Russian, Chinese, Japanese, ... The parse is converting the "utf-8" encoded characters to "?"s.

by sirvictor

Sorry man, but UTF-8 is just another way of Unicode, coded especially on 8 bits (instead of original 16 bits).
Your description misses one important detail. You wrote: "The parse is converting the 'utf-8' encoded characters to '?'s." -- What tool /language / library do you use for that? Your question cannot be answered otherwise.

by grantwparks

On first look, maybe just maintain a counter, incrementing, when TABLE.nextPage(), decrementing when TABLE.previousPage(). When TABLE.firstPage(), set to 1, TABLE.lastPage() set to X. Firstly, you'd use the DOM to get a count of rows in the table and divide that by your datapagesize. I didn't see any "page number" property involved with data binding tables.

by geert.defevere

I don't have any knowledge of XML, but I was wondering if anyone could advise me a good book that starts from zero knowledge and ends with thoroughly understanding of XML (from dummy to specialist).

by nbs

... is that you search the web and read a couple of tutorials on XML first. This will give you a basic understanding and a broad vision of the technologies involved.
Armed with this knowledge you will be able to choose a box that really fits your needs, given the fact that what may work for one person not necessarily will for another one.
Anyway, from my perspective, one of the better books for this subject is "XML Programmer to Programmer 2nd Edition".
And as a supplemental reference I recommend "Essential XML Quick Reference".

HTH

by maryweilage

A Builder.com member asked a question about a recent XML TechMail. I thought I'd share it with the forum:

Can I create a schema using Rose? Please elucidate.

XML TechMail author, Brian Schaffner, answered:

Sort of. You can't do it directly,but Rational provides some add-ins from their Website that allows you to accomplish this. Check out:

http://www.rational.com/support/downloadcenter/addins/rose/index.jsp

And look for the XML add-in and the XML DTD -> XML Schema Translation downloads. You should be able to model your XML in Rose using the XML_DTD notation, and then use these tools to generate the schema.

-brian-

by maryweilage

The link in the previous post has an extra space that breaks the URL. Remove the space in (ro se) when you past the link and it should work fine.

We apologize for the extra step and we are working on fixing the problem with posting long URLs.

by ericktreetops

I'm not an expert on XML but why would you store an XML document as a blob in a database. Sure an XML document is made up of tags and data. Why not store the data in a table that's what they are for and build the tags based on a schema, which couldalso be stored in a table.

In SQL Server 2000 it outputs XML but it gets the data from a table and the tags from the schema. Why not do the same ?

Or am I barking up the wront tree ?

by yukunix

If you store data in table, that means you acept a completely fixed schema(NOT XML Schema). One of the advantage of XML is just the flexibility of its data model.

We use XML to store data, especially on Internet, because we believe that almost nothing can always keep stable. I don't know the machenism of M$ SQL server's implementation, if that's true, it 'd prove that fact again, that is, M$ really always makes things different from standard.

by kdee

Depends what you want to do with the XML document.

If you normally want to retrieve it quickly and send it somewhere else, it's probably best to store as a BLOB. That way you don't have the overhead of constructing the XML every time.

If you have a strict document structure and you need to do database operations like searches, or produce variations on it (e.g. filtered or personalised versions), you probably want to store as separate fields and build up the XML each time you retrieve it.

by ntcse

I was kinda attracted to the idea that SQL Server has capabilities built in to pump out XML from relational data at first. I tried it and although it was really efficient, it is not flexible enough.

One small thing, why can't there just be the ability to give a name to the elements returned other than "row"?

When I tried to do a simple parent child relationship in the output XML using two tables linked together with a relationship table in between them (M to N relationship), I had to start reading up on the "universal table" method.

Personally, I'm gonna stick to generating the XML in my VB code so I don't have to pollute my stored procedures with cryptic syntax...

by pranav

Look into XML EXPLICIT and also SQL UDF, you can use this two combined almost anything yow want. Also table variable is something you should look at. You will find the information about these keywords in Books Online

by maryweilage

If you can offer this member insight into how to resolve the following problem, please e-mail them at mwelch@ontarioeast.net:

"Specifically, I want to parse an XML file and instantiate a "MgrBean" class with the data on a Tomcat server. As such,for security reasons, I would like to place the ..xml static resource files in the WEB-INF directory ( or below, if possible). To date, I have not been able to achieve this. It seems that Tomcat4.x cannot find any .xml files (except it's own config files). I have done a lot of testing at an application level to ensure that my code all works together OK; but when I put it on the Tomcat server, it fails to find the .xml files. I have tried various incantations such as "getContext().getRealPath()", and "getResourceAsStream()", and so on in an attempt to find a correct "path" call. But so far - zip, nada! Can anyone in your sphere of expertise help? Thanks in advance."

by pclapham

I am using Websphere 4.0, not Tomcat, but they should both be implementing the same J2EE spec. And this line in my code finds a file in the WEB-INF directory of my web application perfectly well:

File f = new File(getServletContext().getRealPath(xslFile));

Note that the string I pass to that method is just the bare file name, with no path information at all.

PC2

This discussion is closed to new replies.