Results 1 to 11 of 11

Thread: How to use private QPatternist in my project?

  1. #1
    Join Date
    Jun 2019
    Posts
    5
    Thanks
    1

    Default How to use private QPatternist in my project?

    I am trying to use a xmlpatterns-private. I could get the headers by adding
    Qt Code:
    1. qt += xmlpatterns-private.
    To copy to clipboard, switch view to plain text mode 
    But when I compile it gives the error:

    Qt Code:
    1. undefined reference to `QPatternist::XsdSchemaResolver::~XsdSchemaResolver()'
    To copy to clipboard, switch view to plain text mode 

    So it supposes means that header was found but the lib didn't install my Qt environment. How to install or adding such a private module into Qt instead of compiling the whole Qt source? I'm guessing that I shall pull the xmlpatterns source and compile it, put it into some folder... In other words how to perform the installation of the private module.

    What I tried:

    1. Download Qt 5.13 source code
    2. Open qtxmlpatterns.pro in QtCreator
    3. Add
    Qt Code:
    1. CONFIG+=xml-schema
    To copy to clipboard, switch view to plain text mode 
    in qtxmlpatterns.pro
    4. Build
    5. Go to build folder and run
    Qt Code:
    1. mingw32-make install
    To copy to clipboard, switch view to plain text mode 
    6. Rebuild my project, but gives the same error...

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,396
    Thanks
    37
    Thanked 1,542 Times in 1,493 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to use private QPatternist in my project?

    Have you checked the link command when your program is being built?
    Does it link against the Qt xml patterns library?

    If not maybe also add the non private module to the QT variable.

    Cheers,
    _

  3. #3
    Join Date
    Jun 2019
    Posts
    5
    Thanks
    1

    Default Re: How to use private QPatternist in my project?

    it suppose be the part of xmlpattern. I see this

    qtConfig(xml-schema) {
    include($$PWD/schema/schema.pri)
    }
    in the .pro. I think add CONFIG+= xml-schema suppose enable xml-shcema. but the private part cannot be found in the lib file.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,396
    Thanks
    37
    Thanked 1,542 Times in 1,493 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to use private QPatternist in my project?

    The private class might not be exported.

    Libraries are often compiled with "hidden symbols", on Windows that is even default.
    Only classes and functions which are explicitly exported are "visible" for the linker.

    This could be the case here.

    Which private API are you trying to use and for which purpose?

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    ark (21st July 2019)

  6. #5
    Join Date
    Jun 2019
    Posts
    5
    Thanks
    1

    Default Re: How to use private QPatternist in my project?

    any trick to make it visible?
    I want to use it to parse the xsd file using XsdParser.

  7. #6
    Join Date
    Jun 2019
    Posts
    5
    Thanks
    1

    Default Re: How to use private QPatternist in my project?

    I import the whole source into my project but still got a similar error. Could you please take a look?
    https://drive.google.com/drive/folde...ez?usp=sharing

  8. #7
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,543
    Thanks
    13
    Thanked 1,577 Times in 1,506 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to use private QPatternist in my project?

    The Qt XmlPatterns module exports public classes to deal with XML Schemas and validation using them (QXmlSchema and QXmlSchemaValidator).
    What do you think that the private class, which is private for a reason, gives you that you cannot achieve with the public API?

  9. #8
    Join Date
    Jun 2019
    Posts
    5
    Thanks
    1

    Default Re: How to use private QPatternist in my project?

    I need to parse the xsd file(not XML). serialize it and not for validation. so need the xmlschemaprivate which not in the public API.

  10. #9
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,063
    Thanks
    233
    Thanked 649 Times in 639 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to use private QPatternist in my project?

    As ChrisW67 says, certain files and classes are private in the Qt sources for good reasons, in particular because Qt makes no promises that they won't change in future releases or go away entirely. So basing software on something that has no guarantees is pretty risky IMO. Do you want to be in the situation where you update your Qt version and suddenly find that nothing compiles any more and there may be no way to fix it since the code you depended on no longer exists?

    You might look at other XML parser implementations, such as xerces-c from the Apache Foundation. One of them might have exposed APIs that handle what you want to do. I use xerces-c in large, cross-platform projects both with and without Qt and have no portability or integration issues. And because it is entirely independent from Qt, my XML code is unaffected by Qt updates.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  11. #10
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,543
    Thanks
    13
    Thanked 1,577 Times in 1,506 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: How to use private QPatternist in my project?

    Quote Originally Posted by ark View Post
    I need to parse the xsd file(not XML). serialize it and not for validation. so need the xmlschemaprivate which not in the public API.
    An XML Schema document (file) is just another XML document. You are perfectly able to read and write it like any other XML file using the public APIs. If you are not using the schema file to validate other files then the Qt Xml (DOM, SAX) or Qt Core module (QXmlStreamReader/Writer) are quite enough to handle file as far as I can tell.

  12. #11
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,063
    Thanks
    233
    Thanked 649 Times in 639 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to use private QPatternist in my project?

    An XML Schema document (file) is just another XML document.
    Exactly. It is confusing to me why the OP seems to feel he needs to step outside the normal SAX / DOM parsing API. While he may not need to validate the XSD, perhaps he wants to be able to parse out the XSD-specific element and attribute names without having to write the essentially same code the validator uses.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Private/Public API
    By Tinu in forum General Programming
    Replies: 0
    Last Post: 3rd August 2016, 15:32
  2. Replies: 7
    Last Post: 4th March 2015, 07:07
  3. private slots ??
    By salmanmanekia in forum Qt Programming
    Replies: 7
    Last Post: 6th August 2008, 14:00
  4. private inheritance
    By mickey in forum General Programming
    Replies: 8
    Last Post: 24th April 2008, 09:19
  5. Why does Qt use Private classes?
    By hyling in forum Qt Programming
    Replies: 2
    Last Post: 12th December 2006, 22:11

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.