Help - how to create element with proper namespace 2003-03-05 - By Peter Len
Sander,
Hey, thanks for the super quick response. I will give that a try. My question dealt with creating an element like: <requestSummary xmlns="urn:expertmgmt">
I may need to use something like: <xxx:requestSummary xmlns="urn:expertmgmt">
How would I be able to add the prefix 'xxx' to my elements?
Sorry for this double question but I forgot to add my this other possibility.
Thanks again for your help - Peter
Sander Bos wrote:
> Dear Peter, > > > I am simply trying to create a Element that will look like the > > following: > > > > <requestSummary xmlns="urn:expertmgmt"> > > > > I run into problems when using createElementNS or createAttributeNS. > > Here is an exmaple of one of my attempts: > > > > Element root = doc.createElement("requestSummary"); > > Attr att = doc.createAttributeNS("urn:expertmgmt", "xxx"); > > root.setAttributeNode(att); > > RETURNS: <requestSummary xxx=""/> > > > > Does anyone know how to create the element I need? > > The attribute creation should be: > Attr att = > doc.createAttributeNS("http://www.w3.org/2000/xmlns/", > "xmlns"); > att.setValue("urn:expertmgmt"); > or you could use > root.setAttributeNS("http://www.w3.org/2000/xmlns/", > "xmlns", "urn:expertmgmt"); > > urn:expertmgmt is the value of the attribute here, > http://www.w3.org/2000/xmlns/ is the namespace of the namespace > attribute (you would normally not see that URI in any > text-representation of the document). > > Kind regards, > > --Sander. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) > For additional commands, e-mail: xerces-j-user-help@(protected)
--------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@(protected) For additional commands, e-mail: xerces-j-user-help@(protected)
|
|