[jdom-interest] Newbie & setting Attributes

Bradley S. Huffman hip at a.cs.okstate.edu
Thu Oct 17 12:59:48 PDT 2002


"Aimee Ukasick" writes:

> Hello. I have a question about attributes that I'm hoping someone can help
> with. I need to create an XML document that looks like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <csbAcknowledgement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="http://milpathccefge/csb/csbAcknowledgement.xs
> d">
> 	<SubmittalKey>
> 		<SourceSystem>EWF</SourceSystem>
> 		<DestinationSystem>PANTHER</DestinationSystem>
> 		<DatetimeCreated>2001-12-17T09:30:47-05:00</DatetimeCreated>
> 		<EcommerceSubmittalID>String</EcommerceSubmittalID>
> 		<SubmittalId>4294967295</SubmittalId>
> 	</SubmittalKey>
> </csbAcknowledgement>
> 
> The problem I am having is creating 
> 'xsi:noNamespaceSchemaLocation="http://milpathccefge/csb/csbAcknowledgement.x
> sd"'.

    Namespace ns = Namespace.getNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
    Element csb = new Element("csbAcknowledgement");
    csb.setAttribute("noNamespaceSchemaLocation",
                     "http://milpathccefge/csb/csbAcknowledgement.xsd",
                      ns);

Brad



More information about the jdom-interest mailing list