f



Help with Querying XML Document

Hello All,

The xml document below describes the contents of a folder in a
Document Managment System. I need to retrieve the DocId for the most
recently added (<Add_Date>) spreadsheet file(<name> ends with ".XLS").
As a newbie to XML, XSL and XPATH, I wanted to bounce some ideas off
the more experienced folks in this group.

<?xml version="1.0" encoding="utf-8" ?> 
<FolderDetails xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://tempuri.org/">
<Docs>
 <DocumentDetails>
   <Name>EIU.xls</Name> 
   <Version>1</Version> 
   <Add_Date>10/8/2003 3:41:51 PM</Add_Date> 
   <DocType>E</DocType> 
   <DocId>15607779</DocId> 
  </DocumentDetails>
  <DocumentDetails>
   <Name>MAKE.xls</Name> 
   <Version>1</Version> 
   <Add_Date>10/17/2003 8:22:43 AM</Add_Date> 
   <DocType>E</DocType> 
   <DocId>15608338</DocId> 
  </DocumentDetails>
 </Docs>
</FolderDetails>


My first thought was to transform this XML into another XML which is
sorted on  Add_date (descending order) and then pick the very first
occurance of docId.  But there does not seem to be a direct way to
sort on a date value.

I know this is an awfully inadequate explanation of what I am
attempting to do. But I am asking for any ideas or sample code to
quickly and efficiently accomplish this. I am under a tremendous
amount of pressure so any help, ideas, code snippets.. gratefully
accepted...

Thanks in advance,
Jay
0
vrajan (3)
11/5/2003 9:14:21 PM
comp.text.xml 8781 articles. 0 followers. Post Follow

4 Replies
342 Views

Similar Articles

[PageSpeed] 31

> The xml document below describes the contents of a folder in a
> Document Managment System. I need to retrieve the DocId for the most
> recently added (<Add_Date>) spreadsheet file(<name> ends with ".XLS").

This transformation:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:output omit-xml-declaration="yes"/>
  <xsl:template match="Docs">
    <xsl:for-each
      select="DocumentDetails[substring(Name,
                                        string-length(Name) - 3
                                        )
                              =
                               '.xls'
                              ]">
       <xsl:sort
select="substring-before(substring-after(substring-after(Add_Date, '/'),
'/'), ' ')"
        data-type="number"/>

       <xsl:sort select="substring-before(Add_Date, '/')"
        data-type="number"/>

       <xsl:sort select="substring-before(substring-after(Add_Date, '/'),
'/')"
        data-type="number"/>

       <xsl:sort select="substring(Add_Date, string-length(Add_Date) - 1)"
/>

       <xsl:sort
select="translate(substring-before(substring-after(Add_Date, ' '), ' '),
':', '')"
        data-type="number"/>

        <xsl:if test="position() = last()">
          <xsl:copy-of select="."/>
        </xsl:if>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>

when applied on this source.xml:

<FolderDetails>
  <Docs>
    <DocumentDetails>
      <Name>EIU.xls</Name>
      <Version>1</Version>
      <Add_Date>10/8/2003 3:41:51 PM</Add_Date>
      <DocType>E</DocType>
      <DocId>15607779</DocId>
    </DocumentDetails>
    <DocumentDetails>
      <Name>MAKE.xls</Name>
      <Version>1</Version>
      <Add_Date>10/18/2001 8:22:43 PM</Add_Date>
      <DocType>E</DocType>
      <DocId>15608338</DocId>
    </DocumentDetails>
    <DocumentDetails>
      <Name>MAKE.xls</Name>
      <Version>1</Version>
      <Add_Date>10/18/2001 8:22:44 AM</Add_Date>
      <DocType>E</DocType>
      <DocId>15608338</DocId>
    </DocumentDetails>
    <DocumentDetails>
      <Name>MAKE.xls</Name>
      <Version>1</Version>
      <Add_Date>10/18/2001 8:22:43 AM</Add_Date>
      <DocType>E</DocType>
      <DocId>15608338</DocId>
    </DocumentDetails>
    <DocumentDetails>
      <Name>MAKE.xls</Name>
      <Version>1</Version>
      <Add_Date>10/17/2001 8:22:43 AM</Add_Date>
      <DocType>E</DocType>
      <DocId>15608338</DocId>
    </DocumentDetails>
    <DocumentDetails>
      <Name>MAKE.xls</Name>
      <Version>1</Version>
      <Add_Date>9/17/2001 8:22:43 AM</Add_Date>
      <DocType>E</DocType>
      <DocId>15608338</DocId>
    </DocumentDetails>
  </Docs>
</FolderDetails>

will correctly sort it by Add_Date (sorting correctly by year, month, date,
AM/PM and time) and produce the DocumentDetails element with the latest
value of Add_Date. In this particular case the result is:

  <DocumentDetails>
      <Name>EIU.xls</Name>
      <Version>1</Version>
      <Add_Date>10/8/2003 3:41:51 PM</Add_Date>
      <DocType>E</DocType>
      <DocId>15607779</DocId>
    </DocumentDetails>

