XML

Apr. 28th, 2010 09:24 am
rowyn: (studious)
[personal profile] rowyn
For those of you familiar with using xml --

I want to be able to code an xml form which will do basic mathmatical operations and store data. For exmple, my end user would see a form that said "Enter X" and "Enter Y", and after the user entered X & Y, the page would calculate X/Y, display the result, and then store everything.

Now, my actual question is not "how do I do this?" but "how annoying is it to learn enough xml to know how to do this sort of thing?" It seems like a simple enough kind of thing, but I've not actually coded in xml before. I will have access to an exceedingly simple xml form designer which will do the "enter and store X&Y" part, but not do operations based on the data entered. I kinda want to just manually edit the designer's code and add the other stuff, but I'm not sure if this falls in the category of "browse webpages on xml coding and figure it out" or "get an xml book and figure it out" or "1-day training course" or "college class". Suggestions?

Date: 2010-04-28 03:33 pm (UTC)
From: [identity profile] shaterri.livejournal.com
One note: XML, in and of itself, isn't a language per se. There are languages that make use of XML, both for sheer data representation or even for their syntax (e.g., XSLT, which is a language of sorts for taking XML and changing it into... more XML), but at its heart XML isn't a language, it's a data (and metadata) format. My broader question is 'what exactly are you trying to accomplish?' From your description it sounds like what you're after might actually be Javascript rather than XML, but it's impossible to say for sure without understanding the broad task.

Date: 2010-04-28 03:43 pm (UTC)
From: [identity profile] nkcmike.livejournal.com
I agree. Sounds like Javascript to me.

Date: 2010-04-28 06:38 pm (UTC)
From: [identity profile] tetsujinnooni.livejournal.com
Quick 'how it might work' notes; this will vary depending on how well or poorly ImageNow actually structures their forms representation. This also presumes they are using either embedded or explicit browser based HTML as their UI engine for their XML forms...

A piece of information in a field in the document can be represented as an XPath selector like: //form/field[@name='X'].

That of course presumes that the document represents user input fields as tags like <field name='X' controlType='text' /> in the final XML.

From your description, they have an event handling model wherein you can attach javascript methods or blocks to specific triggers (like the value in a field changing). The javascript would then involve using their documentation of how to select a field from the form and extract its value.)

Equivalent in html:

function addTwoFields(){
// this doesn't do error checking or any other sensible thing
var x = new Number(document.getElementById('fieldOneId').value);
var y = new Number(document.getElementById('fieldTwoId').value);
document.getElementById('fieldThreeId').value = (x+y);
}

This is NOT what I'd call production grade javascript, but illustrates using number to get relatively validated values rather than concatenating strings in the users-can't-type case...

Date: 2010-04-28 06:47 pm (UTC)
From: [identity profile] tetsujinnooni.livejournal.com
I guess the upshot is: browse pages on coding dynamic web pages and the documentation for ImageNow. Unfortunately, ImageNow's docs are only available through their customer portal, making a quick look for complexity evaluation hard.

json

Date: 2010-04-29 12:32 pm (UTC)
From: [identity profile] garyamort.livejournal.com
Well, I like the dependability of XML, but if their product gives you the option of getting the data in JSON format, go with that because it is dead easy to learn to access/code data stored in JSON.

As for XML itself, here is the summary for all you need to know to start:
Namespace:
xmlns:edi='http://ecommerce.example.org/schema'

At the top of the document. An arbitrary text string that just appears to look like a url. Your supposed to make a unique one for each type of file/data and in theory going to that url would give you a listing of all the fields - but practically no one ever actually sets up the documentation page - so it's just a meaningless string.

Basically, it's so a program would now that
xmlns:edi='http://ecommerce.example.org/schema1.0'
and
xmlns:edi='http://ecommerce.example.org/schema1.1'

Are 2 different formatting options for data, elements and attributes:
http://www.w3schools.com/DTD/dtd_el_vs_attr.asp

XML elements:
something like
tagname..tagdata....closetagname

Logical, self explanatory, the data is inside the tags.

Then you could have something like
setoftags
tag1name...tagdata...closetag1name
tag2name...tagdata...closetag2name
closesetoftags

Again, all of that is intuitive sense.

But most people like to store data in attributes instead, so it's
tagname....data=value....closetag
or even something like
setofdataname....name1=value1...name2=value2....closesetofdataname

Almost every language, including javascript has a parser to parse the xml into something meaningful, http://www.w3schools.com/xmL/xml_parser.asp that can then have programming assigned to it.

Date: 2010-04-28 04:07 pm (UTC)
From: [identity profile] caffeinewabbit.livejournal.com
What shaterri said - xml is a format for data storage, not a programming language. The form generator probably stores its forms in xml, and might have a special tag set that it interprets to generate interactive forms, but that'd be unique to the generator program and not inherent to xml itself.

Date: 2010-04-29 02:18 am (UTC)
From: [identity profile] jurann.livejournal.com
You know people who are (apparently) better and more knowledgeable than me on the topic, so I'll decline to restate what has already been said.

February 2026

S M T W T F S
1 234567
891011121314
15161718192021
22232425262728

Most Popular Tags

Active Entries

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 10th, 2026 10:43 pm
Powered by Dreamwidth Studios