Re: [xml] make XPointer( id(XX) ) and C14n work without DTD



On Tue, Feb 24, 2004 at 11:28:46AM +0800, Andrew Fan wrote:
Daniel Veillard wrote:

On Mon, Feb 23, 2004 at 06:29:23PM +0800, Andrew Fan wrote:


Hi,

I have a xml file like,
---------
<test>
<content Id="target">
 Hello, World!
</content>
...............
<Reference URI="#target">
</Reference>
</test>
-------------

And I parsed it as DOM tree and want to use XPointer( id( "target" ) ) 
to get the content. Because of the absence of DTD, I have to hack the 
DOM with "xmlAddID", which make the XPointer work.  And then, I want to 
make a C14n transform over the DOM, I can not get the correct result. 
What alse must I do in order to get the correct C14n?
  


XPointer id() is actually XPath id() and only works if you can assert
IDness of an attribute, and that requires a DTD per the spec. Trying to
make what you suggest would simply make the library not conformant to the
specifications. Sorry that's not possible. Use a different XPointer
expression not based on id().



Which XPointer expression can I used to express the above URI?  Thanks.

  something like 
     /test/content[ Id='target']
 or  //content[ Id='target']
 or  //*[ Id='target']

 depending on your language target which I have no idea for. You can
find XPath tutorials all over the web,

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]