If one does not want to write such code, they may use the str-split-to-words
template from FXSL.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

"VJ" <vrajan@lucent.com> wrote in message
news:b9bb6af2.0311051314.338f0f96@posting.google.com...
> Hello All,
>
> The xml document below describes the contents of a folder in a
> Document Managment System. I need to retrieve the DocId for the most
> recently added (<Add_Date>) spreadsheet file(<name> ends with ".XLS").
> As a newbie to XML, XSL and XPATH, I wanted to bounce some ideas off
> the more experienced folks in this group.
>
> <?xml version="1.0" encoding="utf-8" ?>
> <FolderDetails xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="http://tempuri.org/">
> <Docs>
>  <DocumentDetails>
>    <Name>EIU.xls</Name>
>    <Version>1</Version>
>    <Add_Date>10/8/2003 3:41:51 PM</Add_Date>
>    <DocType>E</DocType>
>    <DocId>15607779</DocId>
>   </DocumentDetails>
>   <DocumentDetails>
>    <Name>MAKE.xls</Name>
>    <Version>1</Version>
>    <Add_Date>10/17/2003 8:22:43 AM</Add_Date>
>    <DocType>E</DocType>
>    <DocId>15608338</DocId>
>   </DocumentDetails>
>  </Docs>
> </FolderDetails>
>
>
> My first thought was to transform this XML into another XML which is
> sorted on  Add_date (descending order) and then pick the very first
> occurance of docId.  But there does not seem to be a direct way to
> sort on a date value.
>
> I know this is an awfully inadequate explanation of what I am
> attempting to do. But I am asking for any ideas or sample code to
> quickly and efficiently accomplish this. I am under a tremendous
> amount of pressure so any help, ideas, code snippets.. gratefully
> accepted...
>
> Thanks in advance,
> Jay


0
dnovatchev (267)
11/6/2003 6:02:20 AM
Hi Dimitre,

Thank you for your response. It works like a charm IF I don't have the
namespace declaration as part of the root node <FolderDetails>.
However since the xml I receive already has the namespace declaration
in it, I can not seem to get this to produce the desired result.


if this :
<FolderDetails xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="http://tempuri.org/">

looks like this:

<FolderDetails>

Then your xsl is the answer. But since it isn't any ideas on what
should be tweaked?..


Thank you,
Jay


