problem with parsing xml with these jars: xercesImpl.jar and xml-apis.jar

Hi

after parsing the xml file I`m getting a Document object:

DocumentBuilder db =.....................
doc = db.parse(new StringBufferInputStream(source.toString()), url);  // source had the xml as string and the uri is set to the dtd directory

sposse this is the xml

<root>
     <one  name="first">
              <bbb value="4"/>
     </one>
</root>

after doing the parse command somthing amazing happend:

it adding the bbb tag another attribute ( ligal one that mention in the dtd file) although I don`t need it now.
I remind you that Imust work with xercesImpl.jar and xml-apis.jar

how could I slove it ?
Thanks
aquaswAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

zzynxSr. Software engineerCommented:
aquasw,
would you be so kind as to close (or react in) some of your old open questions?
CEHJCommented:
>>it adding the bbb tag another attribute

What attribute?
aquaswAuthor Commented:
at the dtd there is serval of attributes that could be at this kind of tag.

after the parsing the bbb tag looks like:

<bbb secondvalue=".." value="4"/>

I don`t need the "secondvalue" attribute  , and didn`t add it to the bbb tag, but after the parsing it appears.
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

CEHJCommented:
Can you post the dtd?
aquaswAuthor Commented:
<!ELEMENT one EMPTY>
<!ATTLIST bbb
      value CDATA #REQUIRED
      secondvalue (yes | no) "no"
>
CEHJCommented:
Don't know about this one i'm afraid
aquaswAuthor Commented:
well I think that  it goes over the dtd and add attributes acording to it.
The question is how could I prevent it ?
novicerCommented:
You can prevent it, because you specified this attribute in the DTD file. The "secondevalue" is always present as your DTD definition. You can modify your DTD like this:
<!ELEMENT one EMPTY>
<!ATTLIST bbb
     value CDATA #REQUIRED
     secondvalue #IMPLIED
>
The attribute secondvalue is OPTIONAL now, just use it when needed.
Hope this may help.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.