Hello Andy,

Thank you very much for your time which you have spent in looking the
matter. I'm using "Xerces2 Java Parser 2.0.0 (beta) Release". I have not
set any feature (NAMESPACES_FEATURE_ID etc..) in my program. Do I need to
set them? Also do I need to implement EntityResolver.

Here is the code:
   try{
    DOMParser parser = new DOMParser();
    InputSource is = new InputSource(new FileInputStream(new
File(args[0])));
    is.setSystemId(args[0]);
    parser.parse(is);
    Document doc = parser.getDocument();
    Node nd = (Node)doc.getDocumentElement().getFirstChild();
    while(nd != null){
     if (nd.getNodeType()==Node.ELEMENT_NODE){
      if(nd.getAttributes() != null){

System.out.println(nd.getAttributes().getNamedItem("src").getNodeValue());

      }
     }
     nd = nd.getNextSibling();
    }
   }catch(Exception _ex){System.err.println(_ex.toString());}

DTD:--
<?xml encoding="UTF-8"?>
<!ENTITY img-path 'http://localhost/myapp/images/'>

XML:--

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE cmlib SYSTEM "file:///c:/myapp/cmlib.dtd">
<document>
 <img src="&img-path;doc.gif"/>
</document>

Thanks,
Sanjay Mishra




Andy Clark wrote:

> Sanjay Mishra wrote:
> > I'm trying to use an Entity Refrence in my XML, but during parsing
> > Xerces2.0 does not returns the entity value. It returns the "null"
> > value. I'm using the Entity in one of my xml's attribute.
>
> Using your sample files (but modifying them a bit to point to
> local files), I don't see the problem that you're experiencing.
> Could you go into more detail about how you are using the parser?
>
> For example, what version of the parser are you using? (I used
> Xerces 2.0.1 with your sample document.) Also, what settings are
> you using? etc...
>
> --
> Andy Clark * [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to