0

I am trying to take advantage of JAXB code generation from a XML Schema to use in an Android project through SimpleXML library, which uses another type of Assertion than JAXB (I do not want to include a 9MB lib tu support JAXB in my Android project). See question previously asked

Basically, I am writing a small Python script to perform the required changes on each Java file generated through the xcj tool, and so far it is working for import deletion/modification, simple line annotation, and also the annotation for which a List @XMLElement needs to be converted to an @ElementList one.

The only issue I am facing right now is for removing annotations on several lines, such as @XMLSeeAlso or @XMLType like the following

@XmlType(name = "AnimatedPictureType", propOrder = {
    "resources",
    "animation",
    "caption"
})

or

@XmlSeeAlso({
    BackgroundRGBColorType.class,
    ForegroundRGBColorType.class
})

I tried different strategies using either Multineline, DotAll, or both, but without any success. I am new to "advanced" regex usage as well as Python so I am probably missing something silly.

For my simple XSD processing that is the only step I cannot get running to achieve a fully automated script using xcj and then automatically convert JAXB annotations into Simple XML ones.

Thank you in advance for your help.

1 Answer 1

1

@Xml.*\}\) with dotall enabled should as far as i know match any annotation starting with @Xml and ending with "})", even when it is multiline.

For a good view of what your regex actually matches you could always test your regular expressions at websites like https://pythex.org/

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot, I was looking for something "complex" where something this simple was enough. Sorry about this !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.