Giter Site home page Giter Site logo

Comments (5)

tefra avatar tefra commented on September 13, 2024 1

For repeating choices, on sequences that the order might change you can use compound fields

https://xsdata.readthedocs.io/en/latest/models/fields/#elements
https://xsdata.readthedocs.io/en/latest/codegen/config/#compoundfields

from xsdata.

tefra avatar tefra commented on September 13, 2024

Hi @sedrew can you post the whole excerpt please, from only that output I don't see what's the different both xml outputs are equivalent.

from xsdata.

sedrew avatar sedrew commented on September 13, 2024

I'm trying to overwrite slide from powerpoint. I did some additional research and found out that the namespace problem is not related to a powerpoint reading error. I found out that the Wildcard order does not match the original file. Because of this, powerpoint cannot read this xml.

image image

after_parser.txt
after_power_point.txt

Not a problem for reading powerpoint:
image

from xsdata.

sedrew avatar sedrew commented on September 13, 2024

Hi @sedrew can you post the whole excerpt please, from only that output I don't see what's the different both xml outputs are equivalent.

How do I save index positions in XmlVar for elements during parsing?

For example, one Sp element in xml may be located at the beginning, the other at the end of the root

image
@dataclass
class SpTree:
    class Meta:
        name = "spTree"
        namespace = (
            "http://schemas.openxmlformats.org/presentationml/2006/main"
        )

    nv_grp_sp_pr: Optional[NvGrpSpPr] = field(
        default=None,
        metadata={
            "name": "nvGrpSpPr",
            "type": "Element",
            "required": True,
        },
    )
    grp_sp_pr: Optional[GrpSpPr] = field(
        default=None,
        metadata={
            "name": "grpSpPr",
            "type": "Element",
            "required": True,
        },
    )
    sp: List[Sp] = field(
        default_factory=list,
        metadata={
            "type": "Element",
            "min_occurs": 1,
        },
    )

    any_elements: List[object] = field(
        default_factory=list,
        metadata={
            "type": "Wildcard",
            "namespace": "##any"
        }
    )

from xsdata.

sedrew avatar sedrew commented on September 13, 2024

Thanks, It helped me.

    shapes: List[Union[NvGrpSpPr, GrpSpPr, Sp]] = field(
        metadata={
            "type": "Elements",
            "choices": (
                {"wildcard": True, "type": object},
                {"name": "sp", "type": Sp},
                {"name": "grpSpPr", "type": GrpSpPr},
                {"name": "nvGrpSpPr", "type": NvGrpSpPr}
            )
        }
    )

from xsdata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.