[jdom-interest] create namespace

Ashar Siddiqui siddiqui.ashar at gmail.com
Fri Nov 11 15:31:45 PST 2005


I am trying to create like this

<?xml version="1.0" encoding="UTF-8" ?>

<BackgroundCheck xmlns="
http://www.hirbc.com/xml/Screening/BackgroundCheck-2_0"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

*xsi:*schemaLocation="http://www.hirbc.com/xml/Screening/BackgroundCheck-2_0

http://www.hirbc.com/xml/Screening/Screenings-2_0/Schemas/BackgroundCheck-2_0.xsd"
userId="900JHY" password="WF040503" account="900JHY">

<BackgroundSearchPackage >…

 I am using JDOM 1.0.

Here is my code.

 *public* Element root = *new* Element("BackgroundCheck", "
http://www.hirbc.com/xml/Screening/BackgroundCheck-2_0" );

Namespace xsi = *null*;

Namespace schemaloc = *null*;

xsi= Namespace.getNamespace("xsi", "
http://www.w3.org/2001/XMLSchema-instance" );

root.addNamespaceDeclaration(xsi);

schemaloc = Namespace.getNamespace("schemaLocation", "
http://www.hirbc.com/xml/Screening/BackgroundCheck-2_0
http://www.hirbc.com/xml/Screening/Screenings-2_0/Schemas/BackgroundCheck-2_0.xsd
");

root.addNamespaceDeclaration(schemaloc);

root.setAttribute("userId","900JHY");

root.setAttribute("password","WF040503");

root.setAttribute("account", "900JHY");

 this code giving me result like this

 <?xml version="1.0" encoding="UTF-8" ?>

<BackgroundCheck xmlns="
http://www.hirbc.com/xml/Screening/BackgroundCheck-2_0"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

*xmlns:*schemaLocation="
http://www.hirbc.com/xml/Screening/BackgroundCheck-2_0

http://www.hirbc.com/xml/Screening/Screenings-2_0/Schemas/BackgroundCheck-2_0.xsd"
userId="900JHY"password="WF040503" account="900JHY">

<BackgroundSearchPackage *xmlns="*">…
how to fix it special I want xsi:schemaLocation not xmlns:schemaLocation,
and why BackgroundSearchPackage has xmlns=""
thank you

--
Ashar Siddiqui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20051111/92acce16/attachment.htm


More information about the jdom-interest mailing list