"Dimitre Novatchev" <dnovatchev@yahoo.com> wrote in message news:<bocn60$1cdqp7$1@ID-152440.news.uni-berlin.de>...
> > The xml document below describes the contents of a folder in a
> > Document Managment System. I need to retrieve the DocId for the most
> > recently added (<Add_Date>) spreadsheet file(<name> ends with ".XLS").
> 
> This transformation:
> 
> <xsl:stylesheet version="1.0"
>  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> 
>  <xsl:output omit-xml-declaration="yes"/>
>   <xsl:template match="Docs">
>     <xsl:for-each
>       select="DocumentDetails[substring(Name,
>                                         string-length(Name) - 3
>                                         )
>                               =
>                                '.xls'
>                               ]">
>        <xsl:sort
> select="substring-before(substring-after(substring-after(Add_Date, '/'),
> '/'), ' ')"
>         data-type="number"/>
> 
>        <xsl:sort select="substring-before(Add_Date, '/')"
>         data-type="number"/>
> 
>        <xsl:sort select="substring-before(substring-after(Add_Date, '/'),
> '/')"
>         data-type="number"/>
> 
>        <xsl:sort select="substring(Add_Date, string-length(Add_Date) - 1)"
> />
> 
>        <xsl:sort
> select="translate(substring-before(substring-after(Add_Date, ' '), ' '),
> ':', '')"
>         data-type="number"/>
> 
>         <xsl:if test="position() = last()">
>           <xsl:copy-of select="."/>
>         </xsl:if>
>     </xsl:for-each>
>   </xsl:template>
> 
> </xsl:stylesheet>
> 
> when applied on this source.xml:
> 
> <FolderDetails>
>   <Docs>
>     <DocumentDetails>
>       <Name>EIU.xls</Name>
>       <Version>1</Version>
>       <Add_Date>10/8/2003 3:41:51 PM</Add_Date>
>       <DocType>E</DocType>
>       <DocId>15607779</DocId>
>     </DocumentDetails>
>     <DocumentDetails>
>       <Name>MAKE.xls</Name>
>       <Version>1</Version>
>       <Add_Date>10/18/2001 8:22:43 PM</Add_Date>
>       <DocType>E</DocType>
>       <DocId>15608338</DocId>
>     </DocumentDetails>
>     <DocumentDetails>
>       <Name>MAKE.xls</Name>
>       <Version>1</Version>
>       <Add_Date>10/18/2001 8:22:44 AM</Add_Date>
>       <DocType>E</DocType>
>       <DocId>15608338</DocId>
>     </DocumentDetails>
>     <DocumentDetails>
>       <Name>MAKE.xls</Name>
>       <Version>1</Version>
>       <Add_Date>10/18/2001 8:22:43 AM</Add_Date>
>       <DocType>E</DocType>
>       <DocId>15608338</DocId>
>     </DocumentDetails>
>     <DocumentDetails>
>       <Name>MAKE.xls</Name>
>       <Version>1</Version>
>       <Add_Date>10/17/2001 8:22:43 AM</Add_Date>
>       <DocType>E</DocType>
>       <DocId>15608338</DocId>
>     </DocumentDetails>
>     <DocumentDetails>
>       <Name>MAKE.xls</Name>
>       <Version>1</Version>
>       <Add_Date>9/17/2001 8:22:43 AM</Add_Date>
>       <DocType>E</DocType>
>       <DocId>15608338</DocId>
>     </DocumentDetails>
>   </Docs>
> </FolderDetails>
> 
> will correctly sort it by Add_Date (sorting correctly by year, month, date,
> AM/PM and time) and produce the DocumentDetails element with the latest
> value of Add_Date. In this particular case the result is:
> 
>   <DocumentDetails>
>       <Name>EIU.xls</Name>
>       <Version>1</Version>
>       <Add_Date>10/8/2003 3:41:51 PM</Add_Date>
>       <DocType>E</DocType>
>       <DocId>15607779</DocId>
>     </DocumentDetails>
> 
> If one does not want to write such code, they may use the str-split-to-words
> template from FXSL.
> 
> 
> =====
> Cheers,
> 
> Dimitre Novatchev.
> http://fxsl.sourceforge.net/ -- the home of FXSL
> 
> "VJ" <vrajan@lucent.com> wrote in message
> news:b9bb6af2.0311051314.338f0f96@posting.google.com...
> > Hello All,
> >
> > The xml document below describes the contents of a folder in a
> > Document Managment System. I need to retrieve the DocId for the most
> > recently added (<Add_Date>) spreadsheet file(<name> ends with ".XLS").
> > As a newbie to XML, XSL and XPATH, I wanted to bounce some ideas off
> > the more experienced folks in this group.
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <FolderDetails xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns="http://tempuri.org/">
> > <Docs>
> >  <DocumentDetails>
> >    <Name>EIU.xls</Name>
> >    <Version>1</Version>
> >    <Add_Date>10/8/2003 3:41:51 PM</Add_Date>
> >    <DocType>E</DocType>
> >    <DocId>15607779</DocId>
> >   </DocumentDetails>
> >   <DocumentDetails>
> >    <Name>MAKE.xls</Name>
> >    <Version>1</Version>
> >    <Add_Date>10/17/2003 8:22:43 AM</Add_Date>
> >    <DocType>E</DocType>
> >    <DocId>15608338</DocId>
> >   </DocumentDetails>
> >  </Docs>
> > </FolderDetails>
> >
> >
> > My first thought was to transform this XML into another XML which is
> > sorted on  Add_date (descending order) and then pick the very first
> > occurance of docId.  But there does not seem to be a direct way to
> > sort on a date value.
> >
> > I know this is an awfully inadequate explanation of what I am
> > attempting to do. But I am asking for any ideas or sample code to
> > quickly and efficiently accomplish this. I am under a tremendous
> > amount of pressure so any help, ideas, code snippets.. gratefully
> > accepted...
> >
> > Thanks in advance,
> > Jay
0
vrajan (3)
11/6/2003 10:17:36 PM
Dimitre,

Thanks for your response. Your xsl works perfectly IF the
<FolderDetails> root node does not contain  namespace declarations.

If the root node looks like  this 
<FolderDetails>

It works great. However, my xml root looks like this:

<FolderDetails xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns="http://tempuri.org/">

and so when I do the transform, it lists everything in the xml
document and does not produce the desired result...

Any ideas?. 


Thanks again for your reply.
Jay
0
vrajan (3)
11/6/2003 10:28:50 PM
This is a VFAQ.

Read about the problem and the solution here:

"None of my XPath select statements will work going against an XML file with
a default namespace. Help! "

at:
     http://www.topxml.com/people/bosley/defaultns.asp



=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


"VJ" <vrajan@lucent.com> wrote in message
news:b9bb6af2.0311061428.32d8a799@posting.google.com...
> Dimitre,
>
> Thanks for your response. Your xsl works perfectly IF the
> <FolderDetails> root node does not contain  namespace declarations.
>
> If the root node looks like  this
> <FolderDetails>
>
> It works great. However, my xml root looks like this:
>
> <FolderDetails xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xmlns="http://tempuri.org/">
>
> and so when I do the transform, it lists everything in the xml
> document and does not produce the desired result...
>
> Any ideas?.
>
>
> Thanks again for your reply.
> Jay


0
dnovatchev (267)
11/7/2003 6:02:40 AM
Reply:

Similar Artilces:

Help on including one XML document within another XML document using XML Schemas
Hi I would like to specify an XML schema that would allow an XML document to be included within another XML document. The following example schema gives an idea of what we're trying to achieve ServiceResponse.xsd -------------------- <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="serviceResponse" type="ServiceResponse"/> <xs:complexType name="ServiceResponse"> <xs:sequence> <xs:element name="anXMLDocument" type="xs:string"/> <xs:element name="someOtherData" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> The element anXMLDocument would contain an XML data string that would be parsed against a different XML Schema. The identity of the XML Schema for parsing anXMLDocument is not known at the time the ServiceResponse XML is parsed. Previously when we used DTDs we used inline CDATA wrappers around the contained XML document to avoid it being parsed. Can we still continue to use inline CDATA wrappers around the XML data when we parse against XML schemas? I've tried looking into the XML Schema specs but the mention of CDATA seems a bit sparse and doesn't seem to answer the question. If we can't use an inline CDATA wrapper i...

file command: "XML document text" vs "XML document text"
I've just used the file command on four files of RDF-XML with the following output: augtfidf.rdf: XML document text kyoto.rdf: XML document text stuff.rdf: XML document text tfidf.rdf: XML document text What does it mean that one of them has an extra space between "XML" and "document"? -- The kid's a hot prospect. He's got a good head for merchandising, an agent who can take you downtown and one of the best urine samples I've seen in a long time. [Dead Kennedys t-shirt] On 16.10.2012 16:06, Adam Funk wrote: > I've just used the file command on four files of RDF-XML with the > following output: > > augtfidf.rdf: XML document text > kyoto.rdf: XML document text > stuff.rdf: XML document text > tfidf.rdf: XML document text > > What does it mean that one of them has an extra space between "XML" > and "document"? Hard to tell without further information. What does file *.rdf | od -c show you? Janis Janis Papanagnou wrote: > On 16.10.2012 16:06, Adam Funk wrote: >> I've just used the file command on four files of RDF-XML with the >> following output: >> >> augtfidf.rdf: XML document text >> kyoto.rdf: XML document text >> stuff.rdf: XML document text >> tfidf.rdf: XML document text >> >> What does it mean that one ...

XML to XML
I have a gnucash file that I'm trying to transform into an identical XML file without the invoices. I've been at this for a while now. The gnucash file is in XML and the element I'm looking into is: <gnc:transaction> I want to ignore those that contain <slot:key>gncInvoice</slot:key> which is a child of slot which is a child of slots which is a child of transactions. Any help you're willing to provide would be greatly appreciated. Thanks. Classic application for XSLT. Start with the identity transformation, then add a template which matches the ones you want to treat specially and yields no output. From your description that would be match="gnc:transaction[transactions/slots/slot/slot:key='gncInvoice']" with the namespaces declared appropriately in the stylesheet. (That looks like a somewhat unlikely markup design to me, but since I haven't played with gnucash at all I'm taking your word for it.) -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architexture and kinetic poetry Actually, from the Relax-NG schema for gnucash, it looks like it should be more like "gnc:transaction[trn:slots/slot/slot:key='gncInvoice']" with gnc:, trn:, and slot: all bound to the appropriate namespace URIs. The fact that some of their elements -- eg <slot> -- aren't in any namespace is probably left over from a pre-namespaces initial design, as is their now-brok...

Refer to an XML document from within an XML document
Is there an "XML" way to reference an XML document from within an XML document? How do I do this? TIA, - Manish Manish Hatwalne wrote: > Is there an "XML" way to reference an XML document from within an XML > document? How do I do this? XLink: http://www.w3.org/TR/xlink/ XPointer framework: http://www.w3.org/TR/xptr-framework/ http://www.w3.org/TR/xptr-element/ XInclude: http://www.w3.org/TR/xinclude/ Check out yourself which of them comes close to what you understand "reference an XML document" to do. -- Martin Honnen http://JavaScript.FAQTs.com/ ...

XML or not XML?
I am developing a simple MySQL database editor, and am looking into creating an PHP/AJAX app as the GUI. A lot of this in new ground, and much more is dusting off things I haven't used in a while. My question though involves whether or nor to employ XML. I did some XML a few years back, but don't typically bother anymore. As I see it XML is great when I need to have an app with a standard data presentation that other developers can easily interface. I.E. like a bank statement that may feed a variety of applications developed by a variety of clients. However, if I am develo...

To XML or not to XML?
Ok, it has been a while since I've needed to make an involved web page. Coming back on the scene now is a bit confusing, what with all the cool stuff to use like XML, PHP, MySQL, etc... So here is my question. I'm in search of a good dynamic way to generate web pages which separates content from presentation. I am seeking to create a web site that, to put it succinctly, has a list of users and sets of information corresponding to each user. I am familiar with how to do this using PHP, MySQL, and regular old HTML. I maintain the user database in MySQL and dynamically present it and the information with PHP. This is very easy to do in terms of coding for it. But I'm wondering? Is it time for me to switch to the XML with XSL method instead? Everyone seems to be talking of XML as the end all be all. I've looked into it, and on the surface, I just can't tell if it's worth it. I don't really see the benefit. XML is just a "create your own HTML tags" and then figure out wtf to do with them orgy. Great, so I can write <dog>Spot</dog>. Whoop de do, that's useless to me unless I write a parser for it to display it in a user friendly way. And I shouldn't have to write a parser, there should be standardized ones for certain purposes. But wait, isn't that what HTML already is? A bunch of <dog>Spot</dog> (figuratively speaking) with the parsers having been written and mostly standardized between companies ages ago...

