Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

problem in importing two different classes with same name...

800328Jul 16 2008 — edited Jul 16 2008
I have to import two different classes in my program with the same name....
import org.apache.lucene.document.Document;
import org.w3c.dom.Document;




//    I AM USING THE DOCUMENT FROM W3C PACKAGE HERE....

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
	            DocumentBuilder builder = factory.newDocumentBuilder();
	            InputSource is = new InputSource( new StringReader( tempString ) );
	            d = builder.parse( is );
	            NodeList images = d.getElementsByTagName("img");
	            int length = images.getLength();
	            for(int i = 0;i<length;i++)
	            {
	                Node image = images.item(i);
	                String tempAltText = image.getAttributes().getNamedItem("alt").getNodeValue();
	                altText = altText.concat(" ").concat(tempAltText);
	            }
and the error i am getting is
 [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:20: org.apache.lucene.document.Document is already defined in a single-type import
    [javac] import org.w3c.dom.Document;
    [javac] ^
    [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:132: incompatible types
    [javac] found   : org.w3c.dom.Document
    [javac] required: org.apache.lucene.document.Document
    [javac] d = builder.parse( is );
    [javac] ^
    [javac] C:\Documents and Settings\sumit-i\WolframWorkspaces\Base\WolframNutch\src\java\com\wolfram\nutch\indexer\InfoCenterFilter.java:133: cannot find symbol
    [javac] symbol  : method getElementsByTagName(java.lang.String)
    [javac] location: class org.apache.lucene.document.Document
    [javac] NodeList images = d.getElementsByTagName("img");
    [javac] ^
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 3 errors
any idea ..how to resolve it

Edited by: ping.sumit on Jul 16, 2008 3:39 PM

Edited by: ping.sumit on Jul 16, 2008 3:40 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 13 2008
Added on Jul 16 2008
6 comments
2,408 views