You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Michael Glavassevich <mr...@ca.ibm.com> on 2007/06/10 18:12:05 UTC

Re: JAXP with Extended DOMParser

Hi,

In the JAXP sense the DOMParser is just an implementation detail, one 
which we may change in the future. I doubt that's something we would want 
to start exposing. In general you should avoid extending Xerces' 
implementation classes. They could be altered or removed at any time, 
possibly breaking your code when you move to a new release. If you want to 
add user data to the DOM as it's being built, I recommend that you use an 
LSParser [1] instead and register an LSParserFilter [2] with it which 
attaches the user data to the nodes as it receives them.

Thanks.

[1] 
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSParser.html
[2] 
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSParserFilter.html

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

johndoe Doe <j1...@yahoo.com> wrote on 06/09/2007 03:58:16 PM:

> It is currently not possible to extend existing
> org.apache.xerces.jaxp.DocumentBuilderImpl so as to
> use an implementation that extends
> org.apache.xerces.parsers.DOMParser. (Package scoped
> constructors and "new DOMParsers()" in the
> newDocumentInstance() method)
> 
> It is possible to extend DOMParser to add special user
> data for nodes typically by extending startElement and
> endElement. However, it is not trivial to incorporate
> this extended DOMParser for JAXP use.
> 
> Can you please suggest an appropriate mechanism so
> that this custom DOMParser can be easily used in a
> typical JAXP sense. 
> 
> - One idea would be to have a
> org.apache.xerces.jaxp.DocumentBuilderImpl that looks
> at a property that provides a classname that is
> org.apache.xerces.parsers.DOMParser or a class that
> extends org.apache.xerces.parsers.DOMParser.
> 
> 
____________________________________________________________________________________
> Shape Yahoo! in your own image.  Join our Network Research Panel today!  

> http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-dev-help@xerces.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Xerces-J and XInclude relative path issue

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Razvan,

XMLLocatorWrapper won't help you with that. Most likely you haven't 
provided a base URI, in which case you need to set the system ID [1] on 
the InputSource you're passing to the parser.

Thanks.

[1] 
http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/InputSource.html#setSystemId(java.lang.String)

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Razvan Mihailescu <ra...@yahoo.com> wrote on 06/11/2007 09:20:46 AM:

> Hi, Michael,
> 
> I have a master .xml file (artefacts.xml) having
> references to other .xml files to be included
> (codelists.xml etc.). The path from the working dir,
> where my xml files are located, is /resources. My
> problem is that when I try to parse that document with
> SAX parser, I got some error telling me that the
> codelists.xml file could not be found on the path -
> and I can see the absolute path to the working dir,
> not to /resources dir.
> Here are my XMLs, in short:
> 
> artefacts.xml
> <Structure xmlns:xi="http://www.w3.org/2001/XInclude">
>   <xi:include href="codelists.xml"/>
> </Structure>
> 
> codelists.xml
> <CodeLists>
> </CodeLists>
> 
> Thank you!
> Razvan
> --- Michael Glavassevich <mr...@ca.ibm.com> wrote:
> 
> > Hi Razvan,
> > 
> > Though I don't see how this is relevant to whatever
> > "relative path" issue 
> > you've run into, if you want to see how
> > XMLLocatorWrapper is being used in 
> > Xerces take a look at XIncludeHandler [1].
> > 
> > Thanks.
> > 
> > [1] 
> >
> http://svn.apache.
> 
org/viewvc/xerces/java/trunk/src/org/apache/xerces/xinclude/XIncludeHandler.
> java?view=log
> > 
> > Michael Glavassevich
> > XML Parser Development
> > IBM Toronto Lab
> > E-mail: mrglavas@ca.ibm.com
> > E-mail: mrglavas@apache.org
> > 
> > Razvan Mihailescu <ra...@yahoo.com> wrote on
> > 06/11/2007 07:50:01 AM:
> > 
> > > Hello,
> > > 
> > > I read on your Jira Xerces site about
> > XERCESJ-1247.
> > > Can you please show me a small code snipet (or
> > tell me
> > > which SVN files to check) with sample usage of
> > > XMLLocatorWrapper?
> > > 
> > > Best Regards,
> > > Razvan Mihailescu-Baltag
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > j-users-unsubscribe@xerces.apache.org
> > For additional commands, e-mail:
> > j-users-help@xerces.apache.org
> > 
> > 
> 
> 
____________________________________________________________________________________
> The fish are biting. 
> Get more visitors on your site using Yahoo! Search Marketing.
> http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Xerces-J and XInclude relative path issue

