简体   繁体   中英

Outputing plain text with XQuery, Zorba & Eclipse

I am attempting to get my head around using XQuery on a project im working on. One thing that I will need to do is use XQuery to parse an XML model and output plain text (this plain text will actually be C++ code, as the project is to create a XML -> C++ code generator).

It seems pretty straightforward to have it output HTML tags (as ive seen in most examples this is the likely use case for XQuery) by simply adding HTML into your code and surrounding XQuery commands in braces.

Is it possible to do this but rather than have HTML just have plain text?

Note: I am using eclipse with zorba for my XQuery development.

Cheers.

Whether your XQuery outputs text, HTML, XML, or some other format (eg, JSON) is a matter of how you configure your query's serialization options. It's usually as simple as declaring the output method and mimetype. Some XQuery implementations have their own serialization options syntax, and some use the W3C's XSLT and XQuery Serialization spec . This link in Zorba's documentation indicates that Zorba supports the options outlined in the formal spec.

A somewhat dated thread , circa 2012, may offer some more specifics, but since I'm not a Zorba user, I can't give you more up to date suggestions than this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM