Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues migrating to 0.90.2-beta1 #231

Open
StefanOltmann opened this issue Jul 28, 2024 · 3 comments
Open

Issues migrating to 0.90.2-beta1 #231

StefanOltmann opened this issue Jul 28, 2024 · 3 comments

Comments

@StefanOltmann
Copy link

I want to migrate to the new version, but I get this exception:

e: file:///Users/sol/IdeaProjects/xmpcore/src/commonMain/kotlin/com/ashampoo/xmp/internal/DomParser.kt:47:27 This function is internal to the XmlUtil modules. No api stability is guaranteed

The target variable is now annotated as internal.

See https://github.com/Ashampoo/xmpcore/blob/5e6570322211de2b880005ed26b1e528e45b0e3c/src/commonMain/kotlin/com/ashampoo/xmp/internal/DomParser.kt

Please guide me how I can properly migrate to the new version.

@pdvrieze
Copy link
Owner

I've had a look at it.

The recommended way of using this type is to provide it with a dom node that will be written to (document, element or document fragment). If you provide null there is a side effect that writing will be to a new document as the document element (which you rely on). If an actual node is passed on, it is not possible to retrieve this node afterwards from the writer (only from the caller that passed it as constructor argument).

However, target is more or less stable so I can change it to experimental (rather than internal) in the next version.

@StefanOltmann
Copy link
Author

I'm still not sure how the proper usage must look like.

How do I create a document?
The methods I can see are also marked as experimental.

What I do there is hacky anyways.
I would prefer a proper official API that let's me parse a Document from a String.

@pdvrieze
Copy link
Owner

@StefanOltmann I'll try to add a shortcut, but effectively parsing a document from a string is a combination of first creating a parser that reads the xml stream and then writes it to a document stream. Also for JS(browser) this would be able to take the shortcut to return the document parsed.

In any case to create a document you do it the DOM way: xmlStreaming.genericDomImplementation.createDocument(). This API follows the DOM specification (I know it's not pretty).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants