dooberry Posted April 20, 2006 Share Posted April 20, 2006 Ok I simpered a bit in the title there, but if anyone could help I'd be grateful and you'll see why.I have an input field which reads from and writes to an XML node.The problem is that I had to write a function to do this and I would like to be able to define the node as a property of the input field e.g. :<input type="text" id="look at me" xmlnode="mydata/ishere" /> I know that "illegal" attributes are allowed in XHTML (it only audits the syntax not the content), but what I need to know is whether they are ignored by XHTML or if they create a new attribute for the item.If an xmlnode attribute would be created by the above tag then my problem would be solved, but if not then my code is doubled!Any advice?Dooberry If there's no spoon, how am I supposed to eat the soup without getting it on my chin? Answer that one, Baldy!! Link to comment Share on other sites More sharing options...
Little Goat Posted April 20, 2006 Share Posted April 20, 2006 well, it doesn't matter if the XHTML ignores it, does it? only your javascript needs it right? if you are using javascript. LG Link to comment Share on other sites More sharing options...
boen_robot Posted April 20, 2006 Share Posted April 20, 2006 That's right. Only the JavaScript needs it. However, if you want to generate a valid markup, you should choose some existing attribute which doesn't do anything anyway. One such example is the "rel" attribute. Another example in this particular case would be to define a class. After all, you aren't obligated to define CSS properties for a class to be valid.And btw, as far as I knew, attributes can't begin with "xml". Link to comment Share on other sites More sharing options...
dooberry Posted April 24, 2006 Author Share Posted April 24, 2006 Thanks for the info guys that's cool.What I didn't want is for the attribute to be "thrown away" by the browser so that the Javascript couldn't see it.You could well be right about the xml prefix so I'll call it something like mynode (although it wouldn't surprise me if "node" isn't allowed either!!) I'll let you know if it does what it says on the tin.Dooberry We're goin' down down ... Link to comment Share on other sites More sharing options...
dooberry Posted April 24, 2006 Author Share Posted April 24, 2006 It worked.This means I can add a node attribute to an input element and use this attribute to submit the data back to the xml file. <input id="myinputid" mynode="xmlelement/xmlnode" onChange="submitxml(this.mynode, this.value, 'myxmlfile.xml')" /> The stuff I've learned on here is so cool!! Dooberry. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now