XML to XML newbee help
Hi, Me very confused. I have some XML that I want to convert to a more basic XML. I have put an example of what I have and what I want, I have used XSL to convert XML to HTML, but never this way. The <item numberingtext="10.01.01&#9;"> I want in the para tag I think, but if it has to be it own tag, no worrys. Any help would be fantastic Example of what I have: ========================= <?xml version="1.0" encoding="UTF-8" ?> <document xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:html="http://www.w3.org/HTML/1998/html4" xml:lang="en" style="widows: 0; orphans: 0; word-break-inside: normal; \-ilx-endnote-position: sectionbottom; \-ilx-endnote-style-type: lower-alpha; \-ilx-footnote-position: pagebottom; \-ilx-footnote-numbering-policy: continuous; \-ilx-endnote-numbering-policy: continuous; \-ilx-footnote-style-type: decimal;\-ilx-block-border-mode: merge;"> <part style="page: pageStyle1;"> <par class="Ahead">Duis autem vel eum iriure dolor in hendrerit in </par> <par class="Bhead">vulputate velit esse consequat</par> <par class="Normal" style="font-size: 12.0pt;"></par> <list style="margin-left: 18.0mm; list-style-type: decimal; \-ilx-list-group: 4; \-ilx-marker-align: left; \-ilx-marker-format: &quot;%0.%1.%0&quot;; \-ilx-marker-offset: -1020tw; \-ilx-marker-follo...

how to convert XML document to several XML documents in a new format
I'm migrating data into a content management system and in order to use the import tool provided I need to change the format of a large xml file and convert each entry to a seperate xml file. This is what I have now: <?xml version="1.0" encoding="UTF-8" ?> <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2005-04-18T12:05:51"> <Checklist> <ID>1</ID> <Category>stuff</Category> <Type>stuff</Type> <Item>stuff</Item> <Steps>stuff</Steps> </Checklist> <Checklist> <ID>2</ID> <Category>stuff</Category> <Type>stuff</Type> <Item>stuff</Item> <Steps>stuff</Steps> </Checklist> <Checklist> <ID>3</ID> <Category>stuff</Category> <Type>stuff</Type> <Item>stuff</Item> <Steps>stuff</Steps> </Checklist> <Checklist> <ID>4</ID> <Category>stuff</Category> <Type>stuff</Type> <Item>stuff</Item> <Steps>stuff</Steps> </Checklist> </dataroot> This is what I need each entry to be as a single file: <?xml version="1.0" ?> <file DocType="TypeName" DocTitle="TITLE:testing 123" DocDesc="TITLE:testing 123"> <section name=...

embedding xml in xml as non-xml :)
Hi all, I have an application that logs in xml. Assume <xmlLog></xmlLog>. In this element the app logs anything it gets from foreign hosts. Now if the host sends xml data, the structure of the document changes. ie. <xmlLog><somTag></somTag></xmlLog>. This will cause problems with my log reader, because it assumes that <xmlLog/> contains non-xml data. My question is, is there a way to treat the data in the <xmlLog/> element as non xml data. Something I can do that would treat anything this element contains as a literal? Any help or suggestions would be greatly appreciated. Regards, Mark Mark Van Orman <mark@icsaccess.com> wrote: > Hi all, > > I have an application that logs in xml. > > Assume <xmlLog></xmlLog>. In this element the app logs > anything it gets from foreign hosts. Now if the host sends xml > data, the structure of the document changes. ie. > <xmlLog><somTag></somTag></xmlLog>. This will cause problems > with my log reader, because it assumes that <xmlLog/> contains > non-xml data. > > My question is, is there a way to treat the data in the > <xmlLog/> element as non xml data. Something I can do that > would treat anything this element contains as a literal? > > Any help or suggestions would be greatly ap...

how to convert XML document to several XML documents in a new format #2
I'm migrating data into a content management system and in order to use the import tool provided I need to change the format of a large xml file and convert each entry to a seperate xml file. This is what I have now: <?xml version="1.0" encoding="UTF-8" ?> <dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2005-04-18T12:05:51"> <Checklist> <ID>1</ID> <Category>stuff</Category> <Type>stuff</Type> <Item>stuff</Item> <Steps>stuff</Steps> </Checklist> <Checklist> <ID>2</ID> <Category>stuff</Category> <Type>stuff</Type> <Item>stuff</Item> <Steps>stuff</Steps> </Checklist> <Checklist> <ID>3</ID> <Category>stuff</Category> <Type>stuff</Type> <Item>stuff</Item> <Steps>stuff</Steps> </Checklist> <Checklist> <ID>4</ID> <Category>stuff</Category> <Type>stuff</Type> <Item>stuff</Item> <Steps>stuff</Steps> </Checklist> </dataroot> This is what I need each entry to be as a single file: <?xml version="1.0" ?> <file DocType="TypeName" DocTitle="TITLE:testing 123" DocDesc="TITLE:testing 123"> <section name=...

