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="">…