Posted by Razvan Mihailescu <ra...@yahoo.com>.
Hi, Michael,

I have a master .xml file (artefacts.xml) having
references to other .xml files to be included
(codelists.xml etc.). The path from the working dir,
where my xml files are located, is /resources. My
problem is that when I try to parse that document with
SAX parser, I got some error telling me that the
codelists.xml file could not be found on the path -
and I can see the absolute path to the working dir,
not to /resources dir.
Here are my XMLs, in short:

artefacts.xml
<Structure xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="codelists.xml"/>
</Structure>

codelists.xml
<CodeLists>
</CodeLists>

Thank you!
Razvan
--- Michael Glavassevich <mr...@ca.ibm.com> wrote:

> Hi Razvan,
> 
> Though I don't see how this is relevant to whatever
> "relative path" issue 
> you've run into, if you want to see how
> XMLLocatorWrapper is being used in 
> Xerces take a look at XIncludeHandler [1].
> 
> Thanks.
> 
> [1] 
>
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/xinclude/XIncludeHandler.java?view=log
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> Razvan Mihailescu <ra...@yahoo.com> wrote on
> 06/11/2007 07:50:01 AM:
> 
> > Hello,
> > 
> > I read on your Jira Xerces site about
> XERCESJ-1247.
> > Can you please show me a small code snipet (or
> tell me
> > which SVN files to check) with sample usage of
> > XMLLocatorWrapper?
> > 
> > Best Regards,
> > Razvan Mihailescu-Baltag
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail:
> j-users-help@xerces.apache.org
> 
> 



 
____________________________________________________________________________________
The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: Xerces-J and XInclude relative path issue

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Razvan,

Though I don't see how this is relevant to whatever "relative path" issue 
you've run into, if you want to see how XMLLocatorWrapper is being used in 
Xerces take a look at XIncludeHandler [1].

Thanks.

[1] 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/xinclude/XIncludeHandler.java?view=log

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Razvan Mihailescu <ra...@yahoo.com> wrote on 06/11/2007 07:50:01 AM:

> Hello,
> 
> I read on your Jira Xerces site about XERCESJ-1247.
> Can you please show me a small code snipet (or tell me
> which SVN files to check) with sample usage of
> XMLLocatorWrapper?
> 
> Best Regards,
> Razvan Mihailescu-Baltag

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


Re: Xerces-J and XInclude relative path issue

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Razvan,

Though I don't see how this is relevant to whatever "relative path" issue 
you've run into, if you want to see how XMLLocatorWrapper is being used in 
Xerces take a look at XIncludeHandler [1].

Thanks.

[1] 
http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/xinclude/XIncludeHandler.java?view=log

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Razvan Mihailescu <ra...@yahoo.com> wrote on 06/11/2007 07:50:01 AM:

> Hello,
> 
> I read on your Jira Xerces site about XERCESJ-1247.
> Can you please show me a small code snipet (or tell me
> which SVN files to check) with sample usage of
> XMLLocatorWrapper?
> 
> Best Regards,
> Razvan Mihailescu-Baltag

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Xerces-J and XInclude relative path issue

Posted by Razvan Mihailescu <ra...@yahoo.com>.
Hello,

I read on your Jira Xerces site about XERCESJ-1247.
Can you please show me a small code snipet (or tell me
which SVN files to check) with sample usage of
XMLLocatorWrapper?

Best Regards,
Razvan Mihailescu-Baltag
--- Michael Glavassevich <mr...@ca.ibm.com> wrote:

