xmlutil icon indicating copy to clipboard operation
xmlutil copied to clipboard

Issues migrating to 0.90.2-beta1

Open StefanOltmann opened this issue 1 year ago • 3 comments

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.

StefanOltmann avatar Jul 28 '24 07:07 StefanOltmann

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.

pdvrieze avatar Jul 30 '24 19:07 pdvrieze

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.

StefanOltmann avatar Aug 24 '24 05:08 StefanOltmann

@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).

pdvrieze avatar Aug 24 '24 15:08 pdvrieze