magic/xml vs XML/Query
Hello, Some of you may be interested in it. I recoded solutions for W3C's XML Query Use Cases ( http://www.w3.org/TR/xquery-use-cases/ ) using magic/xml. Pretty-printed problems and solutions can be found at http://zabor.org/taw/magic_xml/xquery_use_cases.html and some more about recent development of magic/xml at http://t-a-w.blogspot.com/2006/08/magicxml-beats-xquery-at-w3cs-xml.html Enjoy :-) -- Tomasz Wegrzanowski [ http://t-a-w.blogspot.com/ ] ...

XML/XSLT Combining queries into XML ?
I am using ASP/VBScript to produce a XML file based on a AccesDB query (using adPersistXML) and include a XSL, by itself this works nicely. Is it possible to combine 2 separate queries into one file (using adPersistXML) ? eg. I have 2 tables with contain related data, however I only need one record from one table and multiple related records from the other. Or should I create 2 XML files and parse them using XSL (xsl:variable select="otherfile.xml") ? (this is not really the option I would like to see though.) Thanks BaKMaN ...

no tags in my xml-to-xml transformation, help....
my xml-to-xml transformation is outputting an xml header and then just text like this: <?xml version="1.0" encoding="iso-8859-1"?>e19dbb7b-5529-43a0...... I've searched regarding this problem and it seems that if there's no match in your xsl template then by default everything gets spat out. But I've tested this with very definite matches in my template, and still there are no xml tags in the output. Has anyone seen this before? Any help much appreciated.... Yannick yannicklaclau wrote: > my xml-to-xml transformation is outputting an xml header and then just > text like this: > > <?xml version="1.0" encoding="iso-8859-1"?>e19dbb7b-5529-43a0...... > > I've searched regarding this problem and it seems that if there's no > match in your xsl template then by default everything gets spat out. > > But I've tested this with very definite matches in my template, and > still there are no xml tags in the output. > > Has anyone seen this before? We do not need to guess, try to reduce to the minimum necessary to show the problem, then post the relevant XML and XSLT here, and tell us which XSLT processor you use. -- Martin Honnen http://JavaScript.FAQTs.com/ Ok, false alarm. As I suspected, it was a newbie issue. In case anyone else has this problem, the solution is to use copy-of instead of value-of. Pretty self-explanatory: value-of will output the va...

Query xml with text()
Hi, i've some problems when i use text() on page http://orario.trenitalia.com/b2c/TimeTable?stazin=fewfw&stazout=roma&datag=04&datam=07&dataa=2008&timsh=15&timsm=09&x=20&y=7&lang=it&nreq=5&channel=tcom if i do //B/text() it returns to me "Stazione di partenza: nessuna stazione corrisponde ai criteri di ricerca impostati." but if i try to do //B[text()="Stazione di partenza: nessuna stazione corrisponde ai criteri di ricerca impostati."] it doesn't found any element. i'm using the library javaXpCom to do the query on the webpage. What's wrong on this query? Thanks and sorry for my bad english Ciccio Pasticcio wrote: > Hi, > > i've some problems when i use text() > > on page > http://orario.trenitalia.com/b2c/TimeTable?stazin=fewfw&stazout=roma&datag=04&datam=07&dataa=2008&timsh=15&timsm=09&x=20&y=7&lang=it&nreq=5&channel=tcom > if i do //B/text() it returns to me "Stazione di partenza: nessuna stazione > corrisponde ai criteri di ricerca impostati." > but if i try to do //B[text()="Stazione di partenza: nessuna stazione > corrisponde ai criteri di ricerca impostati."] it doesn't found any element. Maybe it is an issue with leading and/or trailing white space. The source of that page contains <b>Stazione di partenza: nessuna stazione corrisponde ai criteri di ricerca impos...

Non-XML tagged value text to XML
I would like to use XSLT to translate some tagged value text to XML elements like this: Input Doc: <data>x=1.234 y=ABC z="Hello World"</data> Output Doc: <x>1.234</value> <y>ABC</y> <z>&quot;Hello World&quot;</z> Is XSLT up to the task? What would it look like? Most of the XSLT string processing code I've seen looks very verbose - can't be too efficient. mikea_59 wrote: > I would like to use XSLT to translate some tagged value text to XML > elements like this: > > Input Doc: > > <data>x=1.234 y=ABC z="Hello World"</data> > > Output Doc: > > <x>1.234</value> > <y>ABC</y> > <z>&quot;Hello World&quot;</z> > > Is XSLT up to the task? What would it look like? Most of the XSLT > string processing code I've seen looks very verbose - can't be too > efficient. Using XSLT 2.0 you can do that with regular expression matching as follows: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> <xsl:output method="xml" encoding="UTF-8" indent="yes" /> <xsl:template match="/"> <results> <xsl:apply-templates /> </results> </xsl:template> <xsl:template match="data"...

