Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > the reference of the content of XML element

Reply
Thread Tools

the reference of the content of XML element

 
 
mavis
Guest
Posts: n/a
 
      05-31-2006
the reference of the content of XML element

In XSD, how can I specify the content of an element refers to the
content of another element in an xml file?

Thanks a lot!

 
Reply With Quote
 
 
 
 
Joe Kesselman
Guest
Posts: n/a
 
      05-31-2006
mavis wrote:
> In XSD, how can I specify the content of an element refers to the
> content of another element in an xml file?


Make the value a keyref or idref to that other element? Or make the
value an XPath which can be used to find that element?

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 
Reply With Quote
 
 
 
 
mavis
Guest
Posts: n/a
 
      05-31-2006
Thanks a lot ,

Could you instruct how to refer to another element if it is not key or
unique by using xpath?



Joe Kesselman wrote:
> mavis wrote:
> > In XSD, how can I specify the content of an element refers to the
> > content of another element in an xml file?

>
> Make the value a keyref or idref to that other element? Or make the
> value an XPath which can be used to find that element?
>
> --
> () ASCII Ribbon Campaign | Joe Kesselman
> /\ Stamp out HTML e-mail! | System architexture and kinetic poetry


 
Reply With Quote
 
Joe Kesselman
Guest
Posts: n/a
 
      05-31-2006
mavis wrote:
> Could you instruct how to refer to another element if it is not key or
> unique by using xpath?


An XPath is a description of how to find information within a document
-- a simple query operation, if you want to look at it that way.

It's up to the environment to say which document; there's no reason your
system can't use an XPath within a doc to refer to another part of that
doc. XSLT stylesheets sometimes do exactly this, examining themselves to
(for example) do a table lookup. In XSLT, any XPath starting with a call
to the no-arguments version of the document() function is a request to
search the stylesheet document.

Of course, actually following the XPath to the node it refers to will
require running an XPath interpreter, giving it the approrpiate context
information. The TrAX APIs are one semi-standardized way of doing that
in Java; DOM Level 3 also introduces its own XPath API.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 
Reply With Quote
 
mavis
Guest
Posts: n/a
 
      06-01-2006
Thanks. I mean how can we deifne this in the schema file? For example,
in the XSD file, set the default value of an element to be the content
from another element??

Thanks!


Joe Kesselman wrote:
> mavis wrote:
> > Could you instruct how to refer to another element if it is not key or
> > unique by using xpath?

>
> An XPath is a description of how to find information within a document
> -- a simple query operation, if you want to look at it that way.
>
> It's up to the environment to say which document; there's no reason your
> system can't use an XPath within a doc to refer to another part of that
> doc. XSLT stylesheets sometimes do exactly this, examining themselves to
> (for example) do a table lookup. In XSLT, any XPath starting with a call
> to the no-arguments version of the document() function is a request to
> search the stylesheet document.
>
> Of course, actually following the XPath to the node it refers to will
> require running an XPath interpreter, giving it the approrpiate context
> information. The TrAX APIs are one semi-standardized way of doing that
> in Java; DOM Level 3 also introduces its own XPath API.
>
> --
> () ASCII Ribbon Campaign | Joe Kesselman
> /\ Stamp out HTML e-mail! | System architexture and kinetic poetry


 
Reply With Quote
 
Joe Kesselman
Guest
Posts: n/a
 
      06-01-2006
mavis wrote:
> Thanks. I mean how can we deifne this in the schema file? For example,
> in the XSD file, set the default value of an element to be the content
> from another element??


No can do. This is something the application needs to deal with, not the
schema. Schemas are best thought of as constraining and typechecking
documents; copying a value from one place to another is outside their scope.


--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
XPath expression for element based on content of other element withsame parent Ian Wilson XML 2 07-26-2007 04:11 PM
the reference of the content of XML element Mavis Java 0 05-31-2006 10:59 PM
Problem to insert an XML-element by XSLT-converting from one XML-file into another XML-file jkflens XML 2 05-30-2006 09:41 AM



Advertisments