> Hi,
> 
> In the JAXP sense the DOMParser is just an
> implementation detail, one 
> which we may change in the future. I doubt that's
> something we would want 
> to start exposing. In general you should avoid
> extending Xerces' 
> implementation classes. They could be altered or
> removed at any time, 
> possibly breaking your code when you move to a new
> release. If you want to 
> add user data to the DOM as it's being built, I
> recommend that you use an 
> LSParser [1] instead and register an LSParserFilter
> [2] with it which 
> attaches the user data to the nodes as it receives
> them.
> 
> Thanks.
> 
> [1] 
>
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSParser.html
> [2] 
>
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSParserFilter.html
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> johndoe Doe <j1...@yahoo.com> wrote on
> 06/09/2007 03:58:16 PM:
> 
> > It is currently not possible to extend existing
> > org.apache.xerces.jaxp.DocumentBuilderImpl so as
> to
> > use an implementation that extends
> > org.apache.xerces.parsers.DOMParser. (Package
> scoped
> > constructors and "new DOMParsers()" in the
> > newDocumentInstance() method)
> > 
> > It is possible to extend DOMParser to add special
> user
> > data for nodes typically by extending startElement
> and
> > endElement. However, it is not trivial to
> incorporate
> > this extended DOMParser for JAXP use.
> > 
> > Can you please suggest an appropriate mechanism so
> > that this custom DOMParser can be easily used in a
> > typical JAXP sense. 
> > 
> > - One idea would be to have a
> > org.apache.xerces.jaxp.DocumentBuilderImpl that
> looks
> > at a property that provides a classname that is
> > org.apache.xerces.parsers.DOMParser or a class
> that
> > extends org.apache.xerces.parsers.DOMParser.
> > 
> > 
>
____________________________________________________________________________________
> > Shape Yahoo! in your own image.  Join our Network
> Research Panel today!  
> 
> >
>
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
> 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> j-dev-unsubscribe@xerces.apache.org
> > For additional commands, e-mail:
> j-dev-help@xerces.apache.org
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail:
> j-users-help@xerces.apache.org
> 
> 



       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


Xerces-J and XInclude relative path issue

Posted by Razvan Mihailescu <ra...@yahoo.com>.
Hello,

I read on your Jira Xerces site about XERCESJ-1247.
Can you please show me a small code snipet (or tell me
which SVN files to check) with sample usage of
XMLLocatorWrapper?

Best Regards,
Razvan Mihailescu-Baltag
--- Michael Glavassevich <mr...@ca.ibm.com> wrote:

> Hi,
> 
> In the JAXP sense the DOMParser is just an
> implementation detail, one 
> which we may change in the future. I doubt that's
> something we would want 
> to start exposing. In general you should avoid
> extending Xerces' 
> implementation classes. They could be altered or
> removed at any time, 
> possibly breaking your code when you move to a new
> release. If you want to 
> add user data to the DOM as it's being built, I
> recommend that you use an 
> LSParser [1] instead and register an LSParserFilter
> [2] with it which 
> attaches the user data to the nodes as it receives
> them.
> 
> Thanks.
> 
> [1] 
>
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSParser.html
> [2] 
>
http://xerces.apache.org/xerces2-j/javadocs/api/org/w3c/dom/ls/LSParserFilter.html
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> johndoe Doe <j1...@yahoo.com> wrote on
> 06/09/2007 03:58:16 PM:
> 
> > It is currently not possible to extend existing
> > org.apache.xerces.jaxp.DocumentBuilderImpl so as
> to
> > use an implementation that extends
> > org.apache.xerces.parsers.DOMParser. (Package
> scoped
> > constructors and "new DOMParsers()" in the
> > newDocumentInstance() method)
> > 
> > It is possible to extend DOMParser to add special
> user
> > data for nodes typically by extending startElement
> and
> > endElement. However, it is not trivial to
> incorporate
> > this extended DOMParser for JAXP use.
> > 
> > Can you please suggest an appropriate mechanism so
> > that this custom DOMParser can be easily used in a
> > typical JAXP sense. 
> > 
> > - One idea would be to have a
> > org.apache.xerces.jaxp.DocumentBuilderImpl that
> looks
> > at a property that provides a classname that is
> > org.apache.xerces.parsers.DOMParser or a class
> that
> > extends org.apache.xerces.parsers.DOMParser.
> > 
> > 
>
____________________________________________________________________________________
> > Shape Yahoo! in your own image.  Join our Network
> Research Panel today!  
> 
> >
>
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
> 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> j-dev-unsubscribe@xerces.apache.org
> > For additional commands, e-mail:
> j-dev-help@xerces.apache.org
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail:
> j-users-help@xerces.apache.org
> 
> 



       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org