q) XML Schema and valid XML documents
Wikipedia provides the following definition for valid XML document (http://en.wikipedia.org/wiki/XML): it contains a reference to a Document Type Definition (DTD), and that its elements and attributes are declared in that DTD and follow the grammatical rules for them that the DTD specifies. There is no reference to XML Schema in the above defintion. I am presuming that this is a dated definition for valid XML document and that an XML document that has an XML Schema associated with it is also a valid XML document. Kindly confirm. Thanks, Ramesh In article &l...

Merging XML documents into a single XML file
Hello, I was wondering if anyone could shed some light on an issue I am having. I have 3 or 4 xml files which i need to merge onto another xml file called build_log.xml, which is produced using an ANT Logger. Then using XSL etc I want to format all of this into a pretty html format! Does anyone have any sample code they could shove my way?? Many thanks, Danny Knights daniel.knights@sunderland.ac.uk schreef: > Hello, > > I was wondering if anyone could shed some light on an issue I am > having. I have 3 or 4 xml files which i need to merge onto another xml > file called build_log.xml, which is produced using an ANT Logger. Then > using XSL etc I want to format all of this into a pretty html format! > Does anyone have any sample code they could shove my way?? > > Many thanks, > > Danny Knights > You could create an .xsl file which loads teh documents in variables! Take a xsl tutorial, and i'm sure you will succeed daniel.knights@sunderland.ac.uk wrote: > Hello, > > I was wondering if anyone could shed some light on an issue I am > having. I have 3 or 4 xml files which i need to merge onto another xml > file called build_log.xml, which is produced using an ANT Logger. Then > using XSL etc I want to format all of this into a pretty html format! > Does anyone have any sample code they could shove my way?? > > Many thanks, > > Danny Knights > Have the RefleX ! There is an example here : ht...

Validating parsed XML document against XML-schema
*PROBLEM: how to validate parsed XML document against (parsed) XML-schema. *IN: XML document as org.w3c.dom.Document, XML-schema as stream *OUT: information if document is valid against schema. If document is not valid DETAILED information about ALL errors (especially: node that caused problem). *Additional information: - validation is performed quite often, - XML-document object is changed quite often, - XML-Schema is fixed. - XML-document doesn't contain information about related XML-schema (attr xsi:noNamespaceSchemaLocation) - XML-Sche...

Example of an XML document with an inline xml schema
Hi All, I'm looking for a little example of an xml document which is validated using an inline xml schema. I'm a bit of a newbie, and I'm finding this to be a bit of a mind bender, so an example or some pointers which show me how to achieve this would be much appreciated. I look forward to any help or advice any one can offer. Naran Here's a trivial example <arbitrarytag xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="#local"> <xs:schema id="local"> <xs:element name="root" type="xs:integer"/> </xs:schema> <root>35a</root> </arbitrarytag> At least XSV [1] will process this in the desired way. ht [1] http://www.ltg.ed.ac.uk/~ht/xsv-status.html -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh Half-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/ [mail really from me _always_ has this .sig -- mail without it is forged spam] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/inlschma.asp -- Stan Kitsis Program Manager, XML Technologies Microsoft Corporation This posting is provided "AS IS" with...

xml from 2 xml
Hi to everybody, would I like to create a consequential xml from the elaboration of two files xml using xslt, but is it possible to give in input to a trasform 2 files xml? thanks for the possible answers I have already found from me the answer: the function document('file2.xml') matatu ha scritto: > Hi to everybody, > > would I like to create a consequential xml from the elaboration of two > files xml using xslt, but is it possible to give in input to a trasform > 2 files xml? > > thanks for the possible answers ...

XML DB Query Help
Hello, I would like to execute a query on some items stored in my Oracle XML DB that returns the name of the document which matches my query criteria. Say for instance I want to query an xml document that conforms to a registered schema who's "name" node equals "test". I have been able to create some XQueries that do this, but I just get back a document and not the name of the the document that this information is stored in. I think I am barking up the wrong tree with the XQuery, but it is not obvious to me where I should turn. I don't see a way to query a document that I find in the RESOURCE_VIEW or PATH_VIEW. I hope that makes sense, and any help would be greatly appretiated. Thanks, Dustin ...

Help with passing xml tags within an xml file
Let's say I have the following tags in an xml: <World> <Country>Canada</Country> <Hemisphere>North</Hemisphere> <Weather climate="cold" forecast="snow"> <CommandAction>$(HOME)\calculate.py Canada North snow</CommandAction> </Weather> </World> The CommandAction tag will invoke some python script which takes Country Hemisphere and forecast as parameters. Is there a way to generalize the CommandAction tag so that it can look something like the following: <CommandAction>$(HOME)\calculate.py <Country> <Hemisphere> <forecast></CommandAction> I'm not very experienced with xml and I would like to know if the above is a proper way of doing what I want. Any help please? Thanks Thierry Thierry wrote: > Let's say I have the following tags in an xml: > > > <World> > <Country>Canada</Country> > <Hemisphere>North</Hemisphere> > <Weather climate="cold" forecast="snow"> > <CommandAction>$(HOME)\calculate.py Canada North > snow</CommandAction> > </Weather> > </World> > > The CommandAction tag will invoke some python script which takes > Country Hemisphere and forecast as parameters. Is there a way to > generalize the CommandAction tag so that it can look something like the > following: &g...

Generate xml node tree from xmi (xml) help
Hi, I am using argouml ( really neat UML modeling tool) to create a model. I export the model to xmi format ( it's xml). My UML-diagram looks like this: Brand A | -------------------- | | | Brand B Brand C Brand D And Brand B, Brand C and Brand D can also have children and so on ......... I need to generate an xml file that can describe these relationships like: <MyModel> <Brand A> <Brand B> </Brand B> <Brand C> </Brand C> <Brand D> </Brand D> </Brand A> </MyModel> I am thinking of checking the children for root (Brand A) and generate TAGs for each node. Then I make the first node to the left (Brand B) the parent get all children for that one. Any one with hints on how I can do this in xslt. I need some sort of traversing to get the tree right? Regards, //Mikael -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ Mikael P wrote: > Hi, > > I am using argouml ( really neat UML modeling tool) to create a model. I > export the model to > xmi format ( it's xml). Try posting that XML . . Soren -- Fjern de 4 bogstaver i min mailadresse som er indsat for at hindre s... Remove the 4 letter word meaning "junk mail" in my mail address. ...

Help with transforming XML document
Hi, I need help with transforming XML document. I generate xml document from query using Oracle XSU (DBMS_XMLQUERY) and the document I get is like this: <?xml version = '1.0' encoding = 'ISO-8859-1'?> <MultiPAT> <PAT> <numreferencia>000000000000</numreferencia> <tipo>1</tipo> <trabajador> <trabajador_row num="1"> <apellido>Rius</apellido> <nombre>Jaume</nombre> <naf null="YES"/> <antiguedad> <antiguedad_row num="1"> <meses>15</meses> <dias>0</dias> </antiguedad_row> </antiguedad> <atep null="YES"/> <domicilio>CL.Barcelona, 27</domicilio> <telefono null="YES"/> </trabajador_row> </trabajador> </PAT> </MultiPAT> The problem is that the tags like <trabajador_row num="1"> are redundant and I'd also like to eliminate attributes null="YES" (that can be found within empty tags). I'd like to get something like this: <?xml version = '1.0' encoding = 'ISO-8859-1'?> <MultiPAT> <PAT> <numreferencia>000000000000</numreferencia> <tipo>1...

Web resources about - Help with Querying XML Document - comp.text.xml

Wanderers coach Tony Popovic slams Sydney FC's Graham Arnold for querying players' integrity
Western Sydney coach Tony Popovic has lashed out at Sydney FC coach Graham Arnold for suggesting Wanderers players celebrated Ali Abbas' injury ...

BBC News - Querying Nato's rapid reaction force
Nato's announcement of a beefed-up rapid reaction force raises big questions for many of its key member states, says the BBC's Jonathan Marcus. ...

The Pitching & Querying Advice You've Been Waiting For
There are few things in writing as terrifying and humbling as pitching and querying. Doing these things feels like asking someone out on a date, ...

Querying EntityFramework Views without a Key
By definition an Entity should have an Identity. An issue that often comes up with EF is querying views which do not have a primary key. No key, ...

Facebook unveils Presto engine for querying 250 PB data warehouse
At a conference for developers at Facebook headquarters on Thursday, engineers working for the social networking giant revealed that it’s using ...

Manually assigning .related('somerelation') without querying database? · Issue #919 · tgriesser/bookshelf ...
bookshelf - A simple Node.js ORM for PostgreSQL, MySQL and SQLite3 built on top of Knex.js

Cloudera Impala Brings SQL Querying To Hadoop
Cloudera's SQL-on-Hadoop tool hits general release, but will it satisfy demands for faster, easier exploration of big data?

Pivotal juices Hadoop with in-memory database and SQL querying
Pivotal, an EMC/VMware spin-off that has big plans to deliver big data analytics through platform as a service, has whisked the

Link Building Query Theory: 7 Crucial Keyword Types for Link Prospect Querying
These seven common types of prospect keywords will expand how you think about link prospecting and help you become a smarter, more strategically ...

Microsoft updates Power BI for Office 365 with data search, natural language querying, and 3D visualizations ...
Emil Protalinski / The Next Web : Microsoft updates Power BI for Office 365 with data search, natural language querying, and 3D visualizations ...

Resources last updated: 3/14/2016 1